Example usage for com.liferay.portal.kernel.backgroundtask BackgroundTaskConstants BACKGROUND_TASK_ID

List of usage examples for com.liferay.portal.kernel.backgroundtask BackgroundTaskConstants BACKGROUND_TASK_ID

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.backgroundtask BackgroundTaskConstants BACKGROUND_TASK_ID.

Prototype

String BACKGROUND_TASK_ID

To view the source code for com.liferay.portal.kernel.backgroundtask BackgroundTaskConstants BACKGROUND_TASK_ID.

Click Source Link

Usage

From source file:com.liferay.adaptive.media.blogs.web.internal.optimizer.BlogsAdaptiveMediaImageOptimizer.java

License:Open Source License

private void _sendStatusMessage(int count, int total) {
    Message message = new Message();

    message.put(BackgroundTaskConstants.BACKGROUND_TASK_ID, BackgroundTaskThreadLocal.getBackgroundTaskId());

    Class<? extends BlogsAdaptiveMediaImageOptimizer> clazz = getClass();

    message.put(OptimizeImagesBackgroundTaskConstants.CLASS_NAME, clazz.getName());

    message.put(OptimizeImagesBackgroundTaskConstants.COUNT, count);
    message.put(OptimizeImagesBackgroundTaskConstants.TOTAL, total);

    message.put("status", BackgroundTaskConstants.STATUS_IN_PROGRESS);

    _backgroundTaskStatusMessageSender.sendBackgroundTaskStatusMessage(message);
}

From source file:com.liferay.adaptive.media.blogs.web.internal.optimizer.BlogsAMImageOptimizer.java

License:Open Source License

private void _sendStatusMessage(int count, int total) {
    Message message = new Message();

    message.put(BackgroundTaskConstants.BACKGROUND_TASK_ID, BackgroundTaskThreadLocal.getBackgroundTaskId());

    Class<? extends BlogsAMImageOptimizer> clazz = getClass();

    message.put(AMOptimizeImagesBackgroundTaskConstants.CLASS_NAME, clazz.getName());

    message.put(AMOptimizeImagesBackgroundTaskConstants.COUNT, count);
    message.put(AMOptimizeImagesBackgroundTaskConstants.TOTAL, total);

    message.put("status", BackgroundTaskConstants.STATUS_IN_PROGRESS);

    _backgroundTaskStatusMessageSender.sendBackgroundTaskStatusMessage(message);
}

From source file:com.liferay.adaptive.media.document.library.repository.internal.optimizer.DLAdaptiveMediaImageOptimizer.java

License:Open Source License

private void _sendStatusMessage(int count, int total) {
    Message message = new Message();

    message.put(BackgroundTaskConstants.BACKGROUND_TASK_ID, BackgroundTaskThreadLocal.getBackgroundTaskId());

    Class<? extends DLAdaptiveMediaImageOptimizer> clazz = getClass();

    message.put(OptimizeImagesBackgroundTaskConstants.CLASS_NAME, clazz.getName());

    message.put(OptimizeImagesBackgroundTaskConstants.COUNT, count);
    message.put(OptimizeImagesBackgroundTaskConstants.TOTAL, total);

    message.put("status", BackgroundTaskConstants.STATUS_IN_PROGRESS);

    _backgroundTaskStatusMessageSender.sendBackgroundTaskStatusMessage(message);
}

From source file:com.liferay.adaptive.media.document.library.web.internal.optimizer.DLAMImageOptimizer.java

License:Open Source License

private void _sendStatusMessage(int count, int total) {
    Message message = new Message();

    message.put(BackgroundTaskConstants.BACKGROUND_TASK_ID, BackgroundTaskThreadLocal.getBackgroundTaskId());

    Class<? extends DLAMImageOptimizer> clazz = getClass();

    message.put(AMOptimizeImagesBackgroundTaskConstants.CLASS_NAME, clazz.getName());

    message.put(AMOptimizeImagesBackgroundTaskConstants.COUNT, count);
    message.put(AMOptimizeImagesBackgroundTaskConstants.TOTAL, total);

    message.put("status", BackgroundTaskConstants.STATUS_IN_PROGRESS);

    _backgroundTaskStatusMessageSender.sendBackgroundTaskStatusMessage(message);
}

From source file:com.liferay.adaptive.media.web.internal.background.task.OptimizeImagesStatusMessageSenderUtil.java

License:Open Source License

