Search in sources :

Example 1 with CaseTypeUtil

use of com.evolveum.midpoint.schema.util.cases.CaseTypeUtil in project midpoint by Evolveum.

the class CaseClosing method processDelayedExecution.

private void processDelayedExecution(CaseType currentCase, CaseType rootCase, OperationResult result) throws SchemaException, ObjectAlreadyExistsException, ObjectNotFoundException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
    LOGGER.debug("Approval case {} is completed; but execution is delayed so let's check other subcases of {}", currentCase, rootCase);
    beans.executionHelper.closeCaseInRepository(currentCase, result);
    List<CaseType> subcases = beans.miscHelper.getSubcases(rootCase, result);
    // TODO what about race conditions, i.e. what if remaining cases are closed "at once"?!
    if (subcases.stream().allMatch(CaseTypeUtil::isClosed)) {
        LOGGER.debug("All subcases of {} are closed, so let's execute the deltas", rootCase);
        beans.executionHelper.submitExecutionTaskIfNeeded(rootCase, subcases, operation.getTask(), result);
    } else {
        LOGGER.debug("Some subcases of {} are not closed yet. Delta execution is therefore postponed.", rootCase);
        for (CaseType subcase : subcases) {
            LOGGER.debug(" - {}: state={} (isClosed={})", subcase, subcase.getState(), CaseTypeUtil.isClosed(subcase));
        }
    }
}
Also used : CaseTypeUtil(com.evolveum.midpoint.schema.util.cases.CaseTypeUtil) CaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.CaseType)

Aggregations

CaseTypeUtil (com.evolveum.midpoint.schema.util.cases.CaseTypeUtil)1 CaseType (com.evolveum.midpoint.xml.ns._public.common.common_3.CaseType)1