public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { final Element element = parser.endElementBuilder(); Node node = (Node) parser.getCurrent(); // determine type of event definition, so the correct type of node // can be generated handleNode(node, element, uri, localName, parser); org.w3c.dom.Node xmlNode = element.getFirstChild(); while (xmlNode != null) { String nodeName = xmlNode.getNodeName(); if ("multiInstanceLoopCharacteristics".equals(nodeName)) { // create new timerNode ForEachNode forEachNode = new ForEachNode(); forEachNode.setId(node.getId()); forEachNode.setMetaData("UniqueId", node.getMetaData().get("UniqueId")); node.setMetaData("UniqueId", null); node.setMetaData("hidden", true); forEachNode.addNode(node); forEachNode.linkIncomingConnections( NodeImpl.CONNECTION_DEFAULT_TYPE, node.getId(), NodeImpl.CONNECTION_DEFAULT_TYPE); forEachNode.linkOutgoingConnections( node.getId(), NodeImpl.CONNECTION_DEFAULT_TYPE, NodeImpl.CONNECTION_DEFAULT_TYPE); node = forEachNode; handleForEachNode(node, element, uri, localName, parser); break; } xmlNode = xmlNode.getNextSibling(); } NodeContainer nodeContainer = (NodeContainer) parser.getParent(); nodeContainer.addNode(node); return node; }
public ForEachNodeFactory( RuleFlowNodeContainerFactory nodeContainerFactory, NodeContainer nodeContainer, long id) { this.nodeContainerFactory = nodeContainerFactory; this.nodeContainer = nodeContainer; ForEachNode forEachNode = new ForEachNode(); forEachNode.setId(id); setNodeContainer(forEachNode); }
public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { final Element element = parser.endElementBuilder(); Node node = (Node) parser.getCurrent(); // determine type of event definition, so the correct type of node // can be generated boolean found = false; org.w3c.dom.Node xmlNode = element.getFirstChild(); while (xmlNode != null) { String nodeName = xmlNode.getNodeName(); if ("multiInstanceLoopCharacteristics".equals(nodeName)) { // create new timerNode ForEachNode forEachNode = new ForEachNode(); forEachNode.setId(node.getId()); forEachNode.setName(node.getName()); for (org.kie.api.definition.process.Node subNode : ((CompositeContextNode) node).getNodes()) { forEachNode.addNode(subNode); } forEachNode.setMetaData("UniqueId", ((CompositeContextNode) node).getMetaData("UniqueId")); forEachNode.setMetaData( ProcessHandler.CONNECTIONS, ((CompositeContextNode) node).getMetaData(ProcessHandler.CONNECTIONS)); VariableScope v = (VariableScope) ((CompositeContextNode) node).getDefaultContext(VariableScope.VARIABLE_SCOPE); ((VariableScope) ((CompositeContextNode) forEachNode.internalGetNode(2)) .getDefaultContext(VariableScope.VARIABLE_SCOPE)) .setVariables(v.getVariables()); node = forEachNode; handleForEachNode(node, element, uri, localName, parser); found = true; break; } xmlNode = xmlNode.getNextSibling(); } if (!found) { handleCompositeContextNode(node, element, uri, localName, parser); } NodeContainer nodeContainer = (NodeContainer) parser.getParent(); nodeContainer.addNode(node); return node; }