Search in sources :

Example 21 with Node

use of io.automatiko.engine.workflow.process.core.Node in project automatiko-engine by automatiko-io.

the class CompensationTest method testNestedCompensationEventSubProcessGeneral.

@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>();
    ExecutableProcess process = createNestedCompensationEventSubProcessProcess(processId, workItemNames, eventList);
    Node toCompensateNode = findNode(process, "sub0");
    String compensationEvent = CompensationScope.IMPLICIT_COMPENSATION_PREFIX + toCompensateNode.getMetaData().get("UniqueId");
    ksession = createProcessRuntime(process);
    runCompensationEventSubProcessGeneralTest(ksession, process, processId, workItemNames, eventList, compensationEvent);
}
Also used : CompositeNode(io.automatiko.engine.workflow.process.core.node.CompositeNode) CompositeContextNode(io.automatiko.engine.workflow.process.core.node.CompositeContextNode) BoundaryEventNode(io.automatiko.engine.workflow.process.core.node.BoundaryEventNode) Node(io.automatiko.engine.workflow.process.core.Node) ActionNode(io.automatiko.engine.workflow.process.core.node.ActionNode) EventSubProcessNode(io.automatiko.engine.workflow.process.core.node.EventSubProcessNode) WorkItemNode(io.automatiko.engine.workflow.process.core.node.WorkItemNode) StartNode(io.automatiko.engine.workflow.process.core.node.StartNode) EndNode(io.automatiko.engine.workflow.process.core.node.EndNode) ArrayList(java.util.ArrayList) ExecutableProcess(io.automatiko.engine.workflow.process.executable.core.ExecutableProcess) AbstractBaseTest(io.automatiko.engine.workflow.test.util.AbstractBaseTest) Test(org.junit.jupiter.api.Test)

Example 22 with Node

use of io.automatiko.engine.workflow.process.core.Node in project automatiko-engine by automatiko-io.

the class CompensationTest method testNestedCompensationBoundaryEventSpecific.

@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>();
    ExecutableProcess process = createNestedCompensationBoundaryEventProcess(processId, workItemNames, eventList);
    // run process
    ksession = createProcessRuntime(process);
    Node compensatedNode = findNode(process, "work-comp-1");
    String compensationEvent = (String) compensatedNode.getMetaData().get("UniqueId");
    runCompensationBoundaryEventSpecificTest(ksession, process, processId, workItemNames, eventList, compensationEvent);
}
Also used : CompositeNode(io.automatiko.engine.workflow.process.core.node.CompositeNode) CompositeContextNode(io.automatiko.engine.workflow.process.core.node.CompositeContextNode) BoundaryEventNode(io.automatiko.engine.workflow.process.core.node.BoundaryEventNode) Node(io.automatiko.engine.workflow.process.core.Node) ActionNode(io.automatiko.engine.workflow.process.core.node.ActionNode) EventSubProcessNode(io.automatiko.engine.workflow.process.core.node.EventSubProcessNode) WorkItemNode(io.automatiko.engine.workflow.process.core.node.WorkItemNode) StartNode(io.automatiko.engine.workflow.process.core.node.StartNode) EndNode(io.automatiko.engine.workflow.process.core.node.EndNode) ArrayList(java.util.ArrayList) ExecutableProcess(io.automatiko.engine.workflow.process.executable.core.ExecutableProcess) AbstractBaseTest(io.automatiko.engine.workflow.test.util.AbstractBaseTest) Test(org.junit.jupiter.api.Test)

Example 23 with Node

use of io.automatiko.engine.workflow.process.core.Node in project automatiko-engine by automatiko-io.

