protected void handleStateNode( final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { super.handleNode(node, element, uri, localName, parser); StateNode stateNode = (StateNode) node; org.w3c.dom.Node xmlNode = element.getFirstChild(); while (xmlNode != null) { String nodeName = xmlNode.getNodeName(); if ("conditionalEventDefinition".equals(nodeName)) { org.w3c.dom.Node subNode = xmlNode.getFirstChild(); while (subNode != null) { String subnodeName = subNode.getNodeName(); if ("condition".equals(subnodeName)) { stateNode.setMetaData("Condition", xmlNode.getTextContent()); break; } subNode = subNode.getNextSibling(); } } xmlNode = xmlNode.getNextSibling(); } }
@SuppressWarnings("unchecked") protected void handleForEachNode( final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { super.handleNode(node, element, uri, localName, parser); ForEachNode forEachNode = (ForEachNode) node; org.w3c.dom.Node xmlNode = element.getFirstChild(); while (xmlNode != null) { String nodeName = xmlNode.getNodeName(); if ("ioSpecification".equals(nodeName)) { readIoSpecification(xmlNode, dataInputs, dataOutputs); } else if ("dataInputAssociation".equals(nodeName)) { readDataInputAssociation(xmlNode, forEachNode); } else if ("multiInstanceLoopCharacteristics".equals(nodeName)) { readMultiInstanceLoopCharacteristics(xmlNode, forEachNode, parser); } xmlNode = xmlNode.getNextSibling(); } List<SequenceFlow> connections = (List<SequenceFlow>) forEachNode.getMetaData(ProcessHandler.CONNECTIONS); ProcessHandler.linkConnections(forEachNode, connections); ProcessHandler.linkBoundaryEvents(forEachNode); }
protected void handleSignalNode( final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { super.handleNode(node, element, uri, localName, parser); EventNode eventNode = (EventNode) node; org.w3c.dom.Node xmlNode = element.getFirstChild(); while (xmlNode != null) { String nodeName = xmlNode.getNodeName(); if ("dataOutputAssociation".equals(nodeName)) { readDataOutputAssociation(xmlNode, eventNode); } else if ("signalEventDefinition".equals(nodeName)) { String type = ((Element) xmlNode).getAttribute("signalRef"); if (type != null && type.trim().length() > 0) { List<EventFilter> eventFilters = new ArrayList<EventFilter>(); EventTypeFilter eventFilter = new EventTypeFilter(); eventFilter.setType(type); eventFilters.add(eventFilter); eventNode.setEventFilters(eventFilters); eventNode.setScope("external"); } } xmlNode = xmlNode.getNextSibling(); } }
protected void handleNode( final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { super.handleNode(node, element, uri, localName, parser); WorkItemNode workItemNode = (WorkItemNode) node; String name = getTaskName(element); Work work = new WorkImpl(); work.setName(name); workItemNode.setWork(work); org.w3c.dom.Node xmlNode = element.getFirstChild(); while (xmlNode != null) { String nodeName = xmlNode.getNodeName(); if ("ioSpecification".equals(nodeName)) { readIoSpecification(xmlNode, dataInputs, dataOutputs); } else if ("dataInputAssociation".equals(nodeName)) { readDataInputAssociation(xmlNode, workItemNode, dataInputs); } else if ("dataOutputAssociation".equals(nodeName)) { readDataOutputAssociation(xmlNode, workItemNode, dataOutputs); } xmlNode = xmlNode.getNextSibling(); } handleScript(workItemNode, element, "onEntry"); handleScript(workItemNode, element, "onExit"); }
public void handleNode( final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { super.handleNode(node, element, uri, localName, parser); MilestoneNode milestoneNode = (MilestoneNode) node; for (String eventType : milestoneNode.getActionTypes()) { handleAction(milestoneNode, element, eventType); } }
protected void handleTimerNode( final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { super.handleNode(node, element, uri, localName, parser); TimerNode timerNode = (TimerNode) node; org.w3c.dom.Node xmlNode = element.getFirstChild(); while (xmlNode != null) { String nodeName = xmlNode.getNodeName(); if ("timerEventDefinition".equals(nodeName)) { Timer timer = new Timer(); org.w3c.dom.Node subNode = xmlNode.getFirstChild(); while (subNode instanceof Element) { String subNodeName = subNode.getNodeName(); if ("timeCycle".equals(subNodeName)) { String delay = subNode.getTextContent(); int index = delay.indexOf("###"); if (index != -1) { String period = delay.substring(index + 3); delay = delay.substring(0, index); timer.setPeriod(period); } timer.setTimeType(Timer.TIME_CYCLE); timer.setDelay(delay); break; } else if ("timeDuration".equals(subNodeName)) { String delay = subNode.getTextContent(); timer.setTimeType(Timer.TIME_DURATION); timer.setDelay(delay); break; } else if ("timeDate".equals(subNodeName)) { String date = subNode.getTextContent(); timer.setTimeType(Timer.TIME_DATE); timer.setDate(date); break; } subNode = subNode.getNextSibling(); } timerNode.setTimer(timer); } xmlNode = xmlNode.getNextSibling(); } }
public void handleNode( final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { super.handleNode(node, element, uri, localName, parser); EventNode eventNode = (EventNode) node; String variableName = element.getAttribute("variableName"); if (variableName != null && variableName.length() != 0) { eventNode.setVariableName(variableName); } String scope = element.getAttribute("scope"); if (scope != null && scope.length() != 0) { eventNode.setScope(scope); } }
@SuppressWarnings("unchecked") protected void handleCompositeContextNode( final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { super.handleNode(node, element, uri, localName, parser); CompositeContextNode compositeNode = (CompositeContextNode) node; List<SequenceFlow> connections = (List<SequenceFlow>) compositeNode.getMetaData(ProcessHandler.CONNECTIONS); ProcessHandler.linkConnections(compositeNode, connections); List<IntermediateLink> throwLinks = (List<IntermediateLink>) compositeNode.getMetaData(ProcessHandler.LINKS); ProcessHandler.linkIntermediateLinks(compositeNode, throwLinks); ProcessHandler.linkBoundaryEvents(compositeNode); }
protected void handleNode( final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { super.handleNode(node, element, uri, localName, parser); ActionNode actionNode = (ActionNode) node; node.setMetaData("NodeType", "ScriptTask"); DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction(); if (action == null) { action = new DroolsConsequenceAction(); actionNode.setAction(action); } String language = element.getAttribute("scriptFormat"); if (XmlBPMNProcessDumper.JAVA_LANGUAGE.equals(language)) { action.setDialect(JavaDialect.ID); } else if (XmlBPMNProcessDumper.JAVASCRIPT_LANGUAGE.equals(language)) { action.setDialect("JavaScript"); } action.setConsequence(""); org.w3c.dom.Node xmlNode = element.getFirstChild(); while (xmlNode != null) { if (xmlNode instanceof Element && "script".equals(xmlNode.getNodeName())) { action.setConsequence(xmlNode.getTextContent()); } xmlNode = xmlNode.getNextSibling(); } String compensation = element.getAttribute("isForCompensation"); if (compensation != null) { boolean isForCompensation = Boolean.parseBoolean(compensation); if (isForCompensation) { actionNode.setMetaData("isForCompensation", isForCompensation); } } }
protected void handleNode( final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { super.handleNode(node, element, uri, localName, parser); SubProcessNode subProcessNode = (SubProcessNode) node; String processId = element.getAttribute("calledElement"); if (processId != null) { subProcessNode.setProcessId(processId); } String waitForCompletion = element.getAttribute("waitForCompletion"); if (waitForCompletion != null && "false".equals(waitForCompletion)) { subProcessNode.setWaitForCompletion(false); } String independent = element.getAttribute("independent"); if (independent != null && "false".equals(independent)) { subProcessNode.setIndependent(false); } Map<String, String> dataInputs = new HashMap<String, String>(); Map<String, String> dataOutputs = new HashMap<String, String>(); org.w3c.dom.Node xmlNode = element.getFirstChild(); while (xmlNode != null) { String nodeName = xmlNode.getNodeName(); if ("ioSpecification".equals(nodeName)) { readIoSpecification(xmlNode, dataInputs, dataOutputs); } else if ("dataInputAssociation".equals(nodeName)) { readDataInputAssociation(xmlNode, subProcessNode, dataInputs); } else if ("dataOutputAssociation".equals(nodeName)) { readDataOutputAssociation(xmlNode, subProcessNode, dataOutputs); } xmlNode = xmlNode.getNextSibling(); } }
@SuppressWarnings("unchecked") protected void handleMessageNode( final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { super.handleNode(node, element, uri, localName, parser); EventNode eventNode = (EventNode) node; org.w3c.dom.Node xmlNode = element.getFirstChild(); while (xmlNode != null) { String nodeName = xmlNode.getNodeName(); if ("dataOutputAssociation".equals(nodeName)) { readDataOutputAssociation(xmlNode, eventNode); } else if ("messageEventDefinition".equals(nodeName)) { String messageRef = ((Element) xmlNode).getAttribute("messageRef"); Map<String, Message> messages = (Map<String, Message>) ((ProcessBuildData) parser.getData()).getMetaData("Messages"); if (messages == null) { throw new IllegalArgumentException("No messages found"); } Message message = messages.get(messageRef); if (message == null) { throw new IllegalArgumentException("Could not find message " + messageRef); } eventNode.setMetaData("MessageType", message.getType()); List<EventFilter> eventFilters = new ArrayList<EventFilter>(); EventTypeFilter eventFilter = new EventTypeFilter(); eventFilter.setType("Message-" + messageRef); eventFilters.add(eventFilter); eventNode.setEventFilters(eventFilters); } xmlNode = xmlNode.getNextSibling(); } }