1 package org.jbpm.bpel.def; 2 3 import org.jbpm.context.def.ContextDefinition; 4 import org.jbpm.graph.def.GraphElement; 5 import org.jbpm.graph.def.ProcessDefinition; 6 import org.jbpm.graph.exe.ProcessInstance; 7 import org.jbpm.graph.exe.Token; 8 9 import org.jbpm.bpel.service.def.Receiver; 10 11 17 public class BpelDefinition extends ProcessDefinition { 18 19 private String targetNamespace; 20 private String queryLanguage; 21 private String expressionLanguage; 22 private boolean abstractProcess; 23 private boolean enableInstanceCompensation; 24 25 private String location; 26 27 private static final long serialVersionUID = 1L; 28 29 public BpelDefinition() { 30 this(null); 31 } 32 33 public BpelDefinition(String name) { 34 super(name); 35 addNode(new RootScope()); 36 addDefinition(new ContextDefinition()); 37 addDefinition(new ImportsDefinition()); 38 } 39 40 42 public String getTargetNamespace() { 43 return targetNamespace; 44 } 45 46 public void setTargetNamespace(String targetNamespace) { 47 this.targetNamespace = targetNamespace; 48 } 49 50 public String getQueryLanguage() { 51 return queryLanguage; 52 } 53 54 public void setQueryLanguage(String queryLanguage) { 55 this.queryLanguage = queryLanguage; 56 } 57 58 public String getExpressionLanguage() { 59 return expressionLanguage; 60 } 61 62 public void setExpressionLanguage(String expressionLanguage) { 63 this.expressionLanguage = expressionLanguage; 64 } 65 66 public boolean isAbstractProcess() { 67 return abstractProcess; 68 } 69 70 public void setAbstractProcess(boolean abstractProcess) { 71 this.abstractProcess = abstractProcess; 72 } 73 74 public boolean getEnableInstanceCompensation() { 75 return enableInstanceCompensation; 76 } 77 78 public void setEnableInstanceCompensation(boolean enableInstanceCompensation) { 79 this.enableInstanceCompensation = enableInstanceCompensation; 80 } 81 82 public String getLocation() { 83 return location; 84 } 85 86 public void setLocation(String location) { 87 this.location = location; 88 } 89 90 public ImportsDefinition getImports() { 91 return (ImportsDefinition) getDefinition(ImportsDefinition.class); 92 } 93 94 public Activity getRoot() { 95 return getScope().getRoot(); 96 } 97 98 public void setRoot(Activity root) { 99 getScope().setRoot(root); 100 } 101 102 public Scope getScope() { 103 return (Scope) getNodes().get(0); 104 } 105 106 public void triggerProcessInstance(ProcessInstance instance, Receiver trigger) { 107 Token rootToken = instance.getRootToken(); 108 Scope scope = getScope(); 109 scope.enableEvents(rootToken); 110 new ProcessInstanceTrigger(scope.createScopeContext(rootToken), trigger).visit(this); 111 } 112 113 115 public ProcessInstance createProcessInstance() { 116 ProcessInstance instance = super.createProcessInstance(); 117 getScope().initScopeData(instance.getRootToken()); 118 return instance; 119 } 120 121 public static class RootScope extends Scope { 122 123 private static final long serialVersionUID = 1L; 124 125 public RootScope() { 126 setImplicit(true); 127 } 128 129 public boolean isChildInitial(Activity activity) { 130 return activity.equals(root); 131 } 132 133 137 public GraphElement getParent() { 138 return processDefinition; 139 } 140 141 public ProcessDefinition getProcessDefinition() { 142 return processDefinition; 143 } 144 145 public boolean suppressJoinFailure() { 146 return getSuppressJoinFailure().booleanValue(); 147 } 148 } 149 } 150 | Popular Tags |