@SuppressWarnings("unchecked") public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { parser.endElementBuilder(); RuleFlowProcess process = (RuleFlowProcess) parser.getCurrent(); List<SequenceFlow> connections = (List<SequenceFlow>) process.getMetaData(CONNECTIONS); linkConnections(process, connections); linkBoundaryEvents(process); List<Lane> lanes = (List<Lane>) process.getMetaData(LaneHandler.LANES); assignLanes(process, lanes); postProcessNodes(process); return process; }
public Object start( final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException { parser.startElementBuilder(localName, attrs); String id = attrs.getValue("id"); String name = attrs.getValue("name"); String packageName = attrs.getValue("http://www.jboss.org/drools", "packageName"); RuleFlowProcess process = new RuleFlowProcess(); process.setAutoComplete(true); process.setId(id); if (name == null) { name = id; } process.setName(name); process.setType("RuleFlow"); if (packageName == null) { packageName = "org.drools.bpmn2"; } process.setPackageName(packageName); ((ProcessBuildData) parser.getData()).setProcess(process); return process; }
private void assignLanes(RuleFlowProcess process, List<Lane> lanes) { List<String> laneNames = new ArrayList<String>(); Map<String, String> laneMapping = new HashMap<String, String>(); if (lanes != null) { for (Lane lane : lanes) { String name = lane.getName(); if (name != null) { Swimlane swimlane = new Swimlane(); swimlane.setName(name); process.getSwimlaneContext().addSwimlane(swimlane); laneNames.add(name); for (String flowElementRef : lane.getFlowElements()) { laneMapping.put(flowElementRef, name); } } } } assignLanes(process, laneMapping); }