Search in sources :

Example 1 with ReleaseWorkItemsRequest

use of com.evolveum.midpoint.cases.api.request.ReleaseWorkItemsRequest in project midpoint by Evolveum.

the class WorkItemManager method releaseWorkItem.

// We can eventually provide bulk version of this method as well.
public void releaseWorkItem(WorkItemId workItemId, Task task, OperationResult parentResult) throws ObjectNotFoundException, SecurityViolationException, SchemaException, ObjectAlreadyExistsException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
    OperationResultBuilder builder = parentResult.subresult(OPERATION_RELEASE_WORK_ITEM).addArbitraryObjectAsParam("workItemId", workItemId);
    boolean tracingRequested = startTracingIfRequested(builder, task, parentResult);
    OperationResult result = builder.build();
    try {
        LOGGER.trace("Releasing work item {}", workItemId);
        ReleaseWorkItemsRequest request = new ReleaseWorkItemsRequest(workItemId.caseOid);
        request.getReleases().add(new ReleaseWorkItemsRequest.SingleRelease(workItemId.id));
        caseEngine.executeRequest(request, task, result);
    } catch (ObjectNotFoundException | SecurityViolationException | RuntimeException | SchemaException | ObjectAlreadyExistsException | ExpressionEvaluationException | ConfigurationException | CommunicationException e) {
        result.recordFatalError("Couldn't release work item " + workItemId + ": " + e.getMessage(), e);
        throw e;
    } finally {
        result.computeStatusIfUnknown();
        storeTraceIfRequested(tracingRequested, task, result, parentResult);
    }
}
Also used : OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ReleaseWorkItemsRequest(com.evolveum.midpoint.cases.api.request.ReleaseWorkItemsRequest) OperationResultBuilder(com.evolveum.midpoint.schema.result.OperationResultBuilder)

Aggregations

ReleaseWorkItemsRequest (com.evolveum.midpoint.cases.api.request.ReleaseWorkItemsRequest)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 OperationResultBuilder (com.evolveum.midpoint.schema.result.OperationResultBuilder)1