use of org.kie.server.api.model.instance.TaskSummaryList in project droolsjbpm-integration by kiegroup.
the class ConvertUtils method convertToProcessInstance.
public static org.kie.server.api.model.instance.ProcessInstance convertToProcessInstance(ProcessInstanceDesc pi) {
if (pi == null) {
return null;
}
org.kie.server.api.model.instance.ProcessInstance instance = org.kie.server.api.model.instance.ProcessInstance.builder().id(pi.getId()).processId(pi.getProcessId()).processName(pi.getProcessName()).processVersion(pi.getProcessVersion()).containerId(pi.getDeploymentId()).processInstanceDescription(pi.getProcessInstanceDescription()).correlationKey(pi.getCorrelationKey()).parentInstanceId(pi.getParentId()).date(pi.getDataTimeStamp()).initiator(pi.getInitiator()).state(pi.getState()).slaCompliance(pi.getSlaCompliance()).slaDueDate(pi.getSlaDueDate()).build();
if (pi.getActiveTasks() != null && !pi.getActiveTasks().isEmpty()) {
org.kie.server.api.model.instance.TaskSummary[] tasks = new org.kie.server.api.model.instance.TaskSummary[pi.getActiveTasks().size()];
int counter = 0;
for (UserTaskInstanceDesc taskSummary : pi.getActiveTasks()) {
org.kie.server.api.model.instance.TaskSummary task = org.kie.server.api.model.instance.TaskSummary.builder().id(taskSummary.getTaskId()).name(taskSummary.getName()).description(taskSummary.getDescription()).activationTime(taskSummary.getActivationTime()).actualOwner(taskSummary.getActualOwner()).containerId(taskSummary.getDeploymentId()).createdBy(taskSummary.getCreatedBy()).createdOn(taskSummary.getCreatedOn()).priority(taskSummary.getPriority()).processId(taskSummary.getProcessId()).processInstanceId(taskSummary.getProcessInstanceId()).status(taskSummary.getStatus()).subject(taskSummary.getSubject()).build();
tasks[counter] = task;
counter++;
}
instance.setActiveUserTasks(new TaskSummaryList(tasks));
}
return instance;
}
use of org.kie.server.api.model.instance.TaskSummaryList in project droolsjbpm-integration by kiegroup.
the class RuntimeDataServiceBase method getTasksAssignedAsBusinessAdministratorByStatus.
public TaskSummaryList getTasksAssignedAsBusinessAdministratorByStatus(List<String> status, String userId, Integer page, Integer pageSize, String sort, boolean sortOrder) {
userId = getUser(userId);
logger.debug("About to search for task assigned as business admin for user '{}'", userId);
List<TaskSummary> tasks;
if (status == null || status.isEmpty()) {
tasks = runtimeDataService.getTasksAssignedAsBusinessAdministrator(userId, buildQueryFilter(page, pageSize, sort, sortOrder));
} else {
List<Status> taskStatuses = buildTaskStatuses(status);
tasks = runtimeDataService.getTasksAssignedAsBusinessAdministratorByStatus(userId, taskStatuses, buildQueryFilter(page, pageSize, sort, sortOrder));
}
logger.debug("Found {} tasks for user '{}' assigned as business admin", tasks.size(), userId);
TaskSummaryList result = convertToTaskSummaryList(tasks);
return result;
}
use of org.kie.server.api.model.instance.TaskSummaryList in project droolsjbpm-integration by kiegroup.
the class RuntimeDataServiceBase method getTasksByStatusByProcessInstanceId.
public TaskSummaryList getTasksByStatusByProcessInstanceId(Number processInstanceId, List<String> status, Integer page, Integer pageSize, String sort, boolean sortOrder) {
List<Status> taskStatuses = buildTaskStatuses(status);
if (taskStatuses == null) {
taskStatuses = new ArrayList<Status>();
taskStatuses.add(Status.Ready);
taskStatuses.add(Status.Reserved);
taskStatuses.add(Status.InProgress);
}
logger.debug("About to search for tasks attached to process instance with id '{}'", processInstanceId);
List<TaskSummary> tasks = runtimeDataService.getTasksByStatusByProcessInstanceId(processInstanceId.longValue(), taskStatuses, buildQueryFilter(page, pageSize, sort, sortOrder));
logger.debug("Found {} tasks attached to process instance with id '{}'", tasks.size(), processInstanceId);
TaskSummaryList result = convertToTaskSummaryList(tasks);
return result;
}
use of org.kie.server.api.model.instance.TaskSummaryList in project droolsjbpm-integration by kiegroup.
the class RuntimeDataServiceBase method getTasksOwnedByStatus.
public TaskSummaryList getTasksOwnedByStatus(List<String> status, String userId, Integer page, Integer pageSize, String sort, boolean sortOrder) {
List<Status> taskStatuses = buildTaskStatuses(status);
userId = getUser(userId);
logger.debug("About to search for task owned user '{}'", userId);
List<TaskSummary> tasks;
if (taskStatuses != null) {
tasks = runtimeDataService.getTasksOwnedByStatus(userId, taskStatuses, buildQueryFilter(page, pageSize, sort, sortOrder));
} else {
tasks = runtimeDataService.getTasksOwned(userId, buildQueryFilter(page, pageSize, sort, sortOrder));
}
logger.debug("Found {} tasks owned by user '{}'", tasks.size(), userId);
TaskSummaryList result = convertToTaskSummaryList(tasks);
return result;
}
use of org.kie.server.api.model.instance.TaskSummaryList in project droolsjbpm-integration by kiegroup.
the class RuntimeDataServiceBase method getAllAuditTask.
public TaskSummaryList getAllAuditTask(String userId, Integer page, Integer pageSize, String sort, boolean sortOrder) {
userId = getUser(userId);
logger.debug("About to search for tasks available for user '{}'", userId);
List<AuditTask> tasks = runtimeDataService.getAllAuditTask(userId, buildQueryFilter(page, pageSize, sort, sortOrder));
logger.debug("Found {} tasks available for user '{}'", tasks.size(), userId);
TaskSummaryList result = null;
if (tasks == null) {
result = new TaskSummaryList(new org.kie.server.api.model.instance.TaskSummary[0]);
} else {
org.kie.server.api.model.instance.TaskSummary[] instances = new org.kie.server.api.model.instance.TaskSummary[tasks.size()];
int counter = 0;
for (AuditTask taskSummary : tasks) {
org.kie.server.api.model.instance.TaskSummary task = org.kie.server.api.model.instance.TaskSummary.builder().id(taskSummary.getTaskId()).name(taskSummary.getName()).description(taskSummary.getDescription()).taskParentId(taskSummary.getParentId()).activationTime(taskSummary.getActivationTime()).actualOwner(taskSummary.getActualOwner()).containerId(taskSummary.getDeploymentId()).createdBy(taskSummary.getCreatedBy()).createdOn(taskSummary.getCreatedOn()).expirationTime(taskSummary.getDueDate()).priority(taskSummary.getPriority()).processId(taskSummary.getProcessId()).processInstanceId(taskSummary.getProcessInstanceId()).status(taskSummary.getStatus()).build();
instances[counter] = task;
counter++;
}
result = new TaskSummaryList(instances);
}
return result;
}
Aggregations