Search in sources :

Example 21 with SequenceFlow

use of io.automatiko.engine.workflow.bpmn2.core.SequenceFlow in project automatiko-engine by automatiko-io.

the class SubProcessHandler 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
    boolean found = false;
    org.w3c.dom.Node xmlNode = element.getFirstChild();
    while (xmlNode != null) {
        String nodeName = xmlNode.getNodeName();
        if ("multiInstanceLoopCharacteristics".equals(nodeName)) {
            Boolean isAsync = Boolean.parseBoolean((String) node.getMetaData().get("customAsync"));
            // create new timerNode
            ForEachNode forEachNode = new ForEachNode();
            forEachNode.setId(node.getId());
            forEachNode.setName(node.getName());
            forEachNode.setSequential(Boolean.parseBoolean(((Element) xmlNode).getAttribute("isSequential")));
            forEachNode.setAutoComplete(((CompositeContextNode) node).isAutoComplete());
            // for (io.automatiko.engine.api.definition.process.Node subNode : ((CompositeContextNode) node)
            // .getNodes()) {
            // 
            // forEachNode.addNode(subNode);
            // }
            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.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());
            List<SequenceFlow> connections = (List<SequenceFlow>) ((CompositeContextNode) node).getMetaData(ProcessHandler.CONNECTIONS);
            ProcessHandler processHandler = new ProcessHandler();
            processHandler.linkConnections((io.automatiko.engine.api.definition.process.NodeContainer) node, connections);
            processHandler.linkBoundaryEvents((io.automatiko.engine.api.definition.process.NodeContainer) node);
            node = forEachNode;
            handleForEachNode(node, element, uri, localName, parser, isAsync);
            found = true;
            break;
        }
        xmlNode = xmlNode.getNextSibling();
    }
    if (!found) {
        handleCompositeContextNode(node, element, uri, localName, parser);
    }
    NodeContainer nodeContainer = (NodeContainer) parser.getParent();
    nodeContainer.addNode(node);
    ((ProcessBuildData) parser.getData()).addNode(node);
    return node;
}
Also used : SequenceFlow(io.automatiko.engine.workflow.bpmn2.core.SequenceFlow) Element(org.w3c.dom.Element) ForEachNode(io.automatiko.engine.workflow.process.core.node.ForEachNode) EventSubProcessNode(io.automatiko.engine.workflow.process.core.node.EventSubProcessNode) CompositeContextNode(io.automatiko.engine.workflow.process.core.node.CompositeContextNode) StartNode(io.automatiko.engine.workflow.process.core.node.StartNode) Node(io.automatiko.engine.workflow.process.core.Node) NodeContainer(io.automatiko.engine.workflow.process.core.NodeContainer) ProcessBuildData(io.automatiko.engine.workflow.compiler.xml.ProcessBuildData) ForEachNode(io.automatiko.engine.workflow.process.core.node.ForEachNode) List(java.util.List) VariableScope(io.automatiko.engine.workflow.base.core.context.variable.VariableScope)

Aggregations

List (java.util.List)15 SequenceFlow (org.jbpm.bpmn2.core.SequenceFlow)13 SequenceFlow (io.automatiko.engine.workflow.bpmn2.core.SequenceFlow)7 ArrayList (java.util.ArrayList)6 Association (org.jbpm.bpmn2.core.Association)5 RuleFlowProcess (org.jbpm.ruleflow.core.RuleFlowProcess)4 CompositeContextNode (org.jbpm.workflow.core.node.CompositeContextNode)4 CompositeNode (org.jbpm.workflow.core.node.CompositeNode)4 Association (io.automatiko.engine.workflow.bpmn2.core.Association)3 IntermediateLink (org.jbpm.bpmn2.core.IntermediateLink)3 NodeContainer (org.jbpm.workflow.core.NodeContainer)3 EventSubProcessNode (org.jbpm.workflow.core.node.EventSubProcessNode)3 StartNode (org.jbpm.workflow.core.node.StartNode)3 Element (org.w3c.dom.Element)3 CompositeContextNode (io.automatiko.engine.workflow.process.core.node.CompositeContextNode)2 CompositeNode (io.automatiko.engine.workflow.process.core.node.CompositeNode)2 ExecutableProcess (io.automatiko.engine.workflow.process.executable.core.ExecutableProcess)2 EventFilter (org.jbpm.process.core.event.EventFilter)2 EventTypeFilter (org.jbpm.process.core.event.EventTypeFilter)2 Connection (org.jbpm.workflow.core.Connection)2