Node fireSuperStateEnterEvents(ExecutionContext executionContext) { // calculate the actual destinationNode node Node destination = to; while (destination != null && destination.isSuperStateNode()) { List nodes = destination.getNodes(); destination = nodes != null && !nodes.isEmpty() ? (Node) nodes.get(0) : null; } if (destination == null) { String transitionName = name != null ? '\'' + name + '\'' : "in node '" + from + '\''; throw new JbpmException("transition " + transitionName + " has no destination"); } // optimisation: check if there is a candidate superstate to be entered if (destination.getSuperState() != null) { // collect all the superstates being left List leavingSuperStates = collectAllSuperStates(destination, from); // reverse order so that events fire from outer to inner superstates Collections.reverse(leavingSuperStates); // fire a superstate-enter event for all superstates being left fireSuperStateEvents(leavingSuperStates, Event.EVENTTYPE_SUPERSTATE_ENTER, executionContext); } return destination; }
Node fireSuperStateEnterEvents(ExecutionContext executionContext) { // calculate the actual destinationNode node Node destination = to; while (destination != null && destination.isSuperStateNode()) { List nodes = destination.getNodes(); destination = nodes != null && !nodes.isEmpty() ? (Node) nodes.get(0) : null; } if (destination == null) { String transitionName = name != null ? '\'' + name + '\'' : "in node '" + from + '\''; throw new JbpmException("transition " + transitionName + " has no destination"); } // optimisation: check if there is a candidate superstate to be entered if (destination.getSuperState() != null) { // collect all the superstates being left List leavingSuperStates = collectAllSuperStates(destination, from); // reverse order so that events fire from outer to inner superstates Collections.reverse(leavingSuperStates); // fire a superstate-enter event for all superstates being left fireSuperStateEvents(leavingSuperStates, Event.EVENTTYPE_SUPERSTATE_ENTER, executionContext); } return destination; }
void fireSuperStateLeaveEvents(ExecutionContext executionContext) { // optimisation: check if there is a candidate superstate to be left if (executionContext.getTransitionSource().getSuperState() != null) { // collect all the superstates being left List leavingSuperStates = collectAllSuperStates(executionContext.getTransitionSource(), to); // fire a node-leave event for all superstates being left fireSuperStateEvents(leavingSuperStates, Event.EVENTTYPE_SUPERSTATE_LEAVE, executionContext); } }
void fireSuperStateLeaveEvents(ExecutionContext executionContext) { // optimisation: check if there is a candidate superstate to be left if (executionContext.getTransitionSource().getSuperState() != null) { // collect all the superstates being left List leavingSuperStates = collectAllSuperStates(executionContext.getTransitionSource(), to); // fire a node-leave event for all superstates being left fireSuperStateEvents(leavingSuperStates, Event.EVENTTYPE_SUPERSTATE_LEAVE, executionContext); } }