use of org.kie.server.api.model.cases.CaseUserTaskWithVariablesList in project droolsjbpm-integration by kiegroup.
the class CaseQueryResource method queryCaseUserTasksByVariables.
@ApiOperation(value = "Queries cases tasks by variables", response = CaseUserTaskWithVariablesList.class)
@POST
@Path(RestURI.VARIABLES_TASKS_CASES_URI)
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@KieServerEndpoint(categories = { EndpointType.DEFAULT, EndpointType.HISTORY })
public Response queryCaseUserTasksByVariables(@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) {
Header conversationIdHeader = buildConversationIdHeader("", context, headers);
Variant v = getVariant(headers);
try {
String type = getContentType(headers);
CaseUserTaskWithVariablesList taskVariableSummaryList = caseManagementRuntimeDataServiceBase.queryUserTasksByVariables(payload, type, new QueryContext((page * pageSize), pageSize));
logger.debug("Returning result of case instance user task 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.cases.CaseUserTaskWithVariablesList in project droolsjbpm-integration by kiegroup.
the class ConvertUtils method convertToCaseUserTaskWithVariablesList.
public static CaseUserTaskWithVariablesList convertToCaseUserTaskWithVariablesList(List<UserTaskInstanceWithPotOwnerDesc> queryUserTasksByVariables) {
List<CaseUserTaskWithVariables> data = new ArrayList<>();
for (UserTaskInstanceWithPotOwnerDesc desc : queryUserTasksByVariables) {
CaseUserTaskWithVariables var = new CaseUserTaskWithVariables();
var.setId(desc.getTaskId());
var.setName(desc.getName());
var.setDescription(desc.getDescription());
var.setProcessInstanceId(desc.getProcessInstanceId());
var.setCorrelationKey(desc.getCorrelationKey());
var.setActualOwner(desc.getActualOwner());
var.setCaseDefinitionId(desc.getProcessId());
var.setPotentialOwners(desc.getPotentialOwners());
var.setCaseId(desc.getCorrelationKey());
var.setProcessVariables(desc.getProcessVariables());
var.setInputVariables(desc.getInputdata());
var.setCaseVariables(desc.getExtraData());
var.setStatus(desc.getStatus());
data.add(var);
}
CaseUserTaskWithVariablesList result = new CaseUserTaskWithVariablesList();
result.setCaseUserTaskWithVariables(data.stream().toArray(CaseUserTaskWithVariables[]::new));
return result;
}
Aggregations