use of org.jbpm.workflow.core.impl.IOSpecification in project kogito-runtimes by kiegroup.
the class AbstractNodeHandler method readCatchSpecification.
protected IOSpecification readCatchSpecification(ExtensibleXmlParser parser, Element element) {
IOSpecification ioSpec = new IOSpecification();
ioSpec.getDataOutputs().addAll(readDataOutput(parser, element));
org.w3c.dom.Node xmlNode = element.getFirstChild();
while (xmlNode != null) {
String nodeName = xmlNode.getNodeName();
if ("dataOutputAssociation".equals(nodeName)) {
readDataAssociation(parser, (Element) xmlNode, id -> ioSpec.getDataOutput().get(id), id -> getVariableDataSpec(parser, id)).ifPresent(e -> ioSpec.getDataOutputAssociation().add(e));
}
xmlNode = xmlNode.getNextSibling();
}
return ioSpec;
}
use of org.jbpm.workflow.core.impl.IOSpecification in project kogito-runtimes by kiegroup.
the class AbstractNodeHandler method readIOEspecification.
protected IOSpecification readIOEspecification(ExtensibleXmlParser parser, Element element) {
org.w3c.dom.Node xmlNode = element.getFirstChild();
IOSpecification ioSpec = new IOSpecification();
while (xmlNode != null) {
String nodeName = xmlNode.getNodeName();
if ("ioSpecification".equals(nodeName)) {
ioSpec.getDataInputs().addAll(readDataInput(parser, xmlNode));
ioSpec.getDataOutputs().addAll(readDataOutput(parser, xmlNode));
} else if ("dataInputAssociation".equals(nodeName)) {
readDataAssociation(parser, (Element) xmlNode, id -> getVariableDataSpec(parser, id), id -> ioSpec.getDataInput().get(id)).ifPresent(e -> ioSpec.getDataInputAssociation().add(e));
} else if ("dataOutputAssociation".equals(nodeName)) {
readDataAssociation(parser, (Element) xmlNode, id -> ioSpec.getDataOutput().get(id), id -> getVariableDataSpec(parser, id)).ifPresent(e -> ioSpec.getDataOutputAssociation().add(e));
}
xmlNode = xmlNode.getNextSibling();
}
return ioSpec;
}
use of org.jbpm.workflow.core.impl.IOSpecification in project kogito-runtimes by kiegroup.
the class EndEventHandler method handleNode.
@Override
protected Node handleNode(Node newNode, Element element, String uri, String localName, ExtensibleXmlParser parser) throws SAXException {
NodeImpl node = (NodeImpl) newNode;
// determine type of event definition, so the correct type of node
// can be generated
super.handleNode(node, element, uri, localName, parser);
// all nodes are catch nodes but error and escalation
IOSpecification ioSpecification = readThrowSpecification(parser, element);
org.w3c.dom.Node xmlNode = element.getFirstChild();
while (xmlNode != null) {
String nodeName = xmlNode.getNodeName();
if ("terminateEventDefinition".equals(nodeName)) {
setThrowVariable(ioSpecification, node);
handleTerminateNode(node, element, uri, localName, parser);
break;
} else if ("signalEventDefinition".equals(nodeName)) {
setThrowVariable(ioSpecification, node);
handleSignalNode(node, element, uri, localName, parser);
} else if ("messageEventDefinition".equals(nodeName)) {
setThrowVariable(ioSpecification, node);
handleMessageNode(node, element, uri, localName, parser);
} else if ("errorEventDefinition".equals(nodeName)) {
FaultNode faultNode = new FaultNode();
faultNode.setId(node.getId());
faultNode.setName(node.getName());
faultNode.setTerminateParent(true);
faultNode.setMetaData("UniqueId", node.getMetaData().get("UniqueId"));
node = faultNode;
setThrowVariable(ioSpecification, node);
faultNode.setFaultVariable((String) node.getMetaData().get(Metadata.VARIABLE));
super.handleNode(node, element, uri, localName, parser);
handleErrorNode(node, element, uri, localName, parser);
break;
} else if ("escalationEventDefinition".equals(nodeName)) {
FaultNode faultNode = new FaultNode();
faultNode.setId(node.getId());
faultNode.setName(node.getName());
faultNode.setMetaData("UniqueId", node.getMetaData().get("UniqueId"));
node = faultNode;
setThrowVariable(ioSpecification, node);
faultNode.setFaultVariable((String) node.getMetaData().get(Metadata.VARIABLE));
super.handleNode(node, element, uri, localName, parser);
handleEscalationNode(node, element, uri, localName, parser);
break;
} else if ("compensateEventDefinition".equals(nodeName)) {
setThrowVariable(ioSpecification, node);
handleThrowCompensationEventNode(node, element, uri, localName, parser);
break;
}
xmlNode = xmlNode.getNextSibling();
}
if (node.getName() == null) {
node.setName("End");
}
return node;
}
use of org.jbpm.workflow.core.impl.IOSpecification in project kogito-runtimes by kiegroup.
the class IntermediateCatchEventHandler method handleNode.
@Override
protected Node handleNode(Node newNode, Element element, String uri, String localName, ExtensibleXmlParser parser) throws SAXException {
NodeImpl node = (NodeImpl) newNode;
// determine type of event definition, so the correct type of node
// can be generated
IOSpecification ioSpecification = readCatchSpecification(parser, element);
org.w3c.dom.Node xmlNode = element.getFirstChild();
while (xmlNode != null) {
String nodeName = xmlNode.getNodeName();
if ("signalEventDefinition".equals(nodeName)) {
// reuse already created EventNode
setCatchVariable(ioSpecification, node);
handleSignalNode(node, element, uri, localName, parser);
node.setMetaData(EVENT_TYPE, EVENT_TYPE_SIGNAL);
break;
} else if ("messageEventDefinition".equals(nodeName)) {
// reuse already created EventNode
setCatchVariable(ioSpecification, node);
handleMessageNode(node, element, uri, localName, parser);
node.setMetaData(EVENT_TYPE, EVENT_TYPE_MESSAGE);
break;
} else if ("timerEventDefinition".equals(nodeName)) {
// create new timerNode
TimerNode timerNode = new TimerNode();
timerNode.setId(node.getId());
timerNode.setName(node.getName());
timerNode.setMetaData("UniqueId", node.getMetaData().get("UniqueId"));
node = timerNode;
setCatchVariable(ioSpecification, node);
node.setMetaData(EVENT_TYPE, EVENT_TYPE_TIMER);
handleTimerNode(node, element, uri, localName, parser);
break;
} else if ("conditionalEventDefinition".equals(nodeName)) {
// create new stateNode
StateNode stateNode = new StateNode();
stateNode.setId(node.getId());
stateNode.setName(node.getName());
stateNode.setMetaData("UniqueId", node.getMetaData().get("UniqueId"));
node = stateNode;
setCatchVariable(ioSpecification, node);
node.setMetaData(EVENT_TYPE, EVENT_TYPE_CONDITIONAL);
handleStateNode(node, element, uri, localName, parser);
break;
} else if ("linkEventDefinition".equals(nodeName)) {
CatchLinkNode linkNode = new CatchLinkNode();
linkNode.setId(node.getId());
node = linkNode;
setCatchVariable(ioSpecification, node);
node.setMetaData(EVENT_TYPE, EVENT_TYPE_LINK);
handleLinkNode(element, node, xmlNode, parser);
break;
}
xmlNode = xmlNode.getNextSibling();
}
return node;
}
use of org.jbpm.workflow.core.impl.IOSpecification in project kogito-runtimes by kiegroup.
the class IntermediateThrowEventHandler method handleNode.
@Override
protected Node handleNode(Node newNode, Element element, String uri, String localName, ExtensibleXmlParser parser) throws SAXException {
Node node = newNode;
IOSpecification ioSpecification = readThrowSpecification(parser, element);
org.w3c.dom.Node xmlNode = element.getFirstChild();
while (xmlNode != null) {
String nodeName = xmlNode.getNodeName();
if ("signalEventDefinition".equals(nodeName)) {
// reuse already created ActionNode
setThrowVariable(ioSpecification, node);
handleSignalNode(node, element, uri, localName, parser);
break;
} else if ("messageEventDefinition".equals(nodeName)) {
// reuse already created ActionNode
setThrowVariable(ioSpecification, node);
handleMessageNode(node, element, uri, localName, parser);
break;
} else if ("escalationEventDefinition".equals(nodeName)) {
// reuse already created ActionNode
setThrowVariable(ioSpecification, node);
handleEscalationNode(node, element, uri, localName, parser);
break;
} else if ("compensateEventDefinition".equals(nodeName)) {
// reuse already created ActionNode
setThrowVariable(ioSpecification, node);
handleThrowCompensationEventNode(node, element, uri, localName, parser);
break;
} else if ("linkEventDefinition".equals(nodeName)) {
ThrowLinkNode linkNode = new ThrowLinkNode();
linkNode.setId(node.getId());
node = linkNode;
setThrowVariable(ioSpecification, node);
handleLinkNode(element, node, xmlNode, parser);
}
xmlNode = xmlNode.getNextSibling();
}
if (node instanceof ActionNode) {
ActionNode actionNode = (ActionNode) node;
if (actionNode.getAction() == null) {
actionNode.setAction(new DroolsConsequenceAction("java", ""));
actionNode.setMetaData("NodeType", "IntermediateThrowEvent-None");
}
}
return node;
}
Aggregations