1 package org.jbpm.bpel.xml; 2 3 import javax.xml.namespace.QName ; 4 5 import org.w3c.dom.Element ; 6 7 import org.jbpm.bpel.data.def.VariableDefinition; 8 import org.jbpm.bpel.def.Activity; 9 import org.jbpm.bpel.def.Throw; 10 import org.jbpm.bpel.xml.util.NodeUtil; 11 import org.jbpm.jpdl.xml.Problem; 12 13 17 public class ThrowReader extends ActivityReader { 18 19 protected Activity createActivity() { 20 return new Throw(); 21 } 22 23 protected void readActivity(Activity activity, Element activityElem) { 24 Throw throwActivity = (Throw) activity; 25 26 String faultNameString = NodeUtil.getAttribute(activityElem, BpelConstants.ATTR_FAULT_NAME); 27 if( faultNameString == null ) { 28 bpelReader.getProblemHandler().add( 29 new LocalizedProblem(Problem.LEVEL_ERROR, "fault name is missing", activityElem)); 30 } 31 else { 32 QName faultName = NodeUtil.getQName(faultNameString, activityElem); 33 throwActivity.setFaultName( faultName ); 34 } 35 36 String variableName = NodeUtil.getAttribute(activityElem, BpelConstants.ATTR_FAULT_VARIABLE); 37 if( variableName != null ) { 38 VariableDefinition faultVariable = throwActivity.getCompositeActivity().findVariable(variableName); 39 if(faultVariable == null) { 40 bpelReader.getProblemHandler().add( 41 new LocalizedProblem(Problem.LEVEL_ERROR, "variable not found", activityElem)); 42 } 43 else { 44 throwActivity.setFaultVariable(faultVariable); 45 } 46 } 47 } 48 } 49 | Popular Tags |