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);
}
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);
}
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;
}
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);
}
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);
}
Aggregations