use of com.evolveum.midpoint.cases.api.request.ClaimWorkItemsRequest in project midpoint by Evolveum.
the class WorkItemManager method claimWorkItem.
// We can eventually provide bulk version of this method as well.
public void claimWorkItem(WorkItemId workItemId, Task task, OperationResult parentResult) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ObjectAlreadyExistsException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
OperationResultBuilder builder = parentResult.subresult(OPERATION_CLAIM_WORK_ITEM).addArbitraryObjectAsParam("workItemId", workItemId);
boolean tracingRequested = startTracingIfRequested(builder, task, parentResult);
OperationResult result = builder.build();
try {
LOGGER.trace("Claiming work item {}", workItemId);
ClaimWorkItemsRequest request = new ClaimWorkItemsRequest(workItemId.caseOid);
request.getClaims().add(new ClaimWorkItemsRequest.SingleClaim(workItemId.id));
caseEngine.executeRequest(request, task, result);
} catch (ObjectNotFoundException | SecurityViolationException | RuntimeException | SchemaException | ObjectAlreadyExistsException | ExpressionEvaluationException | ConfigurationException | CommunicationException e) {
result.recordFatalError("Couldn't claim the work item " + workItemId + ": " + e.getMessage(), e);
throw e;
} finally {
result.computeStatusIfUnknown();
storeTraceIfRequested(tracingRequested, task, result, parentResult);
}
}
Aggregations