1 package org.jbpm.graph.node; 2 3 import java.util.*; 4 import org.dom4j.Element; 5 import org.jbpm.graph.def.*; 6 import org.jbpm.graph.exe.*; 7 import org.jbpm.jpdl.xml.*; 8 9 17 public class InterleaveEnd extends Node implements Parsable { 18 19 private static final long serialVersionUID = 1L; 20 21 private Transition back = null; 22 private Transition done = null; 23 24 public InterleaveEnd() { 25 } 26 27 public InterleaveEnd(String name) { 28 super(name); 29 } 30 31 public void read(Element element, JpdlXmlReader jpdlReader) { 32 } 34 35 public void write(Element element) { 36 } 38 39 public void execute(ExecutionContext executionContext) { 40 Token token = executionContext.getToken(); 41 Node interleaveEndNode = token.getNode(); 42 Collection transitionNames = getInterleaveStart().retrieveTransitionNames(token); 43 if ( ! transitionNames.isEmpty() ) { 45 String backTransitionName = "back"; 47 if ( back != null ) { 48 backTransitionName = back.getName(); 49 } 50 interleaveEndNode.leave(executionContext, backTransitionName); 51 } else { 52 getInterleaveStart().removeTransitionNames(token); 54 String doneTransitionName = "done"; 55 if ( done != null ) { 56 doneTransitionName = done.getName(); 57 } 58 interleaveEndNode.leave(executionContext, doneTransitionName); 59 } 60 } 61 62 public InterleaveStart getInterleaveStart() { 63 return (InterleaveStart) getLeavingTransition("back").getTo(); 64 } 65 66 public Transition getBack() { 67 return back; 68 } 69 public void setBack(Transition back) { 70 this.back = back; 71 } 72 public Transition getDone() { 73 return done; 74 } 75 public void setDone(Transition done) { 76 this.done = done; 77 } 78 } 79 | Popular Tags |