private boolean evaluateTransition(TransitionImpl t, XpdlExecution xpdlExecution) { // testing the guard condition Condition condition = t.getCondition(); ConditionDefinition condDef = (ConditionDefinition) condition; boolean conditionOK = true; if (condDef != null) { conditionOK = condDef.evaluate(xpdlExecution); if (!conditionOK) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Unable to take transition: " + t.getName()); } // TODO : cancel nodes on this branch : may be investigate for cleaning of executions ? } } return conditionOK; }
public TransitionImpl createOutgoingTransition(String transitionName) { // create a new transition TransitionImpl transition = new TransitionImpl(); transition.setName(transitionName); // wire it between the source and destination addOutgoingTransition(transition); // if there is no default transition yet if (defaultTransition==null) { // make this the default outgoing transition defaultTransition = transition; } return transition; }
public EventImpl createEvent() { EventImpl event = new EventImpl(); event.setName(Event.TRANSITION_TAKE); addEvent(event); return event; }
/** sets the guard condition on the current transition. * This method requires a current transition. */ public ProcessFactory guardCondition(Condition condition) { if (exceptionHandler!=null) { throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd"); } if (transition==null) { throw new PvmException("no current transition"); } Descriptor conditionDescriptor= new ProvidedObjectDescriptor(condition); transition.setConditionDescriptor(conditionDescriptor); return this; }
if (sourceActivity != null) { transition = sourceActivity.createOutgoingTransition(); transition.setName(transitionId); transition.setDescription(transitionName); } else { parse.addProblem("SourceRef " + sourceRef + " cannot be found");
private static Map<String, TransitionImpl> getTransitionsMap(List<TransitionImpl> transitions) { Map<String, TransitionImpl> map = null; if (transitions!=null) { map = new HashMap<String, TransitionImpl>(); for (TransitionImpl transition: transitions) { if (! map.containsKey(transition.getName())) { map.put(transition.getName(), transition); } } } return map; }
Condition condition = transition.getCondition(); if ( ( (condition == null) || (!checkConditions) || (condition.evaluate(execution)) ) && (activity.getDefaultOutgoingTransition() != transition) ) {
public void perform(ExecutionImpl execution) { TransitionImpl transition = execution.getTransition(); if (execution.getName()!=null) { log.debug(execution.toString()+" takes "+transition); } else { log.debug("taking "+transition); } List<NodeImpl> leftNodes = getNodesLeft(execution.getNode(), transition.getDestination()); ExecutionImpl propagatingExecution = execution; for (NodeImpl leftNode : leftNodes) { propagatingExecution = propagatingExecution.endNode(leftNode); } propagatingExecution.setNode(null); propagatingExecution.fire(Event.TRANSITION_TAKE, transition); boolean wait = false; Condition waitCondition = transition.getWaitCondition(); if (waitCondition!=null) { wait = waitCondition.evaluate(propagatingExecution); } if (!wait) { propagatingExecution.performAtomicOperation(ExecutionImpl.PROCEED_TO_DESTINATION); } }
log.trace("no current node. searching for transition from parent of "+transition); if (transition!=null) { OpenProcessDefinition processDefinition = transition.getProcessDefinition(); ObservableElementImpl transitionParent = transition.getParent();
public EventImpl getEvent() { return getEvent(Event.TRANSITION_TAKE); } public NodeImpl getSource() {
private EventImpl getEvent() { if ( (event==null) && (observableElement instanceof TransitionImpl) ) { event = ((TransitionImpl)observableElement).createEvent(); return event; } if (event==null) { throw new PvmException("no current event"); } return event; }
public void perform(ExecutionImpl execution) { NodeImpl destination = execution.getTransition().getDestination(); execution.setNode(destination); List<NodeImpl> enteredNodes = getNodesEntered(execution.getTransitionOrigin(), destination); ExecutionImpl propagatingExecution = execution; for (NodeImpl enteredNode : enteredNodes) { propagatingExecution = propagatingExecution.beginNode(enteredNode); } // Restore original transition source node // (so that the call to moveTo updates the previous node) propagatingExecution.setNode(execution.getTransitionOrigin()); propagatingExecution.moveTo(destination); propagatingExecution.performAtomicOperation(ExecutionImpl.EXECUTE_NODE); }
pvmTransition.setConditionDescriptor(new ProvidedObjectDescriptor(guardCondition));
transition.setConditionDescriptor(new ProvidedObjectDescriptor(guardCondition));