Search in sources :

Example 11 with ForEachNode

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();
    }
}
Also used : ForEachNode(io.automatiko.engine.workflow.process.core.node.ForEachNode)

Example 12 with ForEachNode

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();
    }
}
Also used : ForEachNode(io.automatiko.engine.workflow.process.core.node.ForEachNode)

Example 13 with ForEachNode

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;
}
Also used : ProcessBuildData(io.automatiko.engine.workflow.compiler.xml.ProcessBuildData) Element(org.w3c.dom.Element) ForEachNode(io.automatiko.engine.workflow.process.core.node.ForEachNode) ActionNode(io.automatiko.engine.workflow.process.core.node.ActionNode) Node(io.automatiko.engine.workflow.process.core.Node) ActionNode(io.automatiko.engine.workflow.process.core.node.ActionNode) ForEachNode(io.automatiko.engine.workflow.process.core.node.ForEachNode) NodeContainer(io.automatiko.engine.workflow.process.core.NodeContainer)

Example 14 with ForEachNode

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);
}
Also used : ForEachNode(io.automatiko.engine.workflow.process.core.node.ForEachNode) CompositeNode(io.automatiko.engine.workflow.process.core.node.CompositeNode) Node(io.automatiko.engine.workflow.process.core.Node) ForEachNode(io.automatiko.engine.workflow.process.core.node.ForEachNode)

Example 15 with ForEachNode

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));
            }
        }
    }
}
Also used : ForEachNode(io.automatiko.engine.workflow.process.core.node.ForEachNode) Node(io.automatiko.engine.api.definition.process.Node) ForEachNode(io.automatiko.engine.workflow.process.core.node.ForEachNode) NodeContainer(io.automatiko.engine.api.definition.process.NodeContainer)

Aggregations

ForEachNode (io.automatiko.engine.workflow.process.core.node.ForEachNode)18 Node (io.automatiko.engine.workflow.process.core.Node)6 ProcessBuildData (io.automatiko.engine.workflow.compiler.xml.ProcessBuildData)5 NodeContainer (io.automatiko.engine.workflow.process.core.NodeContainer)5 CompositeNode (io.automatiko.engine.workflow.process.core.node.CompositeNode)5 Element (org.w3c.dom.Element)5 Node (io.automatiko.engine.api.definition.process.Node)4 ActionNode (io.automatiko.engine.workflow.process.core.node.ActionNode)4 StartNode (io.automatiko.engine.workflow.process.core.node.StartNode)4 WorkItemNode (io.automatiko.engine.workflow.process.core.node.WorkItemNode)4 List (java.util.List)4 ObjectDataType (io.automatiko.engine.workflow.base.core.datatype.impl.type.ObjectDataType)3 EndNode (io.automatiko.engine.workflow.process.core.node.EndNode)3 EventNode (io.automatiko.engine.workflow.process.core.node.EventNode)3 EventSubProcessNode (io.automatiko.engine.workflow.process.core.node.EventSubProcessNode)3 FaultNode (io.automatiko.engine.workflow.process.core.node.FaultNode)3 RuleSetNode (io.automatiko.engine.workflow.process.core.node.RuleSetNode)3 SubProcessNode (io.automatiko.engine.workflow.process.core.node.SubProcessNode)3 Work (io.automatiko.engine.workflow.base.core.Work)2 EventTypeFilter (io.automatiko.engine.workflow.base.core.event.EventTypeFilter)2