the class BoundaryEventHandler 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();
    String attachedTo = element.getAttribute("attachedToRef");
    Attr cancelActivityAttr = element.getAttributeNode("cancelActivity");
    boolean cancelActivity = true;
    if (cancelActivityAttr != null) {
        cancelActivity = Boolean.parseBoolean(cancelActivityAttr.getValue());
    }
    // determine type of event definition, so the correct type of node can be
    // generated
    org.w3c.dom.Node xmlNode = element.getFirstChild();
    while (xmlNode != null) {
        String nodeName = xmlNode.getNodeName();
        if ("escalationEventDefinition".equals(nodeName)) {
            // reuse already created EventNode
            handleEscalationNode(node, element, uri, localName, parser, attachedTo, cancelActivity);
            node.setMetaData(EVENT_TYPE, "escalation");
            break;
        } else if ("errorEventDefinition".equals(nodeName)) {
            // reuse already created EventNode
            handleErrorNode(node, element, uri, localName, parser, attachedTo, cancelActivity);
            node.setMetaData(EVENT_TYPE, "error");
            break;
        } else if ("timerEventDefinition".equals(nodeName)) {
            // reuse already created EventNode
            handleTimerNode(node, element, uri, localName, parser, attachedTo, cancelActivity);
            node.setMetaData(EVENT_TYPE, "timer");
            break;
        } else if ("compensateEventDefinition".equals(nodeName)) {
            // reuse already created EventNode
            handleCompensationNode(node, element, uri, localName, parser, attachedTo, cancelActivity);
            node.setMetaData(EVENT_TYPE, "compensation");
            break;
        } else if ("signalEventDefinition".equals(nodeName)) {
            // reuse already created EventNode
            handleSignalNode(node, element, uri, localName, parser, attachedTo, cancelActivity);
            node.setMetaData(EVENT_TYPE, "signal");
            break;
        } else if ("conditionalEventDefinition".equals(nodeName)) {
            handleConditionNode(node, element, uri, localName, parser, attachedTo, cancelActivity);
            node.setMetaData(EVENT_TYPE, "condition");
            break;
        } else if ("messageEventDefinition".equals(nodeName)) {
            handleMessageNode(node, element, uri, localName, parser, attachedTo, cancelActivity);
            node.setMetaData(EVENT_TYPE, "message");
            break;
        }
        xmlNode = xmlNode.getNextSibling();
    }
    node.setMetaData("DataOutputs", new LinkedHashMap<String, String>(dataOutputTypes));
    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) BoundaryEventNode(io.automatiko.engine.workflow.process.core.node.BoundaryEventNode) Node(io.automatiko.engine.workflow.process.core.Node) EventNode(io.automatiko.engine.workflow.process.core.node.EventNode) NodeContainer(io.automatiko.engine.workflow.process.core.NodeContainer) Attr(org.w3c.dom.Attr)

Example 24 with Node

use of io.automatiko.engine.workflow.process.core.Node in project automatiko-engine by automatiko-io.

the class ServerlessWorkflowParser method produceEvents.

protected void produceEvents(List<ProduceEvent> events, ServerlessWorkflowFactory factory, Workflow workflow, AtomicLong ids, NodeContainer container, long startNodeId, long endNodeId) {
    Node prevNode = null;
    Node currentNode = null;
    for (ProduceEvent event : events) {
        currentNode = factory.produceMessageNode(ids.getAndIncrement(), "produceEvent_" + startNodeId, workflow, event, container);
        if (prevNode != null) {
            factory.connect(prevNode.getId(), currentNode.getId(), "connect_" + prevNode.getId() + "_" + currentNode.getId(), container, false);
        } else {
            factory.connect(startNodeId, currentNode.getId(), "connect_" + startNodeId + "_" + currentNode.getId(), container, false);
        }
        prevNode = currentNode;
    }
    factory.connect(prevNode.getId(), endNodeId, "connect_" + prevNode.getId() + "_" + endNodeId, container, false);
}
Also used : ProduceEvent(io.serverlessworkflow.api.produce.ProduceEvent) TimerNode(io.automatiko.engine.workflow.process.core.node.TimerNode) CompositeContextNode(io.automatiko.engine.workflow.process.core.node.CompositeContextNode) ActionNode(io.automatiko.engine.workflow.process.core.node.ActionNode) WorkItemNode(io.automatiko.engine.workflow.process.core.node.WorkItemNode) SubProcessNode(io.automatiko.engine.workflow.process.core.node.SubProcessNode) BoundaryEventNode(io.automatiko.engine.workflow.process.core.node.BoundaryEventNode) Node(io.automatiko.engine.workflow.process.core.Node) StartNode(io.automatiko.engine.workflow.process.core.node.StartNode) EndNode(io.automatiko.engine.workflow.process.core.node.EndNode) EventNode(io.automatiko.engine.workflow.process.core.node.EventNode)

