Example usage for com.liferay.portal.kernel.backgroundtask BackgroundTask getName

List of usage examples for com.liferay.portal.kernel.backgroundtask BackgroundTask getName

Introduction

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

Prototype

public String getName();

Source Link

Usage

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

License:Open Source License

public PortletExportImportBackgroundTaskDisplay(BackgroundTask backgroundTask) {

    super(backgroundTask);

    try {//  www. j av  a2  s.co m
        Map<String, Serializable> taskContextMap = backgroundTask.getTaskContextMap();

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

        if ((exportImportConfiguration.getType() != ExportImportConfigurationConstants.TYPE_EXPORT_PORTLET)
                && (exportImportConfiguration
                        .getType() != ExportImportConfigurationConstants.TYPE_IMPORT_PORTLET)
                && (exportImportConfiguration
                        .getType() != ExportImportConfigurationConstants.TYPE_PUBLISH_PORTLET)) {

            throw new PortalException(
                    "Invalid export import configuration type: " + exportImportConfiguration.getType());
        }

        portlet = PortletLocalServiceUtil.getPortletById(backgroundTask.getName());
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}