if ("multiInstanceLoopCharacteristics".equals(nodeName)) { ForEachNode forEachNode = new ForEachNode(); forEachNode.setId(node.getId()); String uniqueId = (String) node.getMetaData().get("UniqueId"); forEachNode.setMetaData("UniqueId", uniqueId); node.setMetaData("UniqueId", uniqueId + ":" + uniqueIdGen++); 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); ((SubProcessNode)orignalNode).adjustOutMapping(forEachNode.getOutputCollectionExpression()); Map<String, String> dataOutputs = (Map<String, String>) orignalNode.getMetaData().remove("DataOutputs"); orignalNode.setMetaData("MICollectionOutput", dataOutputs.get(((ForEachNode)node).getMetaData("MICollectionOutput"))); orignalNode.setMetaData("MICollectionInput", dataInputs.get(((ForEachNode)node).getMetaData("MICollectionInput")));
@Override public void addContext(Context context) { getCompositeNode().addContext(context); ((AbstractContext) context).setContextContainer(getCompositeNode()); }
forEachNode.setVariable(variableName, dataType); forEachNode.setOutputVariable(variableName, dataType); collectionName = dataOutputs.get(outputDataRef); forEachNode.setOutputCollectionExpression(collectionName); forEachNode.setMetaData("MICollectionOutput", outputDataRef); collectionName = dataInputs.get(inputDataRef); forEachNode.setCollectionExpression(collectionName); forEachNode.setMetaData("MICollectionInput", inputDataRef); forEachNode.setCompletionConditionExpression(expression);
public ForEachNodeFactory(RuleFlowNodeContainerFactory nodeContainerFactory, NodeContainer nodeContainer, long id) { this.nodeContainerFactory = nodeContainerFactory; this.nodeContainer = nodeContainer; ForEachNode forEachNode = new ForEachNode(); forEachNode.setId(id); setNodeContainer(forEachNode); }
protected void writeAttributes(CompositeNode compositeNode, StringBuilder xmlDump, boolean includeMeta) { ForEachNode forEachNode = (ForEachNode) compositeNode; String variableName = forEachNode.getVariableName(); if (variableName != null) { xmlDump.append("variableName=\"" + variableName + "\" "); } String collectionExpression = forEachNode.getCollectionExpression(); if (collectionExpression != null) { xmlDump.append("collectionExpression=\"" + XmlDumper.replaceIllegalChars(collectionExpression) + "\" "); } boolean waitForCompletion = forEachNode.isWaitForCompletion(); if (!waitForCompletion) { xmlDump.append("waitForCompletion=\"false\" "); } }
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); ForEachNode forEachNode = (ForEachNode) node; final String variableName = element.getAttribute("variableName"); if (variableName != null && variableName.length() != 0) { forEachNode.setVariable(variableName, new ObjectDataType()); } final String collectionExpression = element.getAttribute("collectionExpression"); if (collectionExpression != null && collectionExpression.length() != 0) { forEachNode.setCollectionExpression(collectionExpression); } final String waitForCompletion = element.getAttribute("waitForCompletion"); if ("false".equals(waitForCompletion)) { forEachNode.setWaitForCompletion(false); } }
endNode.setId(2); process.addNode(endNode); ForEachNode forEachNode = new ForEachNode(); forEachNode.setName("ForEach"); forEachNode.setId(3); forEachNode.setCollectionExpression("persons"); personDataType = new ObjectDataType(); personDataType.setClassName("org.drools.Person"); forEachNode.addNode(actionNode); forEachNode.linkIncomingConnections( Node.CONNECTION_DEFAULT_TYPE, actionNode.getId(), Node.CONNECTION_DEFAULT_TYPE); forEachNode.linkOutgoingConnections( actionNode.getId(), Node.CONNECTION_DEFAULT_TYPE, Node.CONNECTION_DEFAULT_TYPE); forEachNode.setVariable("child", personDataType);
new ConnectionImpl(humanTaskNode, Node.CONNECTION_DEFAULT_TYPE, timerNode, Node.CONNECTION_DEFAULT_TYPE); ForEachNode forEachNode = new ForEachNode(); forEachNode.setName("ForEach"); forEachNode.setCollectionExpression("collection"); forEachNode.setVariable("variableName", new ObjectDataType()); forEachNode.setWaitForCompletion(false); ActionNode subActionNode1 = new ActionNode(); forEachNode.getCompositeNode().addNode(subActionNode1); ActionNode subActionNode2 = new ActionNode(); forEachNode.getCompositeNode().addNode(subActionNode2); new ConnectionImpl(subActionNode1, Node.CONNECTION_DEFAULT_TYPE, subActionNode2, Node.CONNECTION_DEFAULT_TYPE); forEachNode.getCompositeNode().linkIncomingConnections(Node.CONNECTION_DEFAULT_TYPE, subActionNode1.getId(), Node.CONNECTION_DEFAULT_TYPE); forEachNode.getCompositeNode().linkOutgoingConnections(subActionNode2.getId(), Node.CONNECTION_DEFAULT_TYPE, Node.CONNECTION_DEFAULT_TYPE); process.addNode(forEachNode); new ConnectionImpl(timerNode, Node.CONNECTION_DEFAULT_TYPE, forEachNode, Node.CONNECTION_DEFAULT_TYPE);
Boolean isAsync = Boolean.parseBoolean((String)node.getMetaData().get("customAsync")); ForEachNode forEachNode = new ForEachNode(); forEachNode.setId(node.getId()); forEachNode.setName(node.getName()); forEachNode.setAutoComplete(((CompositeContextNode) node).isAutoComplete()); 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, isAsync);
compositeNode.setId(2); ForEachNode forEachNode = new ForEachNode(); ForEachNode.ForEachSplitNode split = new ForEachNode.ForEachSplitNode(); split.setName("ForEachSplit"); split.setMetaData("hidden", true); split.setMetaData("UniqueId", forEachNode.getMetaData("Uniqueid") + ":foreach:split"); forEachNode.internalAddNode(split); forEachNode.linkIncomingConnections( org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE, new CompositeNode.NodeAndType(split, org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE));
String variableName = forEachNode.getVariableName(); if (variableName == null || "".equals(variableName)) { addErrorMessage(process, "ForEach has no variable name"); String collectionExpression = forEachNode.getCollectionExpression(); if (collectionExpression == null || "".equals(collectionExpression)) { addErrorMessage(process, "ForEach has no collection expression"); if (forEachNode.getDefaultIncomingConnections().size() == 0 && !acceptsNoIncomingConnections(node)) { addErrorMessage(process, node, if (forEachNode.getDefaultOutgoingConnections().size() == 0 && !acceptsNoOutgoingConnections(node)) { addErrorMessage(process, node, final List<Node> start = RuleFlowProcess.getStartNodes(forEachNode.getNodes()); if (start != null) { for (Node s : start) { validateNodes(forEachNode.getNodes(), errors, process);
split.setName("ForEachSplit"); split.setMetaData("hidden", true); split.setMetaData("UniqueId", getMetaData("Uniqueid") + ":foreach:split"); super.addNode(split); super.linkIncomingConnections( compositeNode.setName("ForEachComposite"); compositeNode.setMetaData("hidden", true); compositeNode.setMetaData("UniqueId", getMetaData("Uniqueid") + ":foreach:composite"); super.addNode(compositeNode); VariableScope variableScope = new VariableScope(); join.setName("ForEachJoin"); join.setMetaData("hidden", true); join.setMetaData("UniqueId", getMetaData("Uniqueid") + ":foreach:join"); super.addNode(join); super.linkOutgoingConnections( new ConnectionImpl( super.getNode(1), org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE, getCompositeNode(), org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE ); new ConnectionImpl( getCompositeNode(), org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE, super.getNode(3), org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE );
protected Node createNode() { return new ForEachNode(); }
public RuleFlowNodeContainerFactory done() { if (linkedIncomingNodeId != -1) { getForEachNode().linkIncomingConnections( Node.CONNECTION_DEFAULT_TYPE, linkedIncomingNodeId, Node.CONNECTION_DEFAULT_TYPE); } if (linkedOutgoingNodeId != -1) { getForEachNode().linkOutgoingConnections( linkedOutgoingNodeId, Node.CONNECTION_DEFAULT_TYPE, Node.CONNECTION_DEFAULT_TYPE); } nodeContainer.addNode(getForEachNode()); return nodeContainerFactory; }
String parameterName = forEachNode.getVariableName(); if (parameterName != null) { xmlDump.append( " <outputSet/>" + EOL + " </ioSpecification>" + EOL); String collectionExpression = forEachNode.getCollectionExpression(); if (collectionExpression != null) { xmlDump.append(
public ForEachNodeFactory variable(String variableName, DataType dataType) { getForEachNode().setVariable(variableName, dataType); return this; }
public ForEachNodeFactory collectionExpression(String collectionExpression) { getForEachNode().setCollectionExpression(collectionExpression); return this; }
forEachNode.getMetaData(ProcessHandler.CONNECTIONS); ProcessHandler.linkConnections(forEachNode, connections); ProcessHandler.linkBoundaryEvents(forEachNode); List<Association> associations = (List<Association>) forEachNode.getMetaData(ProcessHandler.ASSOCIATIONS); ProcessHandler.linkAssociations((Definitions) forEachNode.getMetaData("Definitions"), forEachNode, associations); applyAsync(node, isAsync);
Boolean isAsync = Boolean.parseBoolean((String)node.getMetaData().get("customAsync")); ForEachNode forEachNode = new ForEachNode(); forEachNode.setId(node.getId()); forEachNode.setName(node.getName()); forEachNode.setAutoComplete(((CompositeContextNode) node).isAutoComplete()); 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, isAsync);
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); ForEachNode forEachNode = (ForEachNode) node; final String variableName = element.getAttribute("variableName"); if (variableName != null && variableName.length() != 0) { forEachNode.setVariable(variableName, new ObjectDataType()); } final String collectionExpression = element.getAttribute("collectionExpression"); if (collectionExpression != null && collectionExpression.length() != 0) { forEachNode.setCollectionExpression(collectionExpression); } final String waitForCompletion = element.getAttribute("waitForCompletion"); if ("false".equals(waitForCompletion)) { forEachNode.setWaitForCompletion(false); } }