Example 25 with Node

use of io.automatiko.engine.workflow.process.core.Node in project automatiko-engine by automatiko-io.

the class CompensationTest method testCompensationEventSubProcessSpecific.

@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>();
    ExecutableProcess process = createCompensationEventSubProcessProcess(processId, workItemNames, eventList);
    Node toCompensateNode = findNode(process, "sub0");
    String compensationEvent = (String) toCompensateNode.getMetaData().get("UniqueId");
    // run process
    ksession = createProcessRuntime(process);
    runCompensationEventSubProcessSpecificTest(ksession, process, processId, workItemNames, eventList, compensationEvent);
}
Also used : CompositeNode(io.automatiko.engine.workflow.process.core.node.CompositeNode) CompositeContextNode(io.automatiko.engine.workflow.process.core.node.CompositeContextNode) BoundaryEventNode(io.automatiko.engine.workflow.process.core.node.BoundaryEventNode) Node(io.automatiko.engine.workflow.process.core.Node) ActionNode(io.automatiko.engine.workflow.process.core.node.ActionNode) EventSubProcessNode(io.automatiko.engine.workflow.process.core.node.EventSubProcessNode) WorkItemNode(io.automatiko.engine.workflow.process.core.node.WorkItemNode) StartNode(io.automatiko.engine.workflow.process.core.node.StartNode) EndNode(io.automatiko.engine.workflow.process.core.node.EndNode) ArrayList(java.util.ArrayList) ExecutableProcess(io.automatiko.engine.workflow.process.executable.core.ExecutableProcess) AbstractBaseTest(io.automatiko.engine.workflow.test.util.AbstractBaseTest) Test(org.junit.jupiter.api.Test)

Aggregations

Node (io.automatiko.engine.workflow.process.core.Node)36 ActionNode (io.automatiko.engine.workflow.process.core.node.ActionNode)19 EndNode (io.automatiko.engine.workflow.process.core.node.EndNode)19 CompositeContextNode (io.automatiko.engine.workflow.process.core.node.CompositeContextNode)16 StartNode (io.automatiko.engine.workflow.process.core.node.StartNode)16 WorkItemNode (io.automatiko.engine.workflow.process.core.node.WorkItemNode)16 BoundaryEventNode (io.automatiko.engine.workflow.process.core.node.BoundaryEventNode)15 ArrayList (java.util.ArrayList)14 NodeContainer (io.automatiko.engine.workflow.process.core.NodeContainer)13 EventSubProcessNode (io.automatiko.engine.workflow.process.core.node.EventSubProcessNode)13 ExecutableProcess (io.automatiko.engine.workflow.process.executable.core.ExecutableProcess)13 CompositeNode (io.automatiko.engine.workflow.process.core.node.CompositeNode)12 ProcessBuildData (io.automatiko.engine.workflow.compiler.xml.ProcessBuildData)11 Element (org.w3c.dom.Element)11 EventNode (io.automatiko.engine.workflow.process.core.node.EventNode)10 ForEachNode (io.automatiko.engine.workflow.process.core.node.ForEachNode)10 AbstractBaseTest (io.automatiko.engine.workflow.test.util.AbstractBaseTest)8 Test (org.junit.jupiter.api.Test)8 SubProcessNode (io.automatiko.engine.workflow.process.core.node.SubProcessNode)6 TimerNode (io.automatiko.engine.workflow.process.core.node.TimerNode)6