/** * creates a transition with the given name from this node to the given * destination node. Also the transition pointers to source and destination * node will be set appropriatly. * @param transitionName may be null. * @throws NullPointerException if destination is null. */ public TransitionImpl createOutgoingTransition(NodeImpl destination, String transitionName) { TransitionImpl transition = createOutgoingTransition(transitionName); if (destination!=null) { destination.addIncomingTransition(transition); } return transition; }
private static JoinRunTime getJoinRunTime(XpdlInstance instance, NodeImpl node) { JoinType joinType = ((AbstractActivity) node.getBehaviour()).getJoinType(); JoinRunTime joinRunTime = instance.getJoinRunTime(node.getName()); if (joinRunTime == null) { int joinIncomingTransitionNbRequired = 1; if (joinType.equals(JoinType.AND)) { joinIncomingTransitionNbRequired = node.getIncomingTransitions().size(); } Map<String, JoinRunTime.WaitingTransition> ins = new HashMap<String, JoinRunTime.WaitingTransition>(); for (Transition t : node.getIncomingTransitions()) { String name = t.getSource().getName(); ins.put(name, new JoinRunTime.WaitingTransition(name, null)); } joinRunTime = new JoinRunTime(node.getName(), ins, joinIncomingTransitionNbRequired); instance.pushJoinRuntime(joinRunTime); } return joinRunTime; }
public void setName(String name) { // if there is no source node associated with this transition if (source==null) { // it s just a setter this.name = name; } else { // otherwise // make sure the source node's leavingTransitionsMap remains up to date if (this.name!=null) { source.removeOutgoingTransition(this); } this.name = name; if (name!=null) { source.addOutgoingTransition(this); } } }
initialNode.createOutgoingTransition(initialActivityNode, "initialSplit_" + initialNode.getName() + "_to_" + initialActivityNode.getName()); initialNode.setBehaviour(initialRoute); initialNode.setPreviousNeeded(true); xpdlProcess.setInitial(initialNode); endingActivityNode.createOutgoingTransition(endingNode, "endingJoin_" + endingActivityNode.getName() + "_to_" + endingNode.getName()); initialNode.createOutgoingTransition(endingNode, "initialSplit_" + initialNode.getName() + "_to_" + endingNode.getName()); endingNode.setPreviousNeeded(true); endingNode.setBehaviour(endingRoute);
for (String nodeName : c.path) { NodeImpl sourceNode = inProcess.getNode(nodeName); if (sourceNode.hasOutgoingTransitions()) { for (Transition t : sourceNode.getOutgoingTransitions()) { if (!c.path.contains(t.getDestination().getName())) { c.exitNodes.add(sourceNode.getName()); SplitType splitType = ((AbstractActivity)sourceNode.getBehaviour()).getSplitType();
public String toString() { String destinationName = (destination!=null ? destination.getName() : null); String sourceName = (source!=null ? source.getName() : null); return (sourceName!=null ? "("+sourceName+")--" : "--") + (name!=null ? name+"-->" : ">") + (destinationName!=null ? "("+destinationName+")" : ""); }
for (String nodeName : c.path) { NodeImpl sourceNode = inProcess.getNode(nodeName); if (sourceNode.hasIncomingTransitions()) { for (Transition t : sourceNode.getIncomingTransitions()) { JoinType joinType; boolean isEntryNode = true; c.entryNodes.add(sourceNode.getName()); joinType = ((AbstractActivity)sourceNode.getBehaviour()).getJoinType(); if (JoinType.XOR.equals(joinType)) { hasEntryPointXor = true;
+ "cannot find a node with id '" + iteration.getTo() + "'"); AbstractActivity destNodeActivity = (AbstractActivity) destNode.getBehaviour(); if (!destNodeActivity.getJoinType().equals(org.ow2.bonita.definition.activity.AbstractActivity.JoinType.XOR)) { throw new DeploymentRuntimeException("iteration points to a node with a join " + destNodeActivity.getJoinType() + ", but only XOR are supported."); String transitionName = fromNode.getName() + "_" + destNode.getName(); TransitionImpl transition = fromNode.createOutgoingTransition(destNode, transitionName); if (LOG.isLoggable(Level.FINE)) { LOG.fine("**** created iteration transition = " + transitionName);
TransitionImpl transition = (TransitionImpl) sourceNode.createOutgoingTransition(destNode); sourceNode.removeOutgoingTransition(transition); destNode.removeIncomingTransition(transition);
if (node.getVariableDefinitions() != null && !node.getVariableDefinitions().isEmpty()) { for (VariableDefinitionImpl var : node.getVariableDefinitions()) { inParameters.put(var.getKey(), var.getKey()); inParameters, outParameters); } else if (activity.isRoute()) { if (node.getVariableDefinitions() != null && !node.getVariableDefinitions().isEmpty()) { throw new DeploymentRuntimeException("A route activity can't define local variables."); String variableId = multiInstantiationDefinition.getVariableId(); boolean variableExists = false; if (node.getVariableDefinitions() != null) { for (VariableDefinitionImpl var : node.getVariableDefinitions()) { if (var.getKey().equals(variableId)) { variableExists = true; node.setBehaviour(abstractActivity); node.setPreviousNeeded(true); return node;
public Object deepCopy(Object object) throws HibernateException { if (object==null) { return null; } ExecutionImpl original = (ExecutionImpl) object; NodeImpl node = new NodeImpl(); node.setName(original.getNode().getName()); ExecutionImpl copy = new ExecutionImpl(); copy.setNode(node); return copy; }
/** * Fill the path and transitions fields of the CycleObject c. * @param c cycle object to fill * @param sourceNode source node of the path * @param destNode destination of the path * @return */ private static boolean fillCycleObject(CycleObject c, NodeImpl sourceNode, NodeImpl destNode) { if (sourceNode.equals(destNode)) { c.path.add(sourceNode.getName()); return true; } if (sourceNode.hasOutgoingTransitions()) { boolean res = false; for (Transition t : sourceNode.getOutgoingTransitions()) { if (fillCycleObject(c, (NodeImpl) t.getDestination(), destNode)) { c.path.add(sourceNode.getName()); MyTransition myT = new MyTransition(); myT.fromNode = t.getSource().getName(); myT.toNode = t.getDestination().getName(); c.transitions.add(myT); res = true; } } return res; } return false; }
/** * Deep first search algorithm that creates spanning tree * (see {@link IterationDetection#createSpanningTree(ProcessDefinitionImpl, ProcessDefinitionImpl)} * @param inNode node of the input process currently processed * @param outNode corresponding node in the spanning tree * @param outProcess spanning tree * @return list of unprocessed transitions during the DFS */ private static List<Transition> processNode(Node inNode, NodeImpl outNode, ProcessDefinitionImpl outProcess) { List<Transition> nonProcessedTransitions = new ArrayList<Transition>(); if (inNode.hasOutgoingTransitions()) { for (Transition t : inNode.getOutgoingTransitions()) { NodeImpl destNode = (NodeImpl) t.getDestination(); String destName = destNode.getName(); if (!outProcess.hasNode(destName)) { // create node NodeImpl newNode = outProcess.createNode(destName); outNode.createOutgoingTransition(newNode, t.getName()); nonProcessedTransitions.addAll(processNode(t.getDestination(), newNode, outProcess)); } else { // node already in the spanning tree, the transition is not in the spanning tree. nonProcessedTransitions.add(t); } } } return nonProcessedTransitions; }
/** * creates a transition from this node to the given * destination node. Also the transition pointers to source and destination * node will be set appropriatly. * @throws NullPointerException if destination is null. */ public Transition createOutgoingTransition(NodeImpl destination) { return createOutgoingTransition(destination, null); }
/** sets the behaviour on the current node. * A current node is required. */ public ProcessFactory behaviour(Activity activity) { if (exceptionHandler!=null) { throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd"); } if (node==null) { throw new PvmException("no current node"); } node.setBehaviour(activity); return this; }
AbstractActivity activity = (AbstractActivity) inProcess.getNode(itDesc.getKey()).getBehaviour(); activity.setIterationDescriptors(itDesc.getValue());
NodeImpl currentNode = xpdlExecution.getNode(); if (LOG.isLoggable(Level.FINE)) { LOG.fine("node = " + currentNode.getName() + " - splitType = " + splitType + " - execution = " + execution.getName()); List<Transition> transitions = currentNode.getOutgoingTransitions(); if (transitions == null) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("node = " + currentNode.getName() + " - splitType = " + splitType + " - execution = " + execution.getName() + " no transition available. Ending execution");
/** sets the property needsPrevious on the current node. * A current node is required. */ public ProcessFactory needsPrevious() { if (exceptionHandler!=null) { throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd"); } if (node==null) { throw new PvmException("no current node"); } node.setPreviousNeeded(true); return this; }
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; }