Example usage for com.liferay.portal.kernel.exception ModelListenerException ModelListenerException

List of usage examples for com.liferay.portal.kernel.exception ModelListenerException ModelListenerException

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.exception ModelListenerException ModelListenerException.

Prototype

public ModelListenerException(String msg, Throwable cause) 

Source Link

Usage

From source file:com.liferay.exportimport.internal.model.listener.BackgroundTaskModelListener.java

License:Open Source License

@Override
public void onBeforeRemove(BackgroundTask backgroundTask) throws ModelListenerException {

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

    long exportImportConfigurationId = MapUtil.getLong(taskContextMap, "exportImportConfigurationId");

    if (exportImportConfigurationId == 0) {
        return;//from   w  w w  . jav  a2  s .  co m
    }

    try {
        ExportImportConfiguration exportImportConfiguration = _exportImportConfigurationLocalService
                .fetchExportImportConfiguration(exportImportConfigurationId);

        if (exportImportConfiguration == null) {
            return;
        }

        if (exportImportConfiguration.getStatus() == WorkflowConstants.STATUS_DRAFT) {

            _exportImportConfigurationLocalService.deleteExportImportConfiguration(exportImportConfiguration);
        }
    } catch (Exception e) {
        throw new ModelListenerException("Unable to delete the process configuration for background " + "task "
                + backgroundTask.getBackgroundTaskId(), e);
    }
}