use of org.jbpm.workflow.core.Node in project jbpm by kiegroup.
the class AbstractNodeHandler 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();
handleNode(node, element, uri, localName, parser);
NodeContainer nodeContainer = (NodeContainer) parser.getParent();
nodeContainer.addNode(node);
((ProcessBuildData) parser.getData()).addNode(node);
return node;
}
use of org.jbpm.workflow.core.Node in project jbpm by kiegroup.
the class AbstractNodeHandler method getErrorIdForErrorCode.
protected String getErrorIdForErrorCode(String errorCode, Node node) {
org.kie.api.definition.process.NodeContainer parent = node.getNodeContainer();
while (!(parent instanceof RuleFlowProcess) && parent instanceof Node) {
parent = ((Node) parent).getNodeContainer();
}
if (!(parent instanceof RuleFlowProcess)) {
throw new RuntimeException("This should never happen: !(parent instanceof RuleFlowProcess): parent is " + parent.getClass().getSimpleName());
}
List<Error> errors = ((Definitions) ((RuleFlowProcess) parent).getMetaData("Definitions")).getErrors();
Error error = null;
for (Error listError : errors) {
if (errorCode.equals(listError.getErrorCode())) {
error = listError;
break;
} else if (errorCode.equals(listError.getId())) {
error = listError;
break;
}
}
if (error == null) {
throw new IllegalArgumentException("Could not find error with errorCode " + errorCode);
}
return error.getId();
}
use of org.jbpm.workflow.core.Node in project jbpm by kiegroup.
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 org.jbpm.workflow.core.Node in project jbpm by kiegroup.
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>();
RuleFlowProcess process = createCompensationEventSubProcessProcess(processId, workItemNames, eventList);
Node toCompensateNode = findNode(process, "sub0");
String compensationEvent = (String) toCompensateNode.getMetaData().get("UniqueId");
// run process
ksession = createKieSession(process);
runCompensationEventSubProcessSpecificTest(ksession, process, processId, workItemNames, eventList, compensationEvent);
}
use of org.jbpm.workflow.core.Node in project jbpm by kiegroup.
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>();
RuleFlowProcess process = createNestedCompensationBoundaryEventProcess(processId, workItemNames, eventList);
// run process
ksession = createKieSession(process);
Node compensatedNode = findNode(process, "work-comp-1");
String compensationEvent = (String) compensatedNode.getMetaData().get("UniqueId");
runCompensationBoundaryEventSpecificTest(ksession, process, processId, workItemNames, eventList, compensationEvent);
}
Aggregations