use of io.automatiko.engine.workflow.compiler.xml.ProcessBuildData in project automatiko-engine by automatiko-io.
the class IntermediateThrowEventHandler method handleEscalationNode.
@SuppressWarnings("unchecked")
public void handleEscalationNode(final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
ActionNode actionNode = (ActionNode) node;
org.w3c.dom.Node xmlNode = element.getFirstChild();
while (xmlNode != null) {
String nodeName = xmlNode.getNodeName();
if ("dataInputAssociation".equals(nodeName)) {
readDataInputAssociation(xmlNode, actionNode, parser);
} else if ("escalationEventDefinition".equals(nodeName)) {
String escalationRef = ((Element) xmlNode).getAttribute("escalationRef");
if (escalationRef != null && escalationRef.trim().length() > 0) {
Map<String, Escalation> escalations = (Map<String, Escalation>) ((ProcessBuildData) parser.getData()).getMetaData(ProcessHandler.ESCALATIONS);
if (escalations == null) {
throw new IllegalArgumentException("No escalations found");
}
Escalation escalation = escalations.get(escalationRef);
if (escalation == null) {
throw new IllegalArgumentException("Could not find escalation " + escalationRef);
}
String faultName = escalation.getEscalationCode();
String variable = (String) actionNode.getMetaData(MAPPING_VARIABLE_KEY);
ConsequenceAction action = createJavaAction(new HandleEscalationAction(faultName, variable));
actionNode.setAction(action);
actionNode.setMetaData("TriggerType", "Escalation");
} else {
throw new IllegalArgumentException("General escalation is not yet supported");
}
}
xmlNode = xmlNode.getNextSibling();
}
}
use of io.automatiko.engine.workflow.compiler.xml.ProcessBuildData in project automatiko-engine by automatiko-io.
the class Bpmn2ImportHandler method start.
public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException {
parser.startElementBuilder(localName, attrs);
final String type = attrs.getValue("importType");
final String location = attrs.getValue("location");
final String namespace = attrs.getValue("namespace");
ProcessBuildData buildData = (ProcessBuildData) parser.getData();
if (type != null && location != null && namespace != null) {
List<Bpmn2Import> typedImports = (List<Bpmn2Import>) buildData.getMetaData("Bpmn2Imports");
if (typedImports == null) {
typedImports = new ArrayList<Bpmn2Import>();
buildData.setMetaData("Bpmn2Imports", typedImports);
}
typedImports.add(new Bpmn2Import(type, location, namespace));
}
return null;
}
use of io.automatiko.engine.workflow.compiler.xml.ProcessBuildData in project automatiko-engine by automatiko-io.
the class BusinessRuleTaskHandler 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
handleNode(node, element, uri, localName, parser);
org.w3c.dom.Node xmlNode = element.getFirstChild();
int uniqueIdGen = 1;
while (xmlNode != null) {
String nodeName = xmlNode.getNodeName();
if ("multiInstanceLoopCharacteristics".equals(nodeName)) {
// create new timerNode
ForEachNode forEachNode = new ForEachNode();
forEachNode.setId(node.getId());
String uniqueId = (String) node.getMetaData().get("UniqueId");
forEachNode.setMetaData("UniqueId", uniqueId);
node.setMetaData("UniqueId", uniqueId + ":" + uniqueIdGen++);
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.setSequential(Boolean.parseBoolean(((Element) xmlNode).getAttribute("isSequential")));
Node orignalNode = node;
node = forEachNode;
handleForEachNode(node, element, uri, localName, parser);
// remove input/output collection data input/output of for each to avoid problems when running in variable strict mode
if (orignalNode instanceof RuleSetNode) {
adjustNodeConfiguration(orignalNode, forEachNode);
}
break;
}
xmlNode = xmlNode.getNextSibling();
}
NodeContainer nodeContainer = (NodeContainer) parser.getParent();
nodeContainer.addNode(node);
((ProcessBuildData) parser.getData()).addNode(node);
return node;
}
use of io.automatiko.engine.workflow.compiler.xml.ProcessBuildData in project automatiko-engine by automatiko-io.
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 io.automatiko.engine.workflow.compiler.xml.ProcessBuildData in project automatiko-engine by automatiko-io.
the class ProcessHandler method start.
public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException {
parser.startElementBuilder(localName, attrs);
final String id = attrs.getValue("id");
final String name = attrs.getValue("name");
final String version = attrs.getValue("version");
final String type = attrs.getValue("type");
final String packageName = attrs.getValue("package-name");
final String routerLayout = attrs.getValue("routerLayout");
ExecutableProcess process = new ExecutableProcess();
process.setId(id);
process.setName(name);
process.setVersion(version);
process.setType(type);
process.setPackageName(packageName);
if (routerLayout != null) {
process.setMetaData("routerLayout", new Integer(routerLayout));
}
((ProcessBuildData) parser.getData()).addProcess(process);
return process;
}
Aggregations