private void _sendStatusMessage(String phase, long companyId, String configurationEntryUuid) {

    Message message = new Message();

    message.put(BackgroundTaskConstants.BACKGROUND_TASK_ID, BackgroundTaskThreadLocal.getBackgroundTaskId());
    message.put(OptimizeImagesBackgroundTaskConstants.COMPANY_ID, companyId);
    message.put(OptimizeImagesBackgroundTaskConstants.PHASE, phase);
    message.put("status", BackgroundTaskConstants.STATUS_IN_PROGRESS);
    message.put(OptimizeImagesBackgroundTaskConstants.CONFIGURATION_ENTRY_UUID, configurationEntryUuid);

    _backgroundTaskStatusMessageSender.sendBackgroundTaskStatusMessage(message);
}

From source file:com.liferay.exportimport.internal.background.task.PortletDataHandlerStatusMessageSenderImpl.java

License:Open Source License

protected void init(Message message, String messageType, ManifestSummary manifestSummary) {

    message.put(BackgroundTaskConstants.BACKGROUND_TASK_ID, BackgroundTaskThreadLocal.getBackgroundTaskId());
    message.put("messageType", messageType);

    Map<String, LongWrapper> modelAdditionCounters = manifestSummary.getModelAdditionCounters();

    message.put("modelAdditionCounters", new HashMap<>(modelAdditionCounters));

    Map<String, LongWrapper> modelDeletionCounters = manifestSummary.getModelDeletionCounters();

    message.put("modelDeletionCounters", new HashMap<>(modelDeletionCounters));
}

From source file:com.liferay.exportimport.web.internal.portlet.action.ActionUtil.java

License:Open Source License

public static void deleteBackgroundTask(ActionRequest actionRequest) throws PortalException {

    long backgroundTaskId = ParamUtil.getLong(actionRequest, BackgroundTaskConstants.BACKGROUND_TASK_ID);

    BackgroundTaskManagerUtil.deleteBackgroundTask(backgroundTaskId);
}

From source file:com.liferay.exportimport.web.internal.portlet.action.EditExportConfigurationMVCActionCommand.java

License:Open Source License

protected void relaunchExportLayoutConfiguration(ActionRequest actionRequest) throws Exception {

    long backgroundTaskId = ParamUtil.getLong(actionRequest, BackgroundTaskConstants.BACKGROUND_TASK_ID);

    BackgroundTask backgroundTask = backgroundTaskManager.getBackgroundTask(backgroundTaskId);

    Map<String, Serializable> taskContextMap = backgroundTask.getTaskContextMap();

    ExportImportConfiguration exportImportConfiguration = exportImportConfigurationLocalService
            .getExportImportConfiguration(MapUtil.getLong(taskContextMap, "exportImportConfigurationId"));

    exportImportConfiguration = ExportImportConfigurationFactory
            .cloneExportImportConfiguration(exportImportConfiguration);

    _exportImportService.exportLayoutsAsFileInBackground(exportImportConfiguration);
}

From source file:com.liferay.exportimport.web.internal.portlet.action.EditPublishConfigurationMVCActionCommand.java

License:Open Source License

protected void relaunchPublishLayoutConfiguration(long userId, ActionRequest actionRequest)
        throws PortalException {

    long backgroundTaskId = ParamUtil.getLong(actionRequest, BackgroundTaskConstants.BACKGROUND_TASK_ID);

    BackgroundTask backgroundTask = BackgroundTaskManagerUtil.getBackgroundTask(backgroundTaskId);

    Map<String, Serializable> taskContextMap = backgroundTask.getTaskContextMap();

    ExportImportConfiguration exportImportConfiguration = exportImportConfigurationLocalService
            .getExportImportConfiguration(MapUtil.getLong(taskContextMap, "exportImportConfigurationId"));

    if (exportImportConfiguration.getType() == ExportImportConfigurationConstants.TYPE_PUBLISH_LAYOUT_LOCAL) {

        StagingUtil.publishLayouts(userId, exportImportConfiguration);
    } else if (exportImportConfiguration
            .getType() == ExportImportConfigurationConstants.TYPE_PUBLISH_LAYOUT_REMOTE) {

        StagingUtil.copyRemoteLayouts(exportImportConfiguration);
    }//from   www . java  2  s .  co  m
}

From source file:com.liferay.site.admin.web.internal.portlet.SiteAdminPortlet.java

License:Open Source License

public void deleteBackgroundTask(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    long backgroundTaskId = ParamUtil.getLong(actionRequest, BackgroundTaskConstants.BACKGROUND_TASK_ID);

    backgroundTaskManager.deleteBackgroundTask(backgroundTaskId);
}