Search in sources :

Example 16 with SequenceFlow

use of io.automatiko.engine.workflow.bpmn2.core.SequenceFlow in project jbpm by kiegroup.

the class ProcessHandler method end.

@SuppressWarnings("unchecked")
public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
    parser.endElementBuilder();
    RuleFlowProcess process = (RuleFlowProcess) parser.getCurrent();
    List<IntermediateLink> throwLinks = (List<IntermediateLink>) process.getMetaData(LINKS);
    linkIntermediateLinks(process, throwLinks);
    List<SequenceFlow> connections = (List<SequenceFlow>) process.getMetaData(CONNECTIONS);
    linkConnections(process, connections);
    linkBoundaryEvents(process);
    // This must be done *after* linkConnections(process, connections)
    // because it adds hidden connections for compensations
    List<Association> associations = (List<Association>) process.getMetaData(ASSOCIATIONS);
    linkAssociations((Definitions) process.getMetaData("Definitions"), process, associations);
    List<Lane> lanes = (List<Lane>) process.getMetaData(LaneHandler.LANES);
    assignLanes(process, lanes);
    postProcessNodes(process, process);
    postProcessCollaborations(process, parser);
    return process;
}
Also used : RuleFlowProcess(org.jbpm.ruleflow.core.RuleFlowProcess) Association(org.jbpm.bpmn2.core.Association) SequenceFlow(org.jbpm.bpmn2.core.SequenceFlow) Lane(org.jbpm.bpmn2.core.Lane) List(java.util.List) ArrayList(java.util.ArrayList) IntermediateLink(org.jbpm.bpmn2.core.IntermediateLink)

Example 17 with SequenceFlow

use of io.automatiko.engine.workflow.bpmn2.core.SequenceFlow in project jbpm by kiegroup.

the class SequenceFlowHandler method end.

public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
    final Element element = parser.endElementBuilder();
    SequenceFlow sequenceFlow = (SequenceFlow) parser.getCurrent();
    org.w3c.dom.Node xmlNode = element.getFirstChild();
    while (xmlNode != null) {
        String nodeName = xmlNode.getNodeName();
        if ("conditionExpression".equals(nodeName)) {
            String expression = xmlNode.getTextContent();
            org.w3c.dom.Node languageNode = xmlNode.getAttributes().getNamedItem("language");
            if (languageNode != null) {
                String language = languageNode.getNodeValue();
                if (XmlBPMNProcessDumper.JAVA_LANGUAGE.equals(language)) {
                    sequenceFlow.setLanguage("java");
                } else if (XmlBPMNProcessDumper.MVEL_LANGUAGE.equals(language)) {
                    sequenceFlow.setLanguage("mvel");
                } else if (XmlBPMNProcessDumper.RULE_LANGUAGE.equals(language)) {
                    sequenceFlow.setType("rule");
                } else if (XmlBPMNProcessDumper.XPATH_LANGUAGE.equals(language)) {
                    sequenceFlow.setLanguage("XPath");
                } else if (XmlBPMNProcessDumper.JAVASCRIPT_LANGUAGE.equals(language)) {
                    sequenceFlow.setLanguage("JavaScript");
                } else if (XmlBPMNProcessDumper.FEEL_LANGUAGE.equals(language)) {
                    sequenceFlow.setLanguage("FEEL");
                } else {
                    throw new IllegalArgumentException("Unknown language " + language);
                }
            }
            sequenceFlow.setExpression(expression);
        }
        xmlNode = xmlNode.getNextSibling();
    }
    return sequenceFlow;
}
Also used : SequenceFlow(org.jbpm.bpmn2.core.SequenceFlow) Element(org.w3c.dom.Element)

Example 18 with SequenceFlow

use of io.automatiko.engine.workflow.bpmn2.core.SequenceFlow in project kogito-runtimes by kiegroup.

the class SequenceFlowHandler method end.

public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
    final Element element = parser.endElementBuilder();
    SequenceFlow sequenceFlow = (SequenceFlow) parser.getCurrent();
    org.w3c.dom.Node xmlNode = element.getFirstChild();
    while (xmlNode != null) {
        String nodeName = xmlNode.getNodeName();
        if ("conditionExpression".equals(nodeName)) {
            String expression = xmlNode.getTextContent();
            org.w3c.dom.Node languageNode = xmlNode.getAttributes().getNamedItem("language");
            if (languageNode != null) {
                String language = languageNode.getNodeValue();
                if (XmlBPMNProcessDumper.JAVA_LANGUAGE.equals(language)) {
                    sequenceFlow.setLanguage("java");
                } else if (XmlBPMNProcessDumper.MVEL_LANGUAGE.equals(language)) {
                    sequenceFlow.setLanguage("mvel");
                } else if (XmlBPMNProcessDumper.RULE_LANGUAGE.equals(language)) {
                    sequenceFlow.setType("rule");
                } else if (XmlBPMNProcessDumper.XPATH_LANGUAGE.equals(language)) {
                    sequenceFlow.setLanguage("XPath");
                } else if (XmlBPMNProcessDumper.FEEL_LANGUAGE.equals(language) || XmlBPMNProcessDumper.DMN_FEEL_LANGUAGE.equals(language)) {
                    sequenceFlow.setLanguage("FEEL");
                } else {
                    throw new ProcessParsingValidationException("Unknown language " + language);
                }
            }
            sequenceFlow.setExpression(expression);
        }
        xmlNode = xmlNode.getNextSibling();
    }
    return sequenceFlow;
}
Also used : SequenceFlow(org.jbpm.bpmn2.core.SequenceFlow) Element(org.w3c.dom.Element)

Example 19 with SequenceFlow

