1 package org.jbpm.bpel.xml; 2 3 import java.util.Iterator ; 4 5 import org.w3c.dom.Element ; 6 7 import org.jbpm.bpel.def.Activity; 8 import org.jbpm.bpel.def.Flow; 9 import org.jbpm.bpel.def.Link; 10 import org.jbpm.bpel.xml.util.NodeUtil; 11 12 18 public class FlowReader extends ActivityReader { 19 20 public Activity createActivity() { 21 return new Flow(); 22 } 23 24 public void readActivity(Activity activity, Element flowElem) { 25 Flow flow = (Flow) activity; 26 27 Element linksElem = NodeUtil.getElement(flowElem, BpelConstants.NS_BPWS, BpelConstants.ELEM_LINKS); 29 if(linksElem != null) { 30 Iterator linkElemIt = NodeUtil.getElements(linksElem, BpelConstants.NS_BPWS, BpelConstants.ELEM_LINK); 31 while (linkElemIt.hasNext()) { 32 Element linkElem = (Element ) linkElemIt.next(); 33 flow.addLink(new Link(linkElem.getAttribute(BpelConstants.ATTR_NAME))); 34 } 35 } 36 37 38 Iterator activityElemIt = bpelReader.getActivityElements(flowElem); 39 while ( activityElemIt.hasNext() ) { 40 Element activityElem = (Element ) activityElemIt.next(); 41 bpelReader.readActivity(activityElem, flow); 42 } 43 } 44 } 45 | Popular Tags |