/** * a set of all the leaving transitions on the current node for which the condition expression * resolves to true. */ public Set getAvailableTransitions() { if (node == null) return Collections.EMPTY_SET; Set availableTransitions = new HashSet(); addAvailableTransitionsOfNode(node, availableTransitions); return availableTransitions; }
/** * a set of all the leaving transitions on the current node for which the condition expression * resolves to true. */ public Set getAvailableTransitions() { if (node == null) return Collections.EMPTY_SET; Set availableTransitions = new HashSet(); addAvailableTransitionsOfNode(node, availableTransitions); return availableTransitions; }
/** * adds available transitions of that node to the Set and after that calls itself recursively * for the SuperSate of the Node if it has a super state */ private void addAvailableTransitionsOfNode(Node currentNode, Set availableTransitions) { List leavingTransitions = currentNode.getLeavingTransitions(); if (leavingTransitions != null) { for (Iterator iter = leavingTransitions.iterator(); iter.hasNext();) { Transition transition = (Transition) iter.next(); String conditionExpression = transition.getCondition(); if (conditionExpression != null) { Boolean result = (Boolean) JbpmExpressionEvaluator.evaluate(conditionExpression, new ExecutionContext(this), Boolean.class); if (Boolean.TRUE.equals(result)) { availableTransitions.add(transition); } } else { availableTransitions.add(transition); } } } if (currentNode.getSuperState() != null) { addAvailableTransitionsOfNode(currentNode.getSuperState(), availableTransitions); } }
/** * adds available transitions of that node to the Set and after that calls itself recursively * for the SuperSate of the Node if it has a super state */ private void addAvailableTransitionsOfNode(Node currentNode, Set availableTransitions) { List leavingTransitions = currentNode.getLeavingTransitions(); if (leavingTransitions != null) { for (Iterator iter = leavingTransitions.iterator(); iter.hasNext();) { Transition transition = (Transition) iter.next(); String conditionExpression = transition.getCondition(); if (conditionExpression != null) { Boolean result = (Boolean) JbpmExpressionEvaluator.evaluate(conditionExpression, new ExecutionContext(this), Boolean.class); if (Boolean.TRUE.equals(result)) { availableTransitions.add(transition); } } else { availableTransitions.add(transition); } } } if (currentNode.getSuperState() != null) { addAvailableTransitionsOfNode(currentNode.getSuperState(), availableTransitions); } }