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

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

Introduction

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

Prototype

public void setTaskContextMap(Map<String, Serializable> taskContextMap);

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  ww.  ja  v  a 2  s  .c om*/
    }

    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());
}