public void convertToBpmn( BPMNDiagram bpmn, String id, String name, DirectedGraphNode parent, Map<String, BPMNNode> id2node) { Map<String, EventTrigger> eventTriggerMap = new HashMap<String, EventTrigger>() { private static final long serialVersionUID = -7540595389022504040L; { put("Message", EventTrigger.MESSAGE); put("None", EventTrigger.NONE); put("Timer", EventTrigger.TIMER); put("Rule", EventTrigger.CONDITIONAL); put("Link", EventTrigger.LINK); put("Multiple", EventTrigger.MULTIPLE); put("Error", EventTrigger.ERROR); put("Compensation", EventTrigger.COMPENSATION); put("Cancel", EventTrigger.CANCEL); put("Terminate", EventTrigger.TERMINATE); put("Signal", EventTrigger.SIGNAL); } }; if (startEvent != null) { startEvent.convertToBpmn(bpmn, id, name, parent, id2node, eventTriggerMap); } else if (intermediateEvent != null) { intermediateEvent.convertToBpmn(bpmn, id, name, parent, id2node, eventTriggerMap); } else if (endEvent != null) { endEvent.convertToBpmn(bpmn, id, name, parent, id2node, eventTriggerMap); } else { (new XpdlIntermediateEvent("IntermediateEvent")) .convertToBpmn(bpmn, id, name, parent, id2node, eventTriggerMap); } }
protected boolean importElements(XmlPullParser xpp, Xpdl xpdl) { if (super.importElements(xpp, xpdl)) { /* * Start tag corresponds to a known child element of an XPDL node. */ return true; } if (xpp.getName().equals("StartEvent")) { startEvent = new XpdlStartEvent("StartEvent"); startEvent.importElement(xpp, xpdl); return true; } if (xpp.getName().equals("IntermediateEvent")) { intermediateEvent = new XpdlIntermediateEvent("IntermediateEvent"); intermediateEvent.importElement(xpp, xpdl); return true; } if (xpp.getName().equals("EndEvent")) { endEvent = new XpdlEndEvent("EndEvent"); endEvent.importElement(xpp, xpdl); return true; } /* * Unknown tag */ return false; }
protected String exportElements() { /* * Export node child elements. */ String s = super.exportElements(); if (startEvent != null) { s += startEvent.exportElement(); } if (intermediateEvent != null) { s += intermediateEvent.exportElement(); } if (endEvent != null) { s += endEvent.exportElement(); } return s; }