use of io.automatiko.engine.workflow.process.core.node.ForEachNode in project automatiko-engine by automatiko-io.
the class CallActivityHandler method handleForEachNode.
protected void handleForEachNode(final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
ForEachNode forEachNode = (ForEachNode) node;
org.w3c.dom.Node xmlNode = element.getFirstChild();
while (xmlNode != null) {
String nodeName = xmlNode.getNodeName();
if ("dataInputAssociation".equals(nodeName)) {
readDataInputAssociation(xmlNode, inputAssociation);
} else if ("dataOutputAssociation".equals(nodeName)) {
readDataOutputAssociation(xmlNode, outputAssociation);
} else if ("multiInstanceLoopCharacteristics".equals(nodeName)) {
readMultiInstanceLoopCharacteristics(xmlNode, forEachNode, parser);
}
xmlNode = xmlNode.getNextSibling();
}
}
use of io.automatiko.engine.workflow.process.core.node.ForEachNode in project automatiko-engine by automatiko-io.
the class BusinessRuleTaskHandler method handleForEachNode.
protected void handleForEachNode(final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) {
ForEachNode forEachNode = (ForEachNode) node;
org.w3c.dom.Node xmlNode = element.getFirstChild();
while (xmlNode != null) {
String nodeName = xmlNode.getNodeName();
if ("dataInputAssociation".equals(nodeName)) {
readDataInputAssociation(xmlNode, inputAssociation);
} else if ("dataOutputAssociation".equals(nodeName)) {
readDataOutputAssociation(xmlNode, outputAssociation);
} else if ("multiInstanceLoopCharacteristics".equals(nodeName)) {
readMultiInstanceLoopCharacteristics(xmlNode, forEachNode, parser);
}
xmlNode = xmlNode.getNextSibling();
}
}
use of io.automatiko.engine.workflow.process.core.node.ForEachNode in project automatiko-engine by automatiko-io.
the class ScriptTaskHandler method end.
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();
int uniqueIdGen = 1;
while (xmlNode != null) {
String nodeName = xmlNode.getNodeName();
if ("multiInstanceLoopCharacteristics".equals(nodeName)) {
// create new timerNode
ForEachNode forEachNode = new ForEachNode();
forEachNode.setId(node.getId());
String uniqueId = (String) node.getMetaData().get("UniqueId");
forEachNode.setMetaData("UniqueId", uniqueId);
node.setMetaData("UniqueId", uniqueId + ":" + uniqueIdGen++);
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);
forEachNode.setSequential(Boolean.parseBoolean(((Element) xmlNode).getAttribute("isSequential")));
Node orignalNode = node;
node = forEachNode;
handleForEachNode(node, element, uri, localName, parser);
// remove input/output collection data input/output of for each to avoid problems when running in variable strict mode
if (orignalNode instanceof ActionNode) {
adjustNodeConfiguration(orignalNode, forEachNode);
}
break;
}
xmlNode = xmlNode.getNextSibling();
}
NodeContainer nodeContainer = (NodeContainer) parser.getParent();
nodeContainer.addNode(node);
((ProcessBuildData) parser.getData()).addNode(node);
return node;
}
use of io.automatiko.engine.workflow.process.core.node.ForEachNode in project automatiko-engine by automatiko-io.
the class ForEachNodeHandler method writeNode.
public void writeNode(Node node, StringBuilder xmlDump, int metaDataType) {
ForEachNode forEachNode = (ForEachNode) node;
writeNode("subProcess", forEachNode, xmlDump, metaDataType);
xmlDump.append(" >" + EOL);
writeExtensionElements(node, xmlDump);
// ioSpecification and dataInputAssociation
xmlDump.append(" <ioSpecification>" + EOL);
String parameterName = forEachNode.getVariableName();
if (parameterName != null) {
xmlDump.append(" <dataInput id=\"" + XmlBPMNProcessDumper.getUniqueNodeId(forEachNode) + "_input\" name=\"MultiInstanceInput\" />" + EOL);
}
xmlDump.append(" <inputSet/>" + EOL + " <outputSet/>" + EOL + " </ioSpecification>" + EOL);
String collectionExpression = forEachNode.getCollectionExpression();
if (collectionExpression != null) {
xmlDump.append(" <dataInputAssociation>" + EOL + " <sourceRef>" + XmlDumper.replaceIllegalChars(collectionExpression) + "</sourceRef>" + EOL + " <targetRef>" + XmlBPMNProcessDumper.getUniqueNodeId(forEachNode) + "_input</targetRef>" + EOL + " </dataInputAssociation>" + EOL);
}
// multiInstanceLoopCharacteristics
xmlDump.append(" <multiInstanceLoopCharacteristics>" + EOL + " <loopDataInputRef>" + XmlBPMNProcessDumper.getUniqueNodeId(forEachNode) + "_input</loopDataInputRef>" + EOL);
if (parameterName != null) {
xmlDump.append(" <inputDataItem id=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(parameterName) + "\" itemSubjectRef=\"" + XmlBPMNProcessDumper.getUniqueNodeId(forEachNode) + "_multiInstanceItemType\"/>" + EOL);
}
xmlDump.append(" </multiInstanceLoopCharacteristics>" + EOL);
// nodes
List<Node> subNodes = getSubNodes(forEachNode);
XmlBPMNProcessDumper.INSTANCE.visitNodes(subNodes, xmlDump, metaDataType);
// connections
visitConnectionsAndAssociations(forEachNode, xmlDump, metaDataType);
endNode("subProcess", xmlDump);
}
use of io.automatiko.engine.workflow.process.core.node.ForEachNode in project automatiko-engine by automatiko-io.
the class BPMNPlaneHandler method postProcessNodeOffset.
private void postProcessNodeOffset(Node[] nodes, int xOffset, int yOffset) {
for (Node node : nodes) {
Integer x = (Integer) node.getMetaData().get("x");
Integer y = (Integer) node.getMetaData().get("y");
if (x != null) {
((io.automatiko.engine.workflow.process.core.Node) node).setMetaData("x", x - xOffset);
}
if (y != null) {
((io.automatiko.engine.workflow.process.core.Node) node).setMetaData("y", y - yOffset);
}
if (node instanceof ForEachNode) {
postProcessNodeOffset(((NodeContainer) node).getNodes(), xOffset, yOffset);
} else {
if (node instanceof NodeContainer) {
postProcessNodeOffset(((NodeContainer) node).getNodes(), xOffset + (x == null ? 0 : x), yOffset + (y == null ? 0 : y));
}
}
}
}
Aggregations