1 package org.jbpm.bpel.def; 2 3 import java.io.Serializable ; 4 import java.util.ArrayList ; 5 import java.util.List ; 6 7 import org.jbpm.graph.def.Node; 8 import org.jbpm.graph.exe.ExecutionContext; 9 10 14 public class ScopeHandler extends CompositeActivity implements Serializable { 15 16 private static final long serialVersionUID = 1L; 17 18 public ScopeHandler() { 19 } 20 21 private Activity activity; 22 private transient List nodes = null; 23 24 public Activity getActivity() { 25 return activity; 26 } 27 28 public void setActivity(Activity activity) { 29 this.activity = activity; 30 } 31 32 public void execute(ExecutionContext context) { 33 activity.enter(context); 34 } 35 36 38 public Node addNode(Node node) { 40 activity = (Activity) node; 41 activity.compositeActivity = this; 42 return activity; 43 } 44 45 public Node removeNode(Node node) { 47 if(activity.equals(node)) { 48 activity.compositeActivity = null; 49 activity = null; 50 } 51 52 return node; 53 } 54 55 public void reorderNode(int oldIndex, int newIndex) { 57 } 59 60 public List getNodes() { 62 if(nodes == null && activity!=null) { 63 nodes = new ArrayList (); 64 nodes.add(activity); 65 } 66 else if(!nodes.contains(activity)) { 67 nodes.set(0, activity); 68 } 69 70 return nodes; 71 } 72 } | Popular Tags |