本文整理汇总了Java中com.liferay.portal.kernel.util.FileUtil.delete方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtil.delete方法的具体用法?Java FileUtil.delete怎么用?Java FileUtil.delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.kernel.util.FileUtil
的用法示例。
在下文中一共展示了FileUtil.delete方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: importContactsInBackground
import com.liferay.portal.kernel.util.FileUtil; //导入方法依赖的package包/类
@Override
public long importContactsInBackground(long userId, ExportImportConfiguration exportImportConfiguration,
InputStream inputStream, String extension) throws PortalException {
File file = null;
try {
file = FileUtil.createTempFile(extension);
FileUtil.write(file, inputStream);
return importContactsInBackground(userId, exportImportConfiguration, file);
} catch (IOException ioe) {
throw new SystemException(ioe);
} finally {
FileUtil.delete(file);
}
}
示例2: importTaskRecords
import com.liferay.portal.kernel.util.FileUtil; //导入方法依赖的package包/类
@Override
public void importTaskRecords(ExportImportConfiguration exportImportConfiguration, InputStream inputStream)
throws PortalException {
File file = null;
try {
file = FileUtil.createTempFile("lar");
FileUtil.write(file, inputStream);
importTaskRecords(exportImportConfiguration, file);
} catch (IOException ioe) {
throw new SystemException(ioe);
} finally {
FileUtil.delete(file);
}
}
示例3: importContacts
import com.liferay.portal.kernel.util.FileUtil; //导入方法依赖的package包/类
@Override
public void importContacts(ExportImportConfiguration exportImportConfiguration, InputStream inputStream)
throws PortalException {
File file = null;
try {
file = FileUtil.createTempFile("lar");
FileUtil.write(file, inputStream);
importContacts(exportImportConfiguration, file);
} catch (IOException ioe) {
throw new SystemException(ioe);
} finally {
FileUtil.delete(file);
}
}
示例4: importMeasurements
import com.liferay.portal.kernel.util.FileUtil; //导入方法依赖的package包/类
@Override
public void importMeasurements(
ExportImportConfiguration exportImportConfiguration,
InputStream inputStream) throws PortalException {
_log.info("importMeasurements()");
File file = null;
try {
// TODO: use extension from upload
file = FileUtil.createTempFile("lar");
FileUtil.write(file, inputStream);
importMeasurements(exportImportConfiguration, file);
} catch (IOException ioe) {
throw new SystemException(ioe);
} finally {
FileUtil.delete(file);
}
}
示例5: importMeasurementsInBackground
import com.liferay.portal.kernel.util.FileUtil; //导入方法依赖的package包/类
@Override
public long importMeasurementsInBackground(long userId,
ExportImportConfiguration exportImportConfiguration,
InputStream inputStream, String extension) throws PortalException {
_log.info("importMeasurementsInBackground()");
File file = null;
try {
file = FileUtil.createTempFile(extension);
FileUtil.write(file, inputStream);
return importMeasurementsInBackground(userId,
exportImportConfiguration, file);
} catch (IOException ioe) {
throw new SystemException(ioe);
} finally {
FileUtil.delete(file);
}
}
示例6: importLayouts
import com.liferay.portal.kernel.util.FileUtil; //导入方法依赖的package包/类
private void importLayouts(long userId,Group grupo,LayoutSetPrototype lsProto) throws PortalException, SystemException
{
LayoutSet ls = lsProto.getLayoutSet();
Map<String, String[]> parameterMap =getLayoutSetPrototypeParameters();
File fileIni= layoutLocalService.exportLayoutsAsFile(ls.getGroupId(), true,
null,parameterMap, null, null);
try
{
layoutLocalService.importLayouts(userId, grupo.getPublicLayoutSet().getGroupId(),
grupo.getPublicLayoutSet().isPrivateLayout(),
parameterMap, fileIni);
}
catch(Exception e)
{
}
FileUtil.delete(fileIni);
}
示例7: deleteExportedCourse
import com.liferay.portal.kernel.util.FileUtil; //导入方法依赖的package包/类
public void deleteExportedCourse(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
long groupId = ParamUtil.getLong(actionRequest, "groupId", 0);
String fileName = ParamUtil.getString(actionRequest, "fileName", StringPool.BLANK);
String redirect = ParamUtil.getString(actionRequest, "redirect", StringPool.BLANK);
File f = new File(PropsUtil.get("liferay.home")+"/data/lms_exports/courses/"+themeDisplay.getCompanyId()+"/"+groupId+"/"+fileName);
if (themeDisplay.getPermissionChecker().hasPermission(groupId, Course.class.getName(), groupId, ActionKeys.DELETE) && f != null && f.isFile()) {
FileUtil.delete(f);
SessionMessages.add(actionRequest, "courseadmin.delete.exported.confirmation.success");
} else {
SessionMessages.add(actionRequest, "courseadmin.delete.exported.confirmation.error");
}
if (Validator.isNotNull(redirect)) {
actionResponse.sendRedirect(redirect);
}
}
示例8: execute
import com.liferay.portal.kernel.util.FileUtil; //导入方法依赖的package包/类
@Override
public BackgroundTaskResult execute(BackgroundTask backgroundTask) throws Exception {
ExportImportConfiguration exportImportConfiguration = getExportImportConfiguration(backgroundTask);
List<FileEntry> attachmentsFileEntries = backgroundTask.getAttachmentsFileEntries();
File file = null;
for (FileEntry attachmentsFileEntry : attachmentsFileEntries) {
try {
file = FileUtil.createTempFile("lar");
FileUtil.write(file, attachmentsFileEntry.getContentStream());
_log.info(file.getAbsoluteFile());
TransactionInvokerUtil.invoke(transactionConfig,
new TaskRecordImportCallable(exportImportConfiguration, file));
} catch (Throwable t) {
if (_log.isDebugEnabled()) {
_log.debug(t, t);
} else if (_log.isWarnEnabled()) {
_log.warn("Unable to import taskRecords: " + t.getMessage());
}
throw new SystemException(t);
} finally {
FileUtil.delete(file);
}
}
return BackgroundTaskResult.SUCCESS;
}
示例9: execute
import com.liferay.portal.kernel.util.FileUtil; //导入方法依赖的package包/类
@Override
public BackgroundTaskResult execute(BackgroundTask backgroundTask) throws Exception {
ExportImportConfiguration exportImportConfiguration = getExportImportConfiguration(backgroundTask);
List<FileEntry> attachmentsFileEntries = backgroundTask.getAttachmentsFileEntries();
File file = null;
for (FileEntry attachmentsFileEntry : attachmentsFileEntries) {
try {
file = FileUtil.createTempFile("lar");
FileUtil.write(file, attachmentsFileEntry.getContentStream());
_log.info(file.getAbsoluteFile());
TransactionInvokerUtil.invoke(transactionConfig,
new ContactImportCallable(exportImportConfiguration, file));
} catch (Throwable t) {
if (_log.isDebugEnabled()) {
_log.debug(t, t);
} else if (_log.isWarnEnabled()) {
_log.warn("Unable to import contacts: " + t.getMessage());
}
throw new SystemException(t);
} finally {
FileUtil.delete(file);
}
}
return BackgroundTaskResult.SUCCESS;
}
示例10: importTaskRecordsInBackground
import com.liferay.portal.kernel.util.FileUtil; //导入方法依赖的package包/类
@Override
public long importTaskRecordsInBackground(long userId, ExportImportConfiguration exportImportConfiguration,
InputStream inputStream, String extension) throws PortalException {
_log.info("importTaskRecordsInBackground()");
File file = null;
try {
file = FileUtil.createTempFile(extension);
FileUtil.write(file, inputStream);
return importTaskRecordsInBackground(userId, exportImportConfiguration, file);
} catch (IOException ioe) {
throw new SystemException(ioe);
} finally {
FileUtil.delete(file);
}
}
示例11: execute
import com.liferay.portal.kernel.util.FileUtil; //导入方法依赖的package包/类
@Override
public BackgroundTaskResult execute(BackgroundTask backgroundTask) throws Exception {
ExportImportConfiguration exportImportConfiguration = getExportImportConfiguration(backgroundTask);
long userId = exportImportConfiguration.getUserId();
List<FileEntry> attachmentsFileEntries = backgroundTask.getAttachmentsFileEntries();
File file = null;
for (FileEntry attachmentsFileEntry : attachmentsFileEntries) {
try {
String extension = attachmentsFileEntry.getExtension();
file = FileUtil.createTempFile(extension);
// Setup a permissionChecker for the user configured to own
// scheduled import.
PrincipalThreadLocal.setName(userId);
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil
.create(UserLocalServiceUtil.getUser(userId));
PermissionThreadLocal.setPermissionChecker(permissionChecker);
FileUtil.write(file, attachmentsFileEntry.getContentStream());
TransactionInvokerUtil.invoke(transactionConfig,
new MeasurementImportCallable(exportImportConfiguration, file));
} catch (Throwable t) {
if (_log.isDebugEnabled()) {
_log.debug(t, t);
} else if (_log.isWarnEnabled()) {
_log.warn("Unable to import measurements: " + t.getMessage());
}
throw new SystemException(t);
} finally {
FileUtil.delete(file);
}
}
return BackgroundTaskResult.SUCCESS;
}