public void handleChildTransition(CmmnExecution child, String transition) { // Step 1: collect all affected sentries List<String> affectedSentries = collectAffectedSentries(child, transition); // Step 2: fire force update on all case sentry part // contained by a affected sentry to provoke an // OptimisticLockingException forceUpdateOnSentries(affectedSentries); // Step 3: check each affected sentry whether it is satisfied. // the returned list contains all satisfied sentries List<String> satisfiedSentries = getSatisfiedSentries(affectedSentries); // Step 4: reset sentries -> satisfied == false resetSentries(satisfiedSentries); // Step 5: fire satisfied sentries fireSentries(satisfiedSentries); }
public void handleVariableTransition(String variableName, String transition) { Map<String, List<CmmnSentryPart>> sentries = collectAllSentries(); List<CmmnSentryPart> sentryParts = collectSentryParts(sentries); List<String> affectedSentries = collectAffectedSentriesWithVariableOnParts(variableName, transition, sentryParts); List<CmmnSentryPart> affectedSentryParts = getAffectedSentryParts(sentries, affectedSentries); forceUpdateOnCaseSentryParts(affectedSentryParts); List<String> allSentries = new ArrayList<String>(sentries.keySet()); List<String> satisfiedSentries = getSatisfiedSentriesInExecutionTree(allSentries, sentries); List<CmmnSentryPart> satisfiedSentryParts = getAffectedSentryParts(sentries, satisfiedSentries); resetSentryParts(satisfiedSentryParts); fireSentries(satisfiedSentries); }
public void fireIfOnlySentryParts() { // the following steps are a workaround, because setVariable() // does not check nor fire a sentry!!! Set<String> affectedSentries = new HashSet<String>(); List<CmmnSentryPart> sentryParts = collectSentryParts(getSentries()); for (CmmnSentryPart sentryPart : sentryParts) { if (isNotSatisfiedIfPartOnly(sentryPart)) { affectedSentries.add(sentryPart.getSentryId()); } } // Step 7: check each not affected sentry whether it is satisfied List<String> satisfiedSentries = getSatisfiedSentries(new ArrayList<String>(affectedSentries)); // Step 8: reset sentries -> satisfied == false resetSentries(satisfiedSentries); // Step 9: fire satisfied sentries fireSentries(satisfiedSentries); }