use of io.automatiko.engine.workflow.bpmn2.core.SequenceFlow in project automatiko-engine by automatiko-io.

the class AdHocSubProcessHandler method handleNode.

@SuppressWarnings("unchecked")
@Override
protected void handleNode(final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
    super.handleNode(node, element, uri, localName, parser);
    DynamicNode dynamicNode = (DynamicNode) node;
    String cancelRemainingInstances = element.getAttribute("cancelRemainingInstances");
    if ("false".equals(cancelRemainingInstances)) {
        dynamicNode.setCancelRemainingInstances(false);
    }
    // by default it should not autocomplete as it's adhoc
    org.w3c.dom.Node xmlNode = element.getFirstChild();
    dynamicNode.setActivationCondition((String) node.getMetaData().get(CUSTOM_ACTIVATION_CONDITION));
    while (xmlNode != null) {
        String nodeName = xmlNode.getNodeName();
        if (COMPLETION_CONDITION.equals(nodeName)) {
            String expression = xmlNode.getTextContent();
            if (AUTOCOMPLETE_EXPRESSIONS.contains(expression)) {
                dynamicNode.setAutoComplete(true);
            } else {
                dynamicNode.setCompletionCondition(expression);
            }
        }
        xmlNode = xmlNode.getNextSibling();
    }
    List<SequenceFlow> connections = (List<SequenceFlow>) dynamicNode.getMetaData(ProcessHandler.CONNECTIONS);
    ProcessHandler processHandler = new ProcessHandler();
    processHandler.linkConnections(dynamicNode, connections);
    processHandler.linkBoundaryEvents(dynamicNode);
    handleScript(dynamicNode, element, "onEntry");
    handleScript(dynamicNode, element, "onExit");
}
Also used : SequenceFlow(io.automatiko.engine.workflow.bpmn2.core.SequenceFlow) DynamicNode(io.automatiko.engine.workflow.process.core.node.DynamicNode) List(java.util.List)

Example 20 with SequenceFlow

use of io.automatiko.engine.workflow.bpmn2.core.SequenceFlow in project automatiko-engine by automatiko-io.

the class SubProcessHandler method handleCompositeContextNode.

@SuppressWarnings("unchecked")
protected void handleCompositeContextNode(final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
    super.handleNode(node, element, uri, localName, parser);
    CompositeContextNode compositeNode = (CompositeContextNode) node;
    List<SequenceFlow> connections = (List<SequenceFlow>) compositeNode.getMetaData(ProcessHandler.CONNECTIONS);
    handleScript(compositeNode, element, "onEntry");
    handleScript(compositeNode, element, "onExit");
    List<IntermediateLink> throwLinks = (List<IntermediateLink>) compositeNode.getMetaData(ProcessHandler.LINKS);
    ProcessHandler.linkIntermediateLinks(compositeNode, throwLinks);
    ProcessHandler processHandler = new ProcessHandler();
    processHandler.linkConnections(compositeNode, connections);
    processHandler.linkBoundaryEvents(compositeNode);
    // This must be done *after* linkConnections(process, connections)
    // because it adds hidden connections for compensations
    List<Association> associations = (List<Association>) compositeNode.getMetaData(ProcessHandler.ASSOCIATIONS);
    ProcessHandler.linkAssociations((Definitions) compositeNode.getMetaData("Definitions"), compositeNode, associations);
// TODO: do we fully support interruping ESP's?
/**
 * for( org.kie.api.definition.process.Node subNode : compositeNode.getNodes() )
 * { if( subNode instanceof StartNode ) { if( ! ((StartNode)
 * subNode).isInterrupting() ) { throw new
 * IllegalArgumentException("Non-interrupting event subprocesses are not yet
 * fully supported." ); } } }
 */
}
Also used : Association(io.automatiko.engine.workflow.bpmn2.core.Association) CompositeContextNode(io.automatiko.engine.workflow.process.core.node.CompositeContextNode) SequenceFlow(io.automatiko.engine.workflow.bpmn2.core.SequenceFlow) List(java.util.List) IntermediateLink(io.automatiko.engine.workflow.bpmn2.core.IntermediateLink)

Aggregations

List (java.util.List)15 SequenceFlow (org.jbpm.bpmn2.core.SequenceFlow)13 SequenceFlow (io.automatiko.engine.workflow.bpmn2.core.SequenceFlow)7 ArrayList (java.util.ArrayList)6 Association (org.jbpm.bpmn2.core.Association)5 RuleFlowProcess (org.jbpm.ruleflow.core.RuleFlowProcess)4 CompositeContextNode (org.jbpm.workflow.core.node.CompositeContextNode)4 CompositeNode (org.jbpm.workflow.core.node.CompositeNode)4 Association (io.automatiko.engine.workflow.bpmn2.core.Association)3 IntermediateLink (org.jbpm.bpmn2.core.IntermediateLink)3 NodeContainer (org.jbpm.workflow.core.NodeContainer)3 EventSubProcessNode (org.jbpm.workflow.core.node.EventSubProcessNode)3 StartNode (org.jbpm.workflow.core.node.StartNode)3 Element (org.w3c.dom.Element)3 CompositeContextNode (io.automatiko.engine.workflow.process.core.node.CompositeContextNode)2 CompositeNode (io.automatiko.engine.workflow.process.core.node.CompositeNode)2 ExecutableProcess (io.automatiko.engine.workflow.process.executable.core.ExecutableProcess)2 EventFilter (org.jbpm.process.core.event.EventFilter)2 EventTypeFilter (org.jbpm.process.core.event.EventTypeFilter)2 Connection (org.jbpm.workflow.core.Connection)2