public Object getValue() { return node.getMetaData().get(name); } public void setValue(Object value) {
protected Map<String, Object> getMetaData(Node node) { return XmlBPMNProcessDumper.getMetaData(node.getMetaData()); }
protected void writeNode(final String name, final Node node, final StringBuilder xmlDump, final boolean includeMeta) { xmlDump.append(" <" + name + " id=\"" + node.getId() + "\" "); if (node.getName() != null) { xmlDump.append("name=\"" + XmlDumper.replaceIllegalChars(node.getName()) + "\" "); } if (includeMeta) { Integer x = (Integer) node.getMetaData().get("x"); Integer y = (Integer) node.getMetaData().get("y"); Integer width = (Integer) node.getMetaData().get("width"); Integer height = (Integer) node.getMetaData().get("height"); Integer color = (Integer) node.getMetaData().get("color"); if (x != null && x != 0) { xmlDump.append("x=\"" + x + "\" "); } if (y != null && y != 0) { xmlDump.append("y=\"" + y + "\" "); } if (width != null && width != -1) { xmlDump.append("width=\"" + width + "\" "); } if (height != null && height != -1) { xmlDump.append("height=\"" + height + "\" "); } if (color != null && color != 0) { xmlDump.append("color=\"" + color + "\" "); } } }
protected void writeNode(final String name, final Node node, final StringBuilder xmlDump, int metaDataType) { xmlDump.append(" <" + name + " "); xmlDump.append("id=\"" + XmlBPMNProcessDumper.getUniqueNodeId(node) + "\" "); if (node.getName() != null) { xmlDump.append("name=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(node.getName()) + "\" "); } if (metaDataType == XmlBPMNProcessDumper.META_DATA_AS_NODE_PROPERTY) { Integer x = (Integer) node.getMetaData().get("x"); Integer y = (Integer) node.getMetaData().get("y"); Integer width = (Integer) node.getMetaData().get("width"); Integer height = (Integer) node.getMetaData().get("height"); if (x != null && x != 0) { xmlDump.append("g:x=\"" + x + "\" "); } if (y != null && y != 0) { xmlDump.append("g:y=\"" + y + "\" "); } if (width != null && width != -1) { xmlDump.append("g:width=\"" + width + "\" "); } if (height != null && height != -1) { xmlDump.append("g:height=\"" + height + "\" "); } } }
@Override public void writeNode(Node node, StringBuilder xmlDump, int metaDataType) { CatchLinkNode linkNode = (CatchLinkNode) node; writeNode("intermediateCatchEvent", linkNode, xmlDump, metaDataType); xmlDump.append(">" + EOL); writeExtensionElements(linkNode, xmlDump); String name = (String) node.getMetaData().get( IntermediateCatchEventHandler.LINK_NAME); xmlDump.append("<linkEventDefinition name=\"" + name + "\" >" + EOL); Object target = linkNode.getMetaData("target"); if (null != target) { xmlDump.append(String.format("<target>%s</target>", target) + EOL); } xmlDump.append("</linkEventDefinition>" + EOL); endNode("intermediateCatchEvent", xmlDump); }
String nodeId = (String) node.getMetaData().get("UniqueId"); String waitForCompletionString = ((Element) xmlNode).getAttribute("waitForCompletion"); boolean waitForCompletion = true;
protected void visitConnectionsAndAssociations(Node node, StringBuilder xmlDump, int metaDataType) { // add associations List<Connection> connections = getSubConnections((CompositeNode) node); xmlDump.append(" <!-- connections -->" + EOL); for (Connection connection: connections) { XmlBPMNProcessDumper.INSTANCE.visitConnection(connection, xmlDump, metaDataType); } // add associations List<Association> associations = (List<Association>) node.getMetaData().get(ProcessHandler.ASSOCIATIONS); if( associations != null ) { for (Association association : associations ) { XmlBPMNProcessDumper.INSTANCE.visitAssociation(association, xmlDump); } } }
@Override public void writeNode(Node node, StringBuilder xmlDump, int metaDataType) { ThrowLinkNode linkNode = (ThrowLinkNode) node; writeNode("intermediateThrowEvent", linkNode, xmlDump, metaDataType); xmlDump.append(">" + EOL); writeExtensionElements(node, xmlDump); String name = (String) node.getMetaData().get( IntermediateThrowEventHandler.LINK_NAME); xmlDump.append("<linkEventDefinition name=\"" + name + "\" >" + EOL); List<String> sources = (List<String>) linkNode .getMetaData(IntermediateThrowEventHandler.LINK_SOURCE); if (null != sources) { for (String s : sources) { xmlDump.append(String.format("<source>%s</source>", s) + EOL); } } xmlDump.append("</linkEventDefinition>" + EOL); endNode("intermediateThrowEvent", xmlDump); } }
public Map<String, Object> getMetaData() { if (parent instanceof Node) { return ((Node) parent).getMetaData(); } else if (parent instanceof RuleFlowProcess) { return ((RuleFlowProcess) parent).getMetaData(); } else if (parent instanceof Variable) { return ((Variable) parent).getMetaData(); } else if (parent instanceof SequenceFlow) { return ((SequenceFlow) parent).getMetaData(); } else if(parent instanceof Lane) { return ((Lane) parent).getMetaData(); } else { throw new IllegalArgumentException("Unknown parent " + parent); } } public DataType getType() {
public void writeNode(Node node, StringBuilder xmlDump, int metaDataType) { CompositeContextNode compositeNode = (CompositeContextNode) node; String nodeType = "subProcess"; if (node.getMetaData().get("Transaction") != null) { nodeType = "transaction";
@Test public void testNestedCompensationBoundaryEventSpecific() throws Exception { String processId = "org.jbpm.process.compensation.boundary.nested"; String[] workItemNames = { "Don-Quixote", "Sancho", "Ricote" }; List<String> eventList = new ArrayList<String>(); RuleFlowProcess process = createNestedCompensationBoundaryEventProcess(processId, workItemNames, eventList); // run process ksession = createKieSession(process); Node compensatedNode = findNode(process, "work-comp-1"); String compensationEvent = (String) compensatedNode.getMetaData().get("UniqueId"); runCompensationBoundaryEventSpecificTest(ksession, process, processId, workItemNames, eventList, compensationEvent); }
@Test public void testCompensationBoundaryEventSpecific() throws Exception { String processId = "org.jbpm.process.compensation.boundary"; String[] workItemNames = { "Don-Quixote", "Sancho", "Ricote" }; List<String> eventList = new ArrayList<String>(); RuleFlowProcess process = createCompensationBoundaryEventProcess(processId, workItemNames, eventList); // run process ksession = createKieSession(process); Node compensatedNode = findNode(process, "work1"); String compensationEvent = (String) compensatedNode.getMetaData().get("UniqueId"); runCompensationBoundaryEventSpecificTest(ksession, process, processId, workItemNames, eventList, compensationEvent); }
String uniqueId = (String) node.getMetaData().get("UniqueId"); forEachNode.setMetaData("UniqueId", uniqueId); node.setMetaData("UniqueId", uniqueId + ":" + uniqueIdGen++); Map<String, String> dataInputs = (Map<String, String>) orignalNode.getMetaData().remove("DataInputs"); Map<String, String> dataOutputs = (Map<String, String>) orignalNode.getMetaData().remove("DataOutputs");
@Test public void testNestedCompensationEventSubProcessGeneral() throws Exception { String processId = "org.jbpm.process.compensation.event.subprocess.general"; String[] workItemNames = { "apple", "banana", "orange" }; List<String> eventList = new ArrayList<String>(); RuleFlowProcess process = createNestedCompensationEventSubProcessProcess(processId, workItemNames, eventList); Node toCompensateNode = findNode(process, "sub0"); String compensationEvent = CompensationScope.IMPLICIT_COMPENSATION_PREFIX + toCompensateNode.getMetaData().get("UniqueId"); ksession = createKieSession(process); runCompensationEventSubProcessGeneralTest(ksession, process, processId, workItemNames, eventList, compensationEvent); }
@Test public void testCompensationEventSubProcessSpecific() throws Exception { String processId = "org.jbpm.process.compensation.event.subprocess"; String[] workItemNames = { "kwik", "kwek", "kwak" }; List<String> eventList = new ArrayList<String>(); RuleFlowProcess process = createCompensationEventSubProcessProcess(processId, workItemNames, eventList); Node toCompensateNode = findNode(process, "sub0"); String compensationEvent = (String) toCompensateNode.getMetaData().get("UniqueId"); // run process ksession = createKieSession(process); runCompensationEventSubProcessSpecificTest(ksession, process, processId, workItemNames, eventList, compensationEvent); }
@Test public void testNestedCompensationEventSubProcessSpecific() throws Exception { String processId = "org.jbpm.process.compensation.event.nested.subprocess"; String[] workItemNames = { "kwik", "kwek", "kwak" }; List<String> eventList = new ArrayList<String>(); RuleFlowProcess process = createNestedCompensationEventSubProcessProcess(processId, workItemNames, eventList); Node toCompensateNode = findNode(process, "sub1"); String compensationEvent = (String) toCompensateNode.getMetaData().get("UniqueId"); ksession = createKieSession(process); runCompensationEventSubProcessSpecificTest(ksession, process, processId, workItemNames, eventList, compensationEvent); }
@Test public void testNestedCompensationBoundaryEventGeneral() throws Exception { String processId = "org.jbpm.process.compensation.boundary.general.nested"; String[] workItemNames = { "Jip", "Janneke", "Takkie" }; List<String> eventList = new ArrayList<String>(); RuleFlowProcess process = createNestedCompensationBoundaryEventProcess(processId, workItemNames, eventList); // run process ksession = createKieSession(process); Node toCompensateNode = findNode(process, "sub2"); String compensationEvent = CompensationScope.IMPLICIT_COMPENSATION_PREFIX + (String) toCompensateNode.getMetaData().get("UniqueId"); runCompensationBoundaryEventGeneralTest(ksession, process, processId, workItemNames, eventList, compensationEvent); }
public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { final Element element = parser.endElementBuilder(); Node node = (Node) parser.getCurrent(); ProcessBuildData buildData = (ProcessBuildData) parser.getData(); Map<String, PlanItem> planItems = (Map<String, PlanItem>) buildData.getMetaData("PlanItems"); PlanItem planItem = planItems.get(node.getMetaData().get("UniqueId")); if (planItem != null && planItem.getEntryCriterion() != null) { if ("autostart".equalsIgnoreCase(planItem.getEntryCriterion().getExpression())) { node.setMetaData("customAutoStart", "true"); } else { node.setMetaData("customActivationExpression", planItem.getEntryCriterion().getExpression()); node.setMetaData("customActivationFragmentName", node.getName()); } } handleNode(node, element, uri, localName, parser); NodeContainer nodeContainer = (NodeContainer) parser.getParent(); nodeContainer.addNode(node); ((ProcessBuildData) parser.getData()).addNode(node); return node; }
String nodeName = xmlNode.getNodeName(); if ("multiInstanceLoopCharacteristics".equals(nodeName)) { Boolean isAsync = Boolean.parseBoolean((String)node.getMetaData().get("customAsync"));
String attachedTo = (String) attachedToNode.getMetaData().get("UniqueId"); boundaryNode.setMetaData("AttachedTo", attachedTo); boundaryNode.setAttachedToNodeId(attachedTo);