use of com.evolveum.midpoint.cases.api.request.CompleteWorkItemsRequest in project midpoint by Evolveum.
the class WorkItemManager method completeWorkItem.
public void completeWorkItem(WorkItemId workItemId, @NotNull AbstractWorkItemOutputType output, WorkItemEventCauseInformationType causeInformation, Task task, OperationResult parentResult) throws SecurityViolationException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException, SchemaException, ObjectAlreadyExistsException {
OperationResultBuilder builder = parentResult.subresult(OPERATION_COMPLETE_WORK_ITEM).addArbitraryObjectAsParam("workItemId", workItemId).addParam("decision", output.getOutcome()).addParam("comment", output.getComment());
boolean tracingRequested = startTracingIfRequested(builder, task, parentResult);
OperationResult result = builder.build();
try {
LOGGER.trace("Completing work item {} with decision of {} ['{}']; cause: {}", workItemId, output.getOutcome(), output.getComment(), causeInformation);
CompleteWorkItemsRequest request = new CompleteWorkItemsRequest(workItemId.caseOid, causeInformation);
request.getCompletions().add(new CompleteWorkItemsRequest.SingleCompletion(workItemId.id, output));
caseEngine.executeRequest(request, task, result);
} catch (SecurityViolationException | RuntimeException | SchemaException | ObjectAlreadyExistsException e) {
result.recordFatalError("Couldn't complete the work item " + workItemId + ": " + e.getMessage(), e);
throw e;
} finally {
result.computeStatusIfUnknown();
storeTraceIfRequested(tracingRequested, task, result, parentResult);
}
}
Aggregations