Example usage for com.liferay.portal.kernel.backgroundtask BackgroundTaskManagerUtil getBackgroundTask

List of usage examples for com.liferay.portal.kernel.backgroundtask BackgroundTaskManagerUtil getBackgroundTask

Introduction

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

Prototype

public static BackgroundTask getBackgroundTask(long backgroundTaskId) throws PortalException 

Source Link

Usage

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);
    }// w ww  .  j  av a2 s . com
}

From source file:com.liferay.staging.processes.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"));

    exportImportConfiguration = ExportImportConfigurationFactory
            .cloneExportImportConfiguration(exportImportConfiguration);

    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   w w  w . jav a  2 s  . com*/
}