1 package org.jbpm.bpel.def; 2 3 import javax.xml.namespace.QName ; 4 5 import org.jbpm.bpel.data.def.VariableDefinition; 6 import org.jbpm.bpel.data.exe.VariableInstance; 7 import org.jbpm.bpel.exe.Fault; 8 import org.jbpm.graph.exe.ExecutionContext; 9 10 17 public class Throw extends Activity { 18 19 private static final long serialVersionUID = 1L; 20 21 private QName faultName; 22 private VariableDefinition faultVariable; 23 24 public Throw() { 25 } 26 27 public Throw(String name) { 28 super(name); 29 } 30 31 public void execute(ExecutionContext context) { 32 Fault fault; 33 34 if(faultVariable != null) { 35 VariableInstance variableInstance = faultVariable.getInstance(context.getToken()); 36 fault = new Fault(faultName, variableInstance.getValue(), faultVariable.getTypeInfo()); 37 } 38 else { 39 fault = new Fault(faultName); 40 } 41 42 this.raiseException(fault, context); 43 } 44 45 public QName getFaultName() { 46 return faultName; 47 } 48 49 public void setFaultName(QName faultName) { 50 this.faultName = faultName; 51 } 52 53 public VariableDefinition getFaultVariable() { 54 return faultVariable; 55 } 56 57 public void setFaultVariable(VariableDefinition faultVariable) { 58 this.faultVariable = faultVariable; 59 } 60 61 62 public void accept(BpelVisitor visitor) { 63 visitor.visit(this); 64 } 65 } 66 | Popular Tags |