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

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

Introduction

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

Prototype

public int getStatus();

Source Link

Usage

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

License:Open Source License

protected void markBackgroundTask(long backgroundTaskId, String backgroundTaskState) {

    BackgroundTask backgroundTask = BackgroundTaskManagerUtil.fetchBackgroundTask(backgroundTaskId);

    if ((backgroundTask == null) || Validator.isNull(backgroundTaskState)) {
        return;//from w w  w  .  j  a v a 2  s. co m
    }

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

    if (taskContextMap == null) {
        taskContextMap = new HashMap<>();
    }

    taskContextMap.put(backgroundTaskState, Boolean.TRUE);

    backgroundTask.setTaskContextMap(taskContextMap);

    BackgroundTaskManagerUtil.amendBackgroundTask(backgroundTask.getBackgroundTaskId(), taskContextMap,
            backgroundTask.getStatus(), new ServiceContext());
}