public ProcessDefinition retrieveProcessDefinition(ProcessDefinition pd) { try { // often needed to start a process: for (Iterator iter = pd.getStartState().getLeavingTransitions().iterator(); iter.hasNext();) { Transition transition = (Transition) iter.next(); Hibernate.initialize(transition); } } catch (RuntimeException ex) { log.warn("failure retrieving " + pd, ex); } return pd; }
public ProcessDefinition retrieveProcessDefinition(ProcessDefinition pd) { try { // often needed to start a process: for (Iterator iter = pd.getStartState().getLeavingTransitions().iterator(); iter.hasNext();) { Transition transition = (Transition) iter.next(); Hibernate.initialize(transition); } } catch (RuntimeException ex) { log.warn("failure retrieving " + pd, ex); } return pd; }
/** * 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); } }
/** * sends a signal to this token. leaves the current {@link #getNode() node} over the * transition with the given name. */ public void signal(String transitionName) { if (node == null) { throw new JbpmException(this + " is not positioned in a node"); } Transition leavingTransition = node.getLeavingTransition(transitionName); if (leavingTransition == null) { // fall back to target node name for (Iterator iter = node.getLeavingTransitions().iterator(); iter.hasNext();) { Transition transition = (Transition) iter.next(); if (transitionName.equals(transition.getTo().getName())) { leavingTransition = transition; break; } } if (leavingTransition == null) { throw new JbpmException(node + " has no leaving transition named " + transitionName); } } signal(leavingTransition, new ExecutionContext(this)); }
/** * sends a signal to this token. leaves the current {@link #getNode() node} over the * transition with the given name. */ public void signal(String transitionName) { if (node == null) { throw new JbpmException(this + " is not positioned in a node"); } Transition leavingTransition = node.getLeavingTransition(transitionName); if (leavingTransition == null) { // fall back to target node name for (Iterator iter = node.getLeavingTransitions().iterator(); iter.hasNext();) { Transition transition = (Transition) iter.next(); if (transitionName.equals(transition.getTo().getName())) { leavingTransition = transition; break; } } if (leavingTransition == null) { throw new JbpmException(node + " has no leaving transition named " + transitionName); } } signal(leavingTransition, new ExecutionContext(this)); }