use of org.jbpm.services.task.commands.GetTasksForProcessCommand in project jbpm by kiegroup.
the class TaskCleanUpProcessEventListener method afterProcessCompleted.
@Override
public void afterProcessCompleted(ProcessCompletedEvent event) {
List<Status> statuses = new ArrayList<Status>();
statuses.add(Status.Error);
statuses.add(Status.Failed);
statuses.add(Status.Obsolete);
statuses.add(Status.Suspended);
statuses.add(Status.Completed);
statuses.add(Status.Exited);
List<TaskSummary> completedTasksByProcessId = ((InternalTaskService) taskService).execute(new GetTasksForProcessCommand(event.getProcessInstance().getId(), statuses, "en-UK"));
// archive and remove
taskService.archiveTasks(completedTasksByProcessId);
taskService.removeTasks(completedTasksByProcessId);
}
Aggregations