Search in sources :

Example 16 with ProcessBuildData

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;
}
Also used : ProcessBuildData(org.jbpm.compiler.xml.ProcessBuildData) Element(org.w3c.dom.Element) ForEachNode(org.jbpm.workflow.core.node.ForEachNode) ActionNode(org.jbpm.workflow.core.node.ActionNode) EndNode(org.jbpm.workflow.core.node.EndNode) EventNode(org.jbpm.workflow.core.node.EventNode) Node(org.jbpm.workflow.core.Node) NodeContainer(org.jbpm.workflow.core.NodeContainer)

Example 17 with ProcessBuildData

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;
}
Also used : ProcessBuildData(org.jbpm.compiler.xml.ProcessBuildData) List(java.util.List) ArrayList(java.util.ArrayList)

Example 18 with ProcessBuildData

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;
}
Also used : FaultNode(org.jbpm.workflow.core.node.FaultNode) ProcessBuildData(org.jbpm.compiler.xml.ProcessBuildData) Element(org.w3c.dom.Element) EndNode(org.jbpm.workflow.core.node.EndNode) Node(org.jbpm.workflow.core.Node) FaultNode(org.jbpm.workflow.core.node.FaultNode) NodeContainer(org.jbpm.workflow.core.NodeContainer)

Example 19 with ProcessBuildData

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;
}
Also used : ProcessBuildData(org.jbpm.compiler.xml.ProcessBuildData) Error(org.jbpm.bpmn2.core.Error)

Example 20 with ProcessBuildData

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;
}
Also used : CatchLinkNode(org.jbpm.workflow.core.node.CatchLinkNode) ProcessBuildData(org.jbpm.compiler.xml.ProcessBuildData) Element(org.w3c.dom.Element) CompositeNode(org.jbpm.workflow.core.node.CompositeNode) TimerNode(org.jbpm.workflow.core.node.TimerNode) StateNode(org.jbpm.workflow.core.node.StateNode) CatchLinkNode(org.jbpm.workflow.core.node.CatchLinkNode) EventNode(org.jbpm.workflow.core.node.EventNode) Node(org.jbpm.workflow.core.Node) StateNode(org.jbpm.workflow.core.node.StateNode) NodeContainer(org.jbpm.workflow.core.NodeContainer) TimerNode(org.jbpm.workflow.core.node.TimerNode)

Aggregations

ProcessBuildData (org.jbpm.compiler.xml.ProcessBuildData)28 Map (java.util.Map)12 Element (org.w3c.dom.Element)11 Node (org.jbpm.workflow.core.Node)8 NodeContainer (org.jbpm.workflow.core.NodeContainer)8 HashMap (java.util.HashMap)7 List (java.util.List)7 ArrayList (java.util.ArrayList)5 RuleFlowProcess (org.jbpm.ruleflow.core.RuleFlowProcess)4 ActionNode (org.jbpm.workflow.core.node.ActionNode)4 ForEachNode (org.jbpm.workflow.core.node.ForEachNode)4 Error (org.jbpm.bpmn2.core.Error)3 Escalation (org.jbpm.bpmn2.core.Escalation)3 ItemDefinition (org.jbpm.bpmn2.core.ItemDefinition)3 DroolsConsequenceAction (org.jbpm.workflow.core.impl.DroolsConsequenceAction)3 EndNode (org.jbpm.workflow.core.node.EndNode)3 EventNode (org.jbpm.workflow.core.node.EventNode)3 FaultNode (org.jbpm.workflow.core.node.FaultNode)3 WorkItemNode (org.jbpm.workflow.core.node.WorkItemNode)3 Message (org.jbpm.bpmn2.core.Message)2