use of org.kie.server.api.model.instance.TaskSummaryList in project droolsjbpm-integration by kiegroup.
the class RuntimeDataServiceBase method getTasksByVariables.
public TaskSummaryList getTasksByVariables(String userId, String variableName, String variableValue, List<String> status, Integer page, Integer pageSize, String sort, boolean sortOrder) {
userId = getUser(userId);
List<Status> taskStatuses = buildTaskStatuses(status);
if (taskStatuses == null) {
taskStatuses = new ArrayList<Status>();
taskStatuses.add(Status.Ready);
taskStatuses.add(Status.Reserved);
taskStatuses.add(Status.InProgress);
}
List<TaskSummary> instances = null;
if (variableValue != null && !variableValue.isEmpty()) {
logger.debug("About to search for tasks that has variable '{}' with value '{}' with page {} and page size {}", variableName, variableValue, page, pageSize);
instances = runtimeDataService.getTasksByVariableAndValue(userId, variableName, variableValue, taskStatuses, buildQueryContext(page, pageSize, sort, sortOrder));
logger.debug("Found {} tasks with variable {} and variable value {}", instances.size(), variableName, variableValue);
} else {
logger.debug("About to search for tasks that has variable '{}' with page {} and page size {}", variableName, page, pageSize);
instances = runtimeDataService.getTasksByVariable(userId, variableName, taskStatuses, buildQueryContext(page, pageSize, sort, sortOrder));
logger.debug("Found {} tasks with variable {} ", instances.size(), variableName);
}
TaskSummaryList taskSummaryList = convertToTaskSummaryList(instances);
logger.debug("Returning result of task by variable search: {}", taskSummaryList);
return taskSummaryList;
}
use of org.kie.server.api.model.instance.TaskSummaryList in project droolsjbpm-integration by kiegroup.
the class RuntimeDataServiceBase method getTasksAssignedAsPotentialOwner.
public TaskSummaryList getTasksAssignedAsPotentialOwner(List<String> status, List<String> groupIds, String userId, Integer page, Integer pageSize, String sort, boolean sortOrder, String filter) {
List<Status> taskStatuses = buildTaskStatuses(status);
userId = getUser(userId);
logger.debug("About to search for task assigned as potential owner for user '{}'", userId);
List<TaskSummary> tasks;
QueryFilter queryFilter = buildTaskByNameQueryFilter(page, pageSize, sort, sortOrder, filter);
if (groupIds != null && !groupIds.isEmpty()) {
if (taskStatuses == null) {
tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(userId, groupIds, queryFilter);
} else {
tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(userId, groupIds, taskStatuses, queryFilter);
}
} else if (taskStatuses != null) {
tasks = runtimeDataService.getTasksAssignedAsPotentialOwnerByStatus(userId, taskStatuses, queryFilter);
} else {
tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(userId, queryFilter);
}
logger.debug("Found {} tasks for user '{}' assigned as potential owner", 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 ConvertUtils method convertToTaskSummaryList.
public static TaskSummaryList convertToTaskSummaryList(Collection<TaskSummary> tasks) {
if (tasks == null) {
return new TaskSummaryList(new org.kie.server.api.model.instance.TaskSummary[0]);
}
org.kie.server.api.model.instance.TaskSummary[] instances = new org.kie.server.api.model.instance.TaskSummary[tasks.size()];
int counter = 0;
for (TaskSummary taskSummary : tasks) {
instances[counter] = convertToTaskSummary(taskSummary);
counter++;
}
return new TaskSummaryList(instances);
}
use of org.kie.server.api.model.instance.TaskSummaryList in project droolsjbpm-integration by kiegroup.
the class CaseQueryResource method getCaseInstanceTasksAsAdmin.
@ApiOperation(value = "Returns tasks for business administrators in a specified case instance.")
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"), @ApiResponse(code = 200, response = TaskSummaryList.class, message = "Successful response", examples = @Example(value = { @ExampleProperty(mediaType = JSON, value = GET_TASK_SUMMARY_RESPONSE_JSON) })) })
@GET
@Path(CASE_TASKS_AS_ADMIN_GET_URI)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getCaseInstanceTasksAsAdmin(@javax.ws.rs.core.Context HttpHeaders headers, @ApiParam(value = "case instance identifier that tasks should belong to", required = true, example = "CASE-00000000001") @PathParam(CASE_ID) String caseId, @ApiParam(value = "optional user id to be used instead of authenticated user - only when bypass authenticated user is enabled", required = false) @QueryParam("user") String user, @ApiParam(value = "optional task status (Created, Ready, Reserved, InProgress, Suspended, Completed, Failed, Error, Exited, Obsolete)", required = false, allowableValues = "Created, Ready, Reserved,InProgress,Suspended,Completed,Failed,Error,Exited,Obsolete") @QueryParam("status") List<String> status, @ApiParam(value = "optional pagination - at which page to start, defaults to 0 (meaning first)", required = false) @QueryParam("page") @DefaultValue("0") Integer page, @ApiParam(value = "optional pagination - size of the result, defaults to 10", required = false) @QueryParam("pageSize") @DefaultValue("10") Integer pageSize, @ApiParam(value = "optional sort column, no default", required = false) @QueryParam("sort") String sort, @ApiParam(value = "optional sort direction (asc, desc) - defaults to asc", required = false) @QueryParam("sortOrder") @DefaultValue("true") boolean sortOrder) {
return invokeCaseOperation(headers, "", null, (Variant v, String type, Header... customHeaders) -> {
logger.debug("About to look for case instance {} tasks with status {} assigned to business admin {}", caseId, status, user);
TaskSummaryList responseObject = this.caseManagementRuntimeDataServiceBase.getCaseTasksAsBusinessAdmin(caseId, user, status, page, pageSize, sort, sortOrder);
logger.debug("Returning OK response with content '{}'", responseObject);
return createCorrectVariant(responseObject, headers, Response.Status.OK, customHeaders);
});
}
use of org.kie.server.api.model.instance.TaskSummaryList in project droolsjbpm-integration by kiegroup.
the class CaseQueryResource method getCaseInstanceTasksAsStakeholder.
@ApiOperation(value = "Returns tasks for stakeholders in a specified case instance.")
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"), @ApiResponse(code = 200, response = TaskSummaryList.class, message = "Successful response", examples = @Example(value = { @ExampleProperty(mediaType = JSON, value = GET_TASK_SUMMARY_RESPONSE_JSON) })) })
@GET
@Path(CASE_TASKS_AS_STAKEHOLDER_GET_URI)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getCaseInstanceTasksAsStakeholder(@javax.ws.rs.core.Context HttpHeaders headers, @ApiParam(value = "case instance identifier that tasks should belong to", required = true, example = "CASE-0000000001") @PathParam(CASE_ID) String caseId, @ApiParam(value = "optional user id to be used instead of authenticated user - only when bypass authenticated user is enabled", required = false) @QueryParam("user") String user, @ApiParam(value = "optional task status (Created, Ready, Reserved, InProgress, Suspended, Completed, Failed, Error, Exited, Obsolete)", required = false, allowableValues = "Created, Ready, Reserved,InProgress,Suspended,Completed,Failed,Error,Exited,Obsolete") @QueryParam("status") List<String> status, @ApiParam(value = "optional pagination - at which page to start, defaults to 0 (meaning first)", required = false) @QueryParam("page") @DefaultValue("0") Integer page, @ApiParam(value = "optional pagination - size of the result, defaults to 10", required = false) @QueryParam("pageSize") @DefaultValue("10") Integer pageSize, @ApiParam(value = "optional sort column, no default", required = false) @QueryParam("sort") String sort, @ApiParam(value = "optional sort direction (asc, desc) - defaults to asc", required = false) @QueryParam("sortOrder") @DefaultValue("true") boolean sortOrder) {
return invokeCaseOperation(headers, "", null, (Variant v, String type, Header... customHeaders) -> {
logger.debug("About to look for case instance {} tasks with status {} assigned to stakeholder {}", caseId, status, user);
TaskSummaryList responseObject = this.caseManagementRuntimeDataServiceBase.getCaseTasksAsStakeholder(caseId, user, status, page, pageSize, sort, sortOrder);
logger.debug("Returning OK response with content '{}'", responseObject);
return createCorrectVariant(responseObject, headers, Response.Status.OK, customHeaders);
});
}
Aggregations