use of org.kie.server.api.model.instance.ProcessInstanceUserTaskWithVariablesList in project droolsjbpm-integration by kiegroup.
the class RuntimeDataResource method queryUserTasksByVariables.
@ApiOperation(value = "Queries process tasks by variables", response = ProcessInstanceUserTaskWithVariablesList.class)
@POST
@Path(RestURI.VARIABLES_TASKS_PROCESSES_URI)
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@KieServerEndpoint(categories = { EndpointType.DEFAULT, EndpointType.HISTORY })
public Response queryUserTasksByVariables(@Context HttpHeaders headers, String payload, @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", required = false) @QueryParam("orderBy") String orderBy, @ApiParam(value = "optional sort direction - true ascending, false descending", required = false) @QueryParam("asc") @DefaultValue("true") boolean asc) {
Header conversationIdHeader = buildConversationIdHeader("", context, headers);
Variant v = getVariant(headers);
try {
String type = getContentType(headers);
ProcessInstanceUserTaskWithVariablesList taskVariableSummaryList = runtimeDataServiceBase.queryUserTasksByVariables(payload, type, new QueryContext(page * pageSize, pageSize, orderBy, asc));
logger.debug("Returning result of process tasks search: {}", taskVariableSummaryList);
return createCorrectVariant(taskVariableSummaryList, headers, Response.Status.OK, conversationIdHeader);
} catch (Exception e) {
logger.error("Unexpected error during processing {}", e.getMessage(), e);
return internalServerError(errorMessage(e), v, conversationIdHeader);
}
}
use of org.kie.server.api.model.instance.ProcessInstanceUserTaskWithVariablesList in project droolsjbpm-integration by kiegroup.
the class ConvertUtils method convertToUserTaskWithVariablesList.
public static ProcessInstanceUserTaskWithVariablesList convertToUserTaskWithVariablesList(List<UserTaskInstanceWithPotOwnerDesc> queryUserTasksByVariables) {
List<ProcessInstanceUserTaskWithVariables> data = new ArrayList<>();
for (UserTaskInstanceWithPotOwnerDesc desc : queryUserTasksByVariables) {
ProcessInstanceUserTaskWithVariables var = new ProcessInstanceUserTaskWithVariables();
var.setId(desc.getTaskId());
var.setName(desc.getName());
var.setDescription(desc.getDescription());
var.setCorrelationKey(desc.getCorrelationKey());
var.setActualOwner(desc.getActualOwner());
var.setProcessDefinitionId(desc.getProcessId());
var.setPotentialOwners(desc.getPotentialOwners());
var.setProcessInstanceId(desc.getProcessInstanceId());
var.setProcessVariables(desc.getProcessVariables());
var.setInputVariables(desc.getInputdata());
var.setStatus(desc.getStatus());
data.add(var);
}
ProcessInstanceUserTaskWithVariablesList result = new ProcessInstanceUserTaskWithVariablesList();
result.setUserTaskWithVariables(data.parallelStream().toArray(ProcessInstanceUserTaskWithVariables[]::new));
return result;
}
Aggregations