List of usage examples for com.liferay.portal.kernel.backgroundtask BackgroundTask addAttachment
public void addAttachment(long userId, String fileName, InputStream inputStream) throws PortalException;
From source file:ch.inofix.contact.service.impl.ContactLocalServiceImpl.java
License:Open Source License
@Override public long importContactsInBackground(long userId, ExportImportConfiguration exportImportConfiguration, File file) throws PortalException { Map<String, Serializable> taskContextMap = new HashMap<>(); taskContextMap.put("exportImportConfigurationId", exportImportConfiguration.getExportImportConfigurationId()); BackgroundTask backgroundTask = BackgroundTaskManagerUtil.addBackgroundTask(userId, exportImportConfiguration.getGroupId(), exportImportConfiguration.getName(), ContactImportBackgroundTaskExecutor.class.getName(), taskContextMap, new ServiceContext()); backgroundTask.addAttachment(userId, file.getName(), file); return backgroundTask.getBackgroundTaskId(); }
From source file:ch.inofix.referencemanager.service.impl.ReferenceLocalServiceImpl.java
License:Open Source License
/** * //from w ww.j av a 2 s. co m * @param userId * @param taskName * @param groupId * @param privateLayout * @param parameterMap * @param file * @param serviceContext * @since 1.0.8 * @return * @throws PortalException */ public long importReferencesInBackground(long userId, String taskName, long groupId, boolean privateLayout, Map<String, String[]> parameterMap, File file, ServiceContext serviceContext) throws PortalException { Map<String, Serializable> taskContextMap = new HashMap<String, Serializable>(); taskContextMap.put("userId", userId); taskContextMap.put("groupId", groupId); taskContextMap.put("parameterMap", (Serializable) parameterMap); taskContextMap.put("privateLayout", privateLayout); taskContextMap.put("serviceContext", serviceContext); BackgroundTask backgroundTask = backgroundTaskmanager.addBackgroundTask(userId, groupId, taskName, ReferenceImportBackgroundTaskExecutor.class.getName(), taskContextMap, serviceContext); backgroundTask.addAttachment(userId, file.getName(), file); return backgroundTask.getBackgroundTaskId(); }