use of org.jbpm.compiler.xml.ProcessBuildData 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.compiler.xml.ProcessBuildData in project jbpm by kiegroup.
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 org.jbpm.compiler.xml.ProcessBuildData in project jbpm by kiegroup.
the class EndEventHandler 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
super.handleNode(node, element, uri, localName, parser);
org.w3c.dom.Node xmlNode = element.getFirstChild();
while (xmlNode != null) {
String nodeName = xmlNode.getNodeName();
if ("terminateEventDefinition".equals(nodeName)) {
// reuse already created EndNode
handleTerminateNode(node, element, uri, localName, parser);
break;
} else if ("signalEventDefinition".equals(nodeName)) {
handleSignalNode(node, element, uri, localName, parser);
} else if ("messageEventDefinition".equals(nodeName)) {
handleMessageNode(node, element, uri, localName, parser);
} else if ("errorEventDefinition".equals(nodeName)) {
// create new faultNode
FaultNode faultNode = new FaultNode();
faultNode.setId(node.getId());
faultNode.setName(node.getName());
faultNode.setTerminateParent(true);
faultNode.setMetaData("UniqueId", node.getMetaData().get("UniqueId"));
node = faultNode;
super.handleNode(node, element, uri, localName, parser);
handleErrorNode(node, element, uri, localName, parser);
break;
} else if ("escalationEventDefinition".equals(nodeName)) {
// create new faultNode
FaultNode faultNode = new FaultNode();
faultNode.setId(node.getId());
faultNode.setName(node.getName());
faultNode.setMetaData("UniqueId", node.getMetaData().get("UniqueId"));
node = faultNode;
super.handleNode(node, element, uri, localName, parser);
handleEscalationNode(node, element, uri, localName, parser);
break;
} else if ("compensateEventDefinition".equals(nodeName)) {
// reuse already created ActionNode
handleThrowCompensationEventNode(node, element, uri, localName, parser);
break;
}
xmlNode = xmlNode.getNextSibling();
}
NodeContainer nodeContainer = (NodeContainer) parser.getParent();
nodeContainer.addNode(node);
((ProcessBuildData) parser.getData()).addNode(node);
return node;
}
use of org.jbpm.compiler.xml.ProcessBuildData in project jbpm by kiegroup.
the class ErrorHandler method start.
@SuppressWarnings("unchecked")
public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException {
parser.startElementBuilder(localName, attrs);
String id = attrs.getValue("id");
String errorCode = attrs.getValue("errorCode");
String structureRef = attrs.getValue("structureRef");
Definitions definitions = (Definitions) parser.getParent();
List<Error> errors = definitions.getErrors();
if (errors == null) {
errors = new ArrayList<Error>();
definitions.setErrors(errors);
((ProcessBuildData) parser.getData()).setMetaData("Errors", errors);
}
Error e = new Error(id, errorCode, structureRef);
errors.add(e);
return e;
}
use of org.jbpm.compiler.xml.ProcessBuildData in project jbpm by kiegroup.
the class IntermediateCatchEventHandler 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
org.w3c.dom.Node xmlNode = element.getFirstChild();
while (xmlNode != null) {
String nodeName = xmlNode.getNodeName();
if ("signalEventDefinition".equals(nodeName)) {
// reuse already created EventNode
handleSignalNode(node, element, uri, localName, parser);
break;
} else if ("messageEventDefinition".equals(nodeName)) {
// reuse already created EventNode
handleMessageNode(node, element, uri, localName, parser);
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;
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;
handleStateNode(node, element, uri, localName, parser);
break;
} else if ("linkEventDefinition".equals(nodeName)) {
CatchLinkNode linkNode = new CatchLinkNode();
linkNode.setId(node.getId());
node = linkNode;
handleLinkNode(element, node, xmlNode, parser);
break;
}
xmlNode = xmlNode.getNextSibling();
}
NodeContainer nodeContainer = (NodeContainer) parser.getParent();
nodeContainer.addNode(node);
((ProcessBuildData) parser.getData()).addNode(node);
return node;
}
Aggregations