Search in sources :

Example 11 with ActionNode

use of org.jbpm.workflow.core.node.ActionNode in project jbpm by kiegroup.

the class ActionNodeHandler method writeNode.

public void writeNode(Node node, StringBuilder xmlDump, int metaDataType) {
    ActionNode actionNode = (ActionNode) node;
    DroolsConsequenceAction action = null;
    if (actionNode.getAction() instanceof DroolsConsequenceAction) {
        action = (DroolsConsequenceAction) actionNode.getAction();
    } else {
        logger.warn("Cannot serialize custom implementation of the Action interface to XML");
    }
    String eventType = (String) actionNode.getMetaData("EventType");
    String ref = (String) actionNode.getMetaData("Ref");
    String variableRef = (String) actionNode.getMetaData("Variable");
    if (action != null) {
        String s = action.getConsequence();
        if (s.startsWith("org.drools.core.process.instance.impl.WorkItemImpl workItem = new org.drools.core.process.instance.impl.WorkItemImpl();")) {
            writeNode("intermediateThrowEvent", actionNode, xmlDump, metaDataType);
            xmlDump.append(">" + EOL);
            writeExtensionElements(actionNode, xmlDump);
            String variable = (String) actionNode.getMetaData("MappingVariable");
            if (variable != null) {
                xmlDump.append("      <dataInput id=\"" + XmlBPMNProcessDumper.getUniqueNodeId(actionNode) + "_Input\" />" + EOL + "      <dataInputAssociation>" + EOL + "        <sourceRef>" + XmlDumper.replaceIllegalChars(variable) + "</sourceRef>" + EOL + "        <targetRef>" + XmlBPMNProcessDumper.getUniqueNodeId(actionNode) + "_Input</targetRef>" + EOL + "      </dataInputAssociation>" + EOL + "      <inputSet>" + EOL + "        <dataInputRefs>" + XmlBPMNProcessDumper.getUniqueNodeId(actionNode) + "_Input</dataInputRefs>" + EOL + "      </inputSet>" + EOL);
            }
            xmlDump.append("      <messageEventDefinition messageRef=\"" + XmlBPMNProcessDumper.getUniqueNodeId(actionNode) + "_Message\"/>" + EOL);
            endNode("intermediateThrowEvent", xmlDump);
        } else if ("signal".equals(eventType)) {
            writeNode("intermediateThrowEvent", actionNode, xmlDump, metaDataType);
            xmlDump.append(">" + EOL);
            writeExtensionElements(actionNode, xmlDump);
            if (!s.startsWith("null")) {
                xmlDump.append("      <dataInput id=\"" + XmlBPMNProcessDumper.getUniqueNodeId(actionNode) + "_Input\" />" + EOL + "      <dataInputAssociation>" + EOL + "        <sourceRef>" + XmlDumper.replaceIllegalChars(variableRef) + "</sourceRef>" + EOL + "        <targetRef>" + XmlBPMNProcessDumper.getUniqueNodeId(actionNode) + "_Input</targetRef>" + EOL + "      </dataInputAssociation>" + EOL + "      <inputSet>" + EOL + "        <dataInputRefs>" + XmlBPMNProcessDumper.getUniqueNodeId(actionNode) + "_Input</dataInputRefs>" + EOL + "      </inputSet>" + EOL);
            }
            xmlDump.append("      <signalEventDefinition signalRef=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(ref) + "\"/>" + EOL);
            endNode("intermediateThrowEvent", xmlDump);
        } else if (s.startsWith(RUNTIME_SIGNAL_EVENT)) {
            writeNode("intermediateThrowEvent", actionNode, xmlDump, metaDataType);
            xmlDump.append(">" + EOL);
            writeExtensionElements(actionNode, xmlDump);
            s = s.substring(44);
            String type = s.substring(0, s.indexOf("\""));
            s = s.substring(s.indexOf(",") + 2);
            String variable = null;
            if (!s.startsWith("null")) {
                variable = s.substring(0, s.indexOf(")"));
                xmlDump.append("      <dataInput id=\"" + XmlBPMNProcessDumper.getUniqueNodeId(actionNode) + "_Input\" />" + EOL + "      <dataInputAssociation>" + EOL + "        <sourceRef>" + XmlDumper.replaceIllegalChars(variable) + "</sourceRef>" + EOL + "        <targetRef>" + XmlBPMNProcessDumper.getUniqueNodeId(actionNode) + "_Input</targetRef>" + EOL + "      </dataInputAssociation>" + EOL + "      <inputSet>" + EOL + "        <dataInputRefs>" + XmlBPMNProcessDumper.getUniqueNodeId(actionNode) + "_Input</dataInputRefs>" + EOL + "      </inputSet>" + EOL);
            }
            xmlDump.append("      <signalEventDefinition signalRef=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(type) + "\"/>" + EOL);
            endNode("intermediateThrowEvent", xmlDump);
        } else if (s.startsWith(PROCESS_INSTANCE_SIGNAL_EVENT)) {
            writeNode("intermediateThrowEvent", actionNode, xmlDump, metaDataType);
            xmlDump.append(">" + EOL);
            writeExtensionElements(actionNode, xmlDump);
            s = s.substring(43);
            assert "Compensation".equals(s.substring(0, s.indexOf("\""))) : "Type is not \"Compensation\" but \"" + s.substring(0, s.indexOf("\"")) + "\"";
            String activityRef = "";
            // : Compensation
            int begin = 12;
            // ");
            int end = s.length() - 3;
            String compensationEvent = s.substring(begin, end);
            if (!compensationEvent.startsWith(CompensationScope.IMPLICIT_COMPENSATION_PREFIX)) {
                // specific
                activityRef = "activityRef=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(activityRef) + "\" ";
            }
            // else general: activityRef = "" (above)
            xmlDump.append("      <compensateEventDefinition " + activityRef + "/>" + EOL);
            endNode("intermediateThrowEvent", xmlDump);
        } else if (s.startsWith("org.drools.core.process.instance.context.exception.ExceptionScopeInstance scopeInstance = (org.drools.core.process.instance.context.exception.ExceptionScopeInstance) ((org.drools.workflow.instance.NodeInstance) kcontext.getNodeInstance()).resolveContextInstance(org.drools.core.process.core.context.exception.ExceptionScope.EXCEPTION_SCOPE, \"")) {
            writeNode("intermediateThrowEvent", actionNode, xmlDump, metaDataType);
            xmlDump.append(">" + EOL);
            writeExtensionElements(actionNode, xmlDump);
            s = s.substring(327);
            String type = s.substring(0, s.indexOf("\""));
            xmlDump.append("      <escalationEventDefinition escalationRef=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(type) + "\"/>" + EOL);
            endNode("intermediateThrowEvent", xmlDump);
        } else if ("IntermediateThrowEvent-None".equals(actionNode.getMetaData("NodeType"))) {
            writeNode("intermediateThrowEvent", actionNode, xmlDump, metaDataType);
            xmlDump.append(">" + EOL);
            writeExtensionElements(actionNode, xmlDump);
            endNode("intermediateThrowEvent", xmlDump);
        } else {
            writeNode("scriptTask", actionNode, xmlDump, metaDataType);
            if (JavaDialect.ID.equals(action.getDialect())) {
                xmlDump.append("scriptFormat=\"" + XmlBPMNProcessDumper.JAVA_LANGUAGE + "\" ");
            } else if ("JavaScript".equals(action.getDialect())) {
                xmlDump.append("scriptFormat=\"" + XmlBPMNProcessDumper.JAVASCRIPT_LANGUAGE + "\" ");
            }
            Object isForCompensationObj = actionNode.getMetaData("isForCompensation");
            if (isForCompensationObj != null && (Boolean) isForCompensationObj) {
                xmlDump.append("isForCompensation=\"true\" ");
            }
            xmlDump.append(">" + EOL);
            writeExtensionElements(actionNode, xmlDump);
            if (action.getConsequence() != null) {
                xmlDump.append("      <script>" + XmlDumper.replaceIllegalChars(action.getConsequence()) + "</script>" + EOL);
            }
            endNode("scriptTask", xmlDump);
        }
    } else {
        writeNode("scriptTask", actionNode, xmlDump, metaDataType);
        xmlDump.append(">" + EOL);
        writeExtensionElements(actionNode, xmlDump);
        endNode("scriptTask", xmlDump);
    }
}
Also used : DroolsConsequenceAction(org.jbpm.workflow.core.impl.DroolsConsequenceAction) ActionNode(org.jbpm.workflow.core.node.ActionNode)

Example 12 with ActionNode

use of org.jbpm.workflow.core.node.ActionNode in project jbpm by kiegroup.

the class RuleFlowProcessValidator method validateNodes.

private void validateNodes(Node[] nodes, List<ProcessValidationError> errors, RuleFlowProcess process) {
    String isForCompensation = "isForCompensation";
    for (int i = 0; i < nodes.length; i++) {
        final Node node = nodes[i];
        if (node instanceof StartNode) {
            final StartNode startNode = (StartNode) node;
            if (startNode.getTo() == null) {
                addErrorMessage(process, node, errors, "Start has no outgoing connection.");
            }
            if (startNode.getTimer() != null) {
                validateTimer(startNode.getTimer(), node, process, errors);
            }
        } else if (node instanceof EndNode) {
            final EndNode endNode = (EndNode) node;
            if (endNode.getFrom() == null) {
                addErrorMessage(process, node, errors, "End has no incoming connection.");
            }
            validateCompensationIntermediateOrEndEvent(endNode, process, errors);
        } else if (node instanceof RuleSetNode) {
            final RuleSetNode ruleSetNode = (RuleSetNode) node;
            if (ruleSetNode.getFrom() == null && !acceptsNoIncomingConnections(node)) {
                addErrorMessage(process, node, errors, "RuleSet has no incoming connection.");
            }
            if (ruleSetNode.getTo() == null && !acceptsNoOutgoingConnections(node)) {
                addErrorMessage(process, node, errors, "RuleSet has no outgoing connection.");
            }
            final String language = ruleSetNode.getLanguage();
            if (RuleSetNode.DRL_LANG.equals(language)) {
                final String ruleFlowGroup = ruleSetNode.getRuleFlowGroup();
                if (ruleFlowGroup == null || "".equals(ruleFlowGroup)) {
                    addErrorMessage(process, node, errors, "RuleSet (DRL) has no ruleflow-group.");
                }
            } else if (RuleSetNode.DMN_LANG.equals(language)) {
                final String namespace = ruleSetNode.getNamespace();
                if (namespace == null || "".equals(namespace)) {
                    addErrorMessage(process, node, errors, "RuleSet (DMN) has no namespace.");
                }
                final String model = ruleSetNode.getModel();
                if (model == null || "".equals(model)) {
                    addErrorMessage(process, node, errors, "RuleSet (DMN) has no model.");
                }
            } else {
                addErrorMessage(process, node, errors, "Unsupported rule language '" + language + "'");
            }
            if (ruleSetNode.getTimers() != null) {
                for (Timer timer : ruleSetNode.getTimers().keySet()) {
                    validateTimer(timer, node, process, errors);
                }
            }
        } else if (node instanceof Split) {
            final Split split = (Split) node;
            if (split.getType() == Split.TYPE_UNDEFINED) {
                addErrorMessage(process, node, errors, "Split has no type.");
            }
            if (split.getFrom() == null && !acceptsNoIncomingConnections(node)) {
                addErrorMessage(process, node, errors, "Split has no incoming connection.");
            }
            if (split.getDefaultOutgoingConnections().size() < 2) {
                addErrorMessage(process, node, errors, "Split does not have more than one outgoing connection: " + split.getOutgoingConnections().size() + ".");
            }
            if (split.getType() == Split.TYPE_XOR || split.getType() == Split.TYPE_OR) {
                for (final Iterator<Connection> it = split.getDefaultOutgoingConnections().iterator(); it.hasNext(); ) {
                    final Connection connection = it.next();
                    if (split.getConstraint(connection) == null && !split.isDefault(connection) || (!split.isDefault(connection) && (split.getConstraint(connection).getConstraint() == null || split.getConstraint(connection).getConstraint().trim().length() == 0))) {
                        addErrorMessage(process, node, errors, "Split does not have a constraint for " + connection.toString() + ".");
                    }
                }
            }
        } else if (node instanceof Join) {
            final Join join = (Join) node;
            if (join.getType() == Join.TYPE_UNDEFINED) {
                addErrorMessage(process, node, errors, "Join has no type.");
            }
            if (join.getDefaultIncomingConnections().size() < 2) {
                addErrorMessage(process, node, errors, "Join does not have more than one incoming connection: " + join.getIncomingConnections().size() + ".");
            }
            if (join.getTo() == null && !acceptsNoOutgoingConnections(node)) {
                addErrorMessage(process, node, errors, "Join has no outgoing connection.");
            }
            if (join.getType() == Join.TYPE_N_OF_M) {
                String n = join.getN();
                if (!n.startsWith("#{") || !n.endsWith("}")) {
                    try {
                        new Integer(n);
                    } catch (NumberFormatException e) {
                        addErrorMessage(process, node, errors, "Join has illegal n value: " + n);
                    }
                }
            }
        } else if (node instanceof MilestoneNode) {
            final MilestoneNode milestone = (MilestoneNode) node;
            if (milestone.getFrom() == null && !acceptsNoIncomingConnections(node)) {
                addErrorMessage(process, node, errors, "Milestone has no incoming connection.");
            }
            if (milestone.getTo() == null && !acceptsNoOutgoingConnections(node)) {
                addErrorMessage(process, node, errors, "Milestone has no outgoing connection.");
            }
            if (milestone.getConstraint() == null) {
                addErrorMessage(process, node, errors, "Milestone has no constraint.");
            }
            if (milestone.getTimers() != null) {
                for (Timer timer : milestone.getTimers().keySet()) {
                    validateTimer(timer, node, process, errors);
                }
            }
        } else if (node instanceof StateNode) {
            final StateNode stateNode = (StateNode) node;
            if (stateNode.getDefaultIncomingConnections().size() == 0 && !acceptsNoIncomingConnections(node)) {
                addErrorMessage(process, node, errors, "State has no incoming connection");
            }
        } else if (node instanceof SubProcessNode) {
            final SubProcessNode subProcess = (SubProcessNode) node;
            if (subProcess.getFrom() == null && !acceptsNoIncomingConnections(node)) {
                addErrorMessage(process, node, errors, "SubProcess has no incoming connection.");
            }
            if (subProcess.getTo() == null && !acceptsNoOutgoingConnections(node)) {
                Object compensationObj = subProcess.getMetaData(isForCompensation);
                if (compensationObj == null || !((Boolean) compensationObj)) {
                    addErrorMessage(process, node, errors, "SubProcess has no outgoing connection.");
                }
            }
            if (subProcess.getProcessId() == null && subProcess.getProcessName() == null) {
                addErrorMessage(process, node, errors, "SubProcess has no process id.");
            }
            if (subProcess.getTimers() != null) {
                for (Timer timer : subProcess.getTimers().keySet()) {
                    validateTimer(timer, node, process, errors);
                }
            }
            if (!subProcess.isIndependent() && !subProcess.isWaitForCompletion()) {
                addErrorMessage(process, node, errors, "SubProcess you can only set " + "independent to 'false' only when 'Wait for completion' is set to true.");
            }
        } else if (node instanceof ActionNode) {
            final ActionNode actionNode = (ActionNode) node;
            if (actionNode.getFrom() == null && !acceptsNoIncomingConnections(node)) {
                addErrorMessage(process, node, errors, "Action has no incoming connection.");
            }
            if (actionNode.getTo() == null && !acceptsNoOutgoingConnections(node)) {
                Object compensationObj = actionNode.getMetaData(isForCompensation);
                if (compensationObj == null || !((Boolean) compensationObj)) {
                    addErrorMessage(process, node, errors, "Action has no outgoing connection.");
                }
            }
            if (actionNode.getAction() == null) {
                addErrorMessage(process, node, errors, "Action has no action.");
            } else if (actionNode.getAction() instanceof DroolsConsequenceAction) {
                DroolsConsequenceAction droolsAction = (DroolsConsequenceAction) actionNode.getAction();
                String actionString = droolsAction.getConsequence();
                if (actionString == null) {
                    addErrorMessage(process, node, errors, "Action has empty action.");
                } else if ("mvel".equals(droolsAction.getDialect())) {
                    try {
                        ParserContext parserContext = new ParserContext();
                        // parserContext.setStrictTypeEnforcement(true);
                        ExpressionCompiler compiler = new ExpressionCompiler(actionString, parserContext);
                        compiler.setVerifying(true);
                        compiler.compile();
                        List<ErrorDetail> mvelErrors = parserContext.getErrorList();
                        if (mvelErrors != null) {
                            for (Iterator<ErrorDetail> iterator = mvelErrors.iterator(); iterator.hasNext(); ) {
                                ErrorDetail error = iterator.next();
                                addErrorMessage(process, node, errors, "Action has invalid action: " + error.getMessage() + ".");
                            }
                        }
                    } catch (Throwable t) {
                        addErrorMessage(process, node, errors, "Action has invalid action: " + t.getMessage() + ".");
                    }
                }
                // TODO: validation for "java" and "drools" scripts!
                validateCompensationIntermediateOrEndEvent(actionNode, process, errors);
            }
        } else if (node instanceof WorkItemNode) {
            final WorkItemNode workItemNode = (WorkItemNode) node;
            if (workItemNode.getFrom() == null && !acceptsNoIncomingConnections(node)) {
                addErrorMessage(process, node, errors, "Task has no incoming connection.");
            }
            if (workItemNode.getTo() == null && !acceptsNoOutgoingConnections(node)) {
                Object compensationObj = workItemNode.getMetaData(isForCompensation);
                if (compensationObj == null || !((Boolean) compensationObj)) {
                    addErrorMessage(process, node, errors, "Task has no outgoing connection.");
                }
            }
            if (workItemNode.getWork() == null) {
                addErrorMessage(process, node, errors, "Task has no work specified.");
            } else {
                Work work = workItemNode.getWork();
                if (work.getName() == null || work.getName().trim().length() == 0) {
                    addErrorMessage(process, node, errors, "Task has no task type.");
                }
            }
            if (workItemNode.getTimers() != null) {
                for (Timer timer : workItemNode.getTimers().keySet()) {
                    validateTimer(timer, node, process, errors);
                }
            }
        } else if (node instanceof ForEachNode) {
            final ForEachNode forEachNode = (ForEachNode) node;
            String variableName = forEachNode.getVariableName();
            if (variableName == null || "".equals(variableName)) {
                addErrorMessage(process, node, errors, "ForEach has no variable name");
            }
            String collectionExpression = forEachNode.getCollectionExpression();
            if (collectionExpression == null || "".equals(collectionExpression)) {
                addErrorMessage(process, node, errors, "ForEach has no collection expression");
            }
            if (forEachNode.getDefaultIncomingConnections().size() == 0 && !acceptsNoIncomingConnections(node)) {
                addErrorMessage(process, node, errors, "ForEach has no incoming connection");
            }
            if (forEachNode.getDefaultOutgoingConnections().size() == 0 && !acceptsNoOutgoingConnections(node)) {
                addErrorMessage(process, node, errors, "ForEach has no outgoing connection");
            }
            // TODO: check, if no linked connections, for start and end node(s)
            // if (forEachNode.getLinkedIncomingNode(org.drools.workflow.core.Node.CONNECTION_DEFAULT_TYPE) == null) {
            // errors.add(new ProcessValidationErrorImpl(process,
            // "ForEach node '%s' [%d] has no linked start node"));
            // }
            // if (forEachNode.getLinkedOutgoingNode(org.drools.workflow.core.Node.CONNECTION_DEFAULT_TYPE) == null) {
            // errors.add(new ProcessValidationErrorImpl(process,
            // "ForEach node '%s' [%d] has no linked end node"));
            // }
            validateNodes(forEachNode.getNodes(), errors, process);
        } else if (node instanceof DynamicNode) {
            final DynamicNode dynamicNode = (DynamicNode) node;
            if (dynamicNode.getDefaultIncomingConnections().size() == 0 && !acceptsNoIncomingConnections(dynamicNode)) {
                addErrorMessage(process, node, errors, "Dynamic has no incoming connection");
            }
            if (dynamicNode.getDefaultOutgoingConnections().size() == 0 && !acceptsNoOutgoingConnections(dynamicNode)) {
                addErrorMessage(process, node, errors, "Dynamic has no outgoing connection");
            }
            if ("".equals(dynamicNode.getCompletionExpression()) && !dynamicNode.isAutoComplete()) {
                addErrorMessage(process, node, errors, "Dynamic has no completion condition set");
            }
            validateNodes(dynamicNode.getNodes(), errors, process);
        } else if (node instanceof CompositeNode) {
            final CompositeNode compositeNode = (CompositeNode) node;
            for (Map.Entry<String, NodeAndType> inType : compositeNode.getLinkedIncomingNodes().entrySet()) {
                if (compositeNode.getIncomingConnections(inType.getKey()).size() == 0 && !acceptsNoIncomingConnections(node)) {
                    addErrorMessage(process, node, errors, "Composite has no incoming connection for type " + inType.getKey());
                }
                if (inType.getValue().getNode() == null && !acceptsNoOutgoingConnections(node)) {
                    addErrorMessage(process, node, errors, "Composite has invalid linked incoming node for type " + inType.getKey());
                }
            }
            for (Map.Entry<String, NodeAndType> outType : compositeNode.getLinkedOutgoingNodes().entrySet()) {
                if (compositeNode.getOutgoingConnections(outType.getKey()).size() == 0) {
                    addErrorMessage(process, node, errors, "Composite has no outgoing connection for type " + outType.getKey());
                }
                if (outType.getValue().getNode() == null) {
                    addErrorMessage(process, node, errors, "Composite has invalid linked outgoing node for type " + outType.getKey());
                }
            }
            if (compositeNode instanceof EventSubProcessNode) {
                if (compositeNode.getIncomingConnections().size() > 0) {
                    addErrorMessage(process, node, errors, "Event subprocess is not allowed to have any incoming connections.");
                }
                if (compositeNode.getOutgoingConnections().size() > 0) {
                    addErrorMessage(process, node, errors, "Event subprocess is not allowed to have any outgoing connections.");
                }
                Node[] eventSubProcessNodes = compositeNode.getNodes();
                int startEventCount = 0;
                for (int j = 0; j < eventSubProcessNodes.length; ++j) {
                    if (eventSubProcessNodes[j] instanceof StartNode) {
                        StartNode startNode = (StartNode) eventSubProcessNodes[j];
                        if (++startEventCount == 2) {
                            addErrorMessage(process, compositeNode, errors, "Event subprocess is not allowed to have more than one start node.");
                        }
                        if (startNode.getTriggers() == null || startNode.getTriggers().isEmpty()) {
                            addErrorMessage(process, startNode, errors, "Start in Event SubProcess '" + compositeNode.getName() + "' [" + compositeNode.getId() + "] must contain a trigger (event definition).");
                        }
                    }
                }
            } else {
                Boolean isForCompensationObject = (Boolean) compositeNode.getMetaData("isForCompensation");
                if (compositeNode.getIncomingConnections().size() == 0 && !Boolean.TRUE.equals(isForCompensationObject)) {
                    addErrorMessage(process, node, errors, "Embedded subprocess does not have incoming connection.");
                }
                if (compositeNode.getOutgoingConnections().size() == 0 && !Boolean.TRUE.equals(isForCompensationObject)) {
                    addErrorMessage(process, node, errors, "Embedded subprocess does not have outgoing connection.");
                }
            }
            if (compositeNode.getTimers() != null) {
                for (Timer timer : compositeNode.getTimers().keySet()) {
                    validateTimer(timer, node, process, errors);
                }
            }
            validateNodes(compositeNode.getNodes(), errors, process);
        } else if (node instanceof EventNode) {
            final EventNode eventNode = (EventNode) node;
            if (eventNode.getEventFilters().size() == 0) {
                addErrorMessage(process, node, errors, "Event should specify an event type");
            }
            if (eventNode.getDefaultOutgoingConnections().size() == 0) {
                addErrorMessage(process, node, errors, "Event has no outgoing connection");
            } else {
                List<EventFilter> eventFilters = eventNode.getEventFilters();
                boolean compensationHandler = false;
                for (EventFilter eventFilter : eventFilters) {
                    if (((EventTypeFilter) eventFilter).getType().startsWith("Compensation")) {
                        compensationHandler = true;
                        break;
                    }
                }
                if (compensationHandler && eventNode instanceof BoundaryEventNode) {
                    Connection connection = eventNode.getDefaultOutgoingConnections().get(0);
                    Boolean isAssociation = (Boolean) connection.getMetaData().get("association");
                    if (isAssociation == null) {
                        isAssociation = false;
                    }
                    if (!(eventNode.getDefaultOutgoingConnections().size() == 1 && connection != null && isAssociation)) {
                        addErrorMessage(process, node, errors, "Compensation Boundary Event is only allowed to have 1 association to 1 compensation activity.");
                    }
                }
            }
        } else if (node instanceof FaultNode) {
            final FaultNode faultNode = (FaultNode) node;
            if (faultNode.getFrom() == null && !acceptsNoIncomingConnections(node)) {
                addErrorMessage(process, node, errors, "Fault has no incoming connection.");
            }
            if (faultNode.getFaultName() == null) {
                addErrorMessage(process, node, errors, "Fault has no fault name.");
            }
        } else if (node instanceof TimerNode) {
            TimerNode timerNode = (TimerNode) node;
            if (timerNode.getFrom() == null && !acceptsNoIncomingConnections(node)) {
                addErrorMessage(process, node, errors, "Timer has no incoming connection.");
            }
            if (timerNode.getTo() == null && !acceptsNoOutgoingConnections(node)) {
                addErrorMessage(process, node, errors, "Timer has no outgoing connection.");
            }
            if (timerNode.getTimer() == null) {
                addErrorMessage(process, node, errors, "Timer has no timer specified.");
            } else {
                validateTimer(timerNode.getTimer(), node, process, errors);
            }
        } else if (node instanceof CatchLinkNode) {
        // catchlink validation here, there also are validations in
        // ProcessHandler regarding connection issues
        } else if (node instanceof ThrowLinkNode) {
        // throw validation here, there also are validations in
        // ProcessHandler regarding connection issues
        } else {
            errors.add(new ProcessValidationErrorImpl(process, "Unknown node type '" + node.getClass().getName() + "'"));
        }
    }
}
Also used : DroolsConsequenceAction(org.jbpm.workflow.core.impl.DroolsConsequenceAction) NodeAndType(org.jbpm.workflow.core.node.CompositeNode.NodeAndType) RuleSetNode(org.jbpm.workflow.core.node.RuleSetNode) EventSubProcessNode(org.jbpm.workflow.core.node.EventSubProcessNode) ForEachNode(org.jbpm.workflow.core.node.ForEachNode) BoundaryEventNode(org.jbpm.workflow.core.node.BoundaryEventNode) DynamicNode(org.jbpm.workflow.core.node.DynamicNode) StartNode(org.jbpm.workflow.core.node.StartNode) CompositeNode(org.jbpm.workflow.core.node.CompositeNode) StateNode(org.jbpm.workflow.core.node.StateNode) RuleSetNode(org.jbpm.workflow.core.node.RuleSetNode) SubProcessNode(org.jbpm.workflow.core.node.SubProcessNode) CatchLinkNode(org.jbpm.workflow.core.node.CatchLinkNode) ForEachJoinNode(org.jbpm.workflow.core.node.ForEachNode.ForEachJoinNode) MilestoneNode(org.jbpm.workflow.core.node.MilestoneNode) ThrowLinkNode(org.jbpm.workflow.core.node.ThrowLinkNode) EventSubProcessNode(org.jbpm.workflow.core.node.EventSubProcessNode) TimerNode(org.jbpm.workflow.core.node.TimerNode) FaultNode(org.jbpm.workflow.core.node.FaultNode) WorkItemNode(org.jbpm.workflow.core.node.WorkItemNode) ActionNode(org.jbpm.workflow.core.node.ActionNode) EndNode(org.jbpm.workflow.core.node.EndNode) EventNode(org.jbpm.workflow.core.node.EventNode) Node(org.kie.api.definition.process.Node) ForEachSplitNode(org.jbpm.workflow.core.node.ForEachNode.ForEachSplitNode) StateNode(org.jbpm.workflow.core.node.StateNode) ActionNode(org.jbpm.workflow.core.node.ActionNode) MilestoneNode(org.jbpm.workflow.core.node.MilestoneNode) ErrorDetail(org.mvel2.ErrorDetail) BoundaryEventNode(org.jbpm.workflow.core.node.BoundaryEventNode) EventNode(org.jbpm.workflow.core.node.EventNode) EventTypeFilter(org.jbpm.process.core.event.EventTypeFilter) SubProcessNode(org.jbpm.workflow.core.node.SubProcessNode) EventSubProcessNode(org.jbpm.workflow.core.node.EventSubProcessNode) Iterator(java.util.Iterator) WorkItemNode(org.jbpm.workflow.core.node.WorkItemNode) Work(org.jbpm.process.core.Work) List(java.util.List) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) TimerNode(org.jbpm.workflow.core.node.TimerNode) StartNode(org.jbpm.workflow.core.node.StartNode) CatchLinkNode(org.jbpm.workflow.core.node.CatchLinkNode) Connection(org.kie.api.definition.process.Connection) Join(org.jbpm.workflow.core.node.Join) BoundaryEventNode(org.jbpm.workflow.core.node.BoundaryEventNode) ThrowLinkNode(org.jbpm.workflow.core.node.ThrowLinkNode) EventFilter(org.jbpm.process.core.event.EventFilter) FaultNode(org.jbpm.workflow.core.node.FaultNode) CompositeNode(org.jbpm.workflow.core.node.CompositeNode) EndNode(org.jbpm.workflow.core.node.EndNode) Timer(org.jbpm.process.core.timer.Timer) ProcessValidationErrorImpl(org.jbpm.process.core.validation.impl.ProcessValidationErrorImpl) ExpressionCompiler(org.mvel2.compiler.ExpressionCompiler) ForEachNode(org.jbpm.workflow.core.node.ForEachNode) DynamicNode(org.jbpm.workflow.core.node.DynamicNode) Split(org.jbpm.workflow.core.node.Split) ParserContext(org.mvel2.ParserContext) Map(java.util.Map) HashMap(java.util.HashMap)

Example 13 with ActionNode

use of org.jbpm.workflow.core.node.ActionNode in project jbpm by kiegroup.

the class ProcessEventSupportTest method testProcessEventListenerWithEvent.

@Test
public void testProcessEventListenerWithEvent() throws Exception {
    InternalKnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
    // create a simple package with one process to test the events
    final InternalKnowledgePackage pkg = new KnowledgePackageImpl("org.drools.test");
    RuleFlowProcess process = new RuleFlowProcess();
    process.setId("org.drools.core.process.event");
    process.setName("Event Process");
    StartNode startNode = new StartNode();
    startNode.setName("Start");
    startNode.setId(1);
    process.addNode(startNode);
    ActionNode actionNode = new ActionNode();
    actionNode.setName("Print");
    DroolsAction action = new DroolsConsequenceAction("java", null);
    action.setMetaData("Action", new Action() {

        public void execute(ProcessContext context) throws Exception {
            logger.info("Executed action");
        }
    });
    actionNode.setAction(action);
    actionNode.setId(2);
    process.addNode(actionNode);
    new ConnectionImpl(startNode, Node.CONNECTION_DEFAULT_TYPE, actionNode, Node.CONNECTION_DEFAULT_TYPE);
    EventNode eventNode = new EventNode();
    eventNode.setName("Event");
    eventNode.setId(3);
    List<EventFilter> filters = new ArrayList<EventFilter>();
    EventTypeFilter filter = new EventTypeFilter();
    filter.setType("signal");
    filters.add(filter);
    eventNode.setEventFilters(filters);
    process.addNode(eventNode);
    new ConnectionImpl(actionNode, Node.CONNECTION_DEFAULT_TYPE, eventNode, Node.CONNECTION_DEFAULT_TYPE);
    EndNode endNode = new EndNode();
    endNode.setName("End");
    endNode.setId(4);
    process.addNode(endNode);
    new ConnectionImpl(eventNode, Node.CONNECTION_DEFAULT_TYPE, endNode, Node.CONNECTION_DEFAULT_TYPE);
    pkg.addProcess(process);
    List<KiePackage> pkgs = new ArrayList<KiePackage>();
    pkgs.add(pkg);
    kbase.addPackages(pkgs);
    KieSession session = kbase.newKieSession();
    final List<ProcessEvent> processEventList = new ArrayList<ProcessEvent>();
    final ProcessEventListener processEventListener = new ProcessEventListener() {

        public void afterNodeLeft(ProcessNodeLeftEvent event) {
            processEventList.add(event);
        }

        public void afterNodeTriggered(ProcessNodeTriggeredEvent event) {
            processEventList.add(event);
        }

        public void afterProcessCompleted(ProcessCompletedEvent event) {
            processEventList.add(event);
        }

        public void afterProcessStarted(ProcessStartedEvent event) {
            processEventList.add(event);
        }

        public void beforeNodeLeft(ProcessNodeLeftEvent event) {
            processEventList.add(event);
        }

        public void beforeNodeTriggered(ProcessNodeTriggeredEvent event) {
            processEventList.add(event);
        }

        public void beforeProcessCompleted(ProcessCompletedEvent event) {
            processEventList.add(event);
        }

        public void beforeProcessStarted(ProcessStartedEvent event) {
            processEventList.add(event);
        }

        public void beforeVariableChanged(ProcessVariableChangedEvent event) {
            processEventList.add(event);
        }

        public void afterVariableChanged(ProcessVariableChangedEvent event) {
            processEventList.add(event);
        }
    };
    session.addEventListener(processEventListener);
    // execute the process
    ProcessInstance pi = session.startProcess("org.drools.core.process.event");
    pi.signalEvent("signal", null);
    assertEquals(20, processEventList.size());
    assertEquals("org.drools.core.process.event", ((ProcessStartedEvent) processEventList.get(0)).getProcessInstance().getProcessId());
    assertEquals("Start", ((ProcessNodeTriggeredEvent) processEventList.get(1)).getNodeInstance().getNodeName());
    assertEquals("Start", ((ProcessNodeLeftEvent) processEventList.get(2)).getNodeInstance().getNodeName());
    assertEquals("Print", ((ProcessNodeTriggeredEvent) processEventList.get(3)).getNodeInstance().getNodeName());
    assertEquals("Print", ((ProcessNodeLeftEvent) processEventList.get(4)).getNodeInstance().getNodeName());
    assertEquals("Event", ((ProcessNodeTriggeredEvent) processEventList.get(5)).getNodeInstance().getNodeName());
    assertEquals("Event", ((ProcessNodeTriggeredEvent) processEventList.get(6)).getNodeInstance().getNodeName());
    assertEquals("Print", ((ProcessNodeLeftEvent) processEventList.get(7)).getNodeInstance().getNodeName());
    assertEquals("Print", ((ProcessNodeTriggeredEvent) processEventList.get(8)).getNodeInstance().getNodeName());
    assertEquals("Start", ((ProcessNodeLeftEvent) processEventList.get(9)).getNodeInstance().getNodeName());
    assertEquals("Start", ((ProcessNodeTriggeredEvent) processEventList.get(10)).getNodeInstance().getNodeName());
    assertEquals("org.drools.core.process.event", ((ProcessStartedEvent) processEventList.get(11)).getProcessInstance().getProcessId());
    assertEquals("Event", ((ProcessNodeLeftEvent) processEventList.get(12)).getNodeInstance().getNodeName());
    assertEquals("End", ((ProcessNodeTriggeredEvent) processEventList.get(13)).getNodeInstance().getNodeName());
    assertEquals("End", ((ProcessNodeLeftEvent) processEventList.get(14)).getNodeInstance().getNodeName());
    assertEquals("org.drools.core.process.event", ((ProcessCompletedEvent) processEventList.get(15)).getProcessInstance().getProcessId());
    assertEquals("org.drools.core.process.event", ((ProcessCompletedEvent) processEventList.get(16)).getProcessInstance().getProcessId());
    assertEquals("End", ((ProcessNodeLeftEvent) processEventList.get(17)).getNodeInstance().getNodeName());
    assertEquals("Event", ((ProcessNodeLeftEvent) processEventList.get(19)).getNodeInstance().getNodeName());
    assertEquals("End", ((ProcessNodeTriggeredEvent) processEventList.get(18)).getNodeInstance().getNodeName());
}
Also used : ProcessVariableChangedEvent(org.kie.api.event.process.ProcessVariableChangedEvent) RuleFlowProcess(org.jbpm.ruleflow.core.RuleFlowProcess) DroolsConsequenceAction(org.jbpm.workflow.core.impl.DroolsConsequenceAction) DroolsAction(org.jbpm.workflow.core.DroolsAction) Action(org.jbpm.process.instance.impl.Action) DroolsConsequenceAction(org.jbpm.workflow.core.impl.DroolsConsequenceAction) ActionNode(org.jbpm.workflow.core.node.ActionNode) ArrayList(java.util.ArrayList) ConnectionImpl(org.jbpm.workflow.core.impl.ConnectionImpl) ProcessContext(org.kie.api.runtime.process.ProcessContext) EventNode(org.jbpm.workflow.core.node.EventNode) EventTypeFilter(org.jbpm.process.core.event.EventTypeFilter) KiePackage(org.kie.api.definition.KiePackage) ProcessNodeTriggeredEvent(org.kie.api.event.process.ProcessNodeTriggeredEvent) KieSession(org.kie.api.runtime.KieSession) ProcessNodeLeftEvent(org.kie.api.event.process.ProcessNodeLeftEvent) InternalKnowledgeBase(org.drools.core.impl.InternalKnowledgeBase) DroolsAction(org.jbpm.workflow.core.DroolsAction) StartNode(org.jbpm.workflow.core.node.StartNode) ProcessEvent(org.kie.api.event.process.ProcessEvent) ProcessEventListener(org.kie.api.event.process.ProcessEventListener) ProcessStartedEvent(org.kie.api.event.process.ProcessStartedEvent) EventFilter(org.jbpm.process.core.event.EventFilter) ProcessCompletedEvent(org.kie.api.event.process.ProcessCompletedEvent) EndNode(org.jbpm.workflow.core.node.EndNode) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) KnowledgePackageImpl(org.drools.core.definitions.impl.KnowledgePackageImpl) InternalKnowledgePackage(org.drools.core.definitions.InternalKnowledgePackage) Test(org.junit.Test) AbstractBaseTest(org.jbpm.test.util.AbstractBaseTest)

Example 14 with ActionNode

use of org.jbpm.workflow.core.node.ActionNode in project jbpm by kiegroup.

the class ProcessEventSupportTest method testProcessEventListenerWithStartEvent.

@Test
public void testProcessEventListenerWithStartEvent() throws Exception {
    InternalKnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
    // create a simple package with one process to test the events
    final InternalKnowledgePackage pkg = new KnowledgePackageImpl("org.drools.test");
    RuleFlowProcess process = new RuleFlowProcess();
    process.setId("org.drools.core.process.event");
    process.setName("Event Process");
    StartNode startNode = new StartNode();
    startNode.setName("Start");
    startNode.setId(1);
    EventTrigger trigger = new EventTrigger();
    EventTypeFilter eventFilter = new EventTypeFilter();
    eventFilter.setType("signal");
    trigger.addEventFilter(eventFilter);
    startNode.addTrigger(trigger);
    process.addNode(startNode);
    ActionNode actionNode = new ActionNode();
    actionNode.setName("Print");
    DroolsAction action = new DroolsConsequenceAction("java", null);
    action.setMetaData("Action", new Action() {

        public void execute(ProcessContext context) throws Exception {
            logger.info("Executed action");
        }
    });
    actionNode.setAction(action);
    actionNode.setId(2);
    process.addNode(actionNode);
    new ConnectionImpl(startNode, Node.CONNECTION_DEFAULT_TYPE, actionNode, Node.CONNECTION_DEFAULT_TYPE);
    EndNode endNode = new EndNode();
    endNode.setName("End");
    endNode.setId(3);
    process.addNode(endNode);
    new ConnectionImpl(actionNode, Node.CONNECTION_DEFAULT_TYPE, endNode, Node.CONNECTION_DEFAULT_TYPE);
    pkg.addProcess(process);
    List<KiePackage> pkgs = new ArrayList<KiePackage>();
    pkgs.add(pkg);
    kbase.addPackages(pkgs);
    KieSession session = kbase.newKieSession();
    final List<ProcessEvent> processEventList = new ArrayList<ProcessEvent>();
    final ProcessEventListener processEventListener = new ProcessEventListener() {

        public void afterNodeLeft(ProcessNodeLeftEvent event) {
            processEventList.add(event);
        }

        public void afterNodeTriggered(ProcessNodeTriggeredEvent event) {
            processEventList.add(event);
        }

        public void afterProcessCompleted(ProcessCompletedEvent event) {
            processEventList.add(event);
        }

        public void afterProcessStarted(ProcessStartedEvent event) {
            processEventList.add(event);
        }

        public void beforeNodeLeft(ProcessNodeLeftEvent event) {
            processEventList.add(event);
        }

        public void beforeNodeTriggered(ProcessNodeTriggeredEvent event) {
            processEventList.add(event);
        }

        public void beforeProcessCompleted(ProcessCompletedEvent event) {
            processEventList.add(event);
        }

        public void beforeProcessStarted(ProcessStartedEvent event) {
            processEventList.add(event);
        }

        public void beforeVariableChanged(ProcessVariableChangedEvent event) {
            processEventList.add(event);
        }

        public void afterVariableChanged(ProcessVariableChangedEvent event) {
            processEventList.add(event);
        }
    };
    session.addEventListener(processEventListener);
    // execute the process
    // session.startProcess("org.drools.core.process.event");
    session.signalEvent("signal", null);
    assertEquals(16, processEventList.size());
    assertEquals("org.drools.core.process.event", ((ProcessStartedEvent) processEventList.get(0)).getProcessInstance().getProcessId());
    assertEquals("Start", ((ProcessNodeTriggeredEvent) processEventList.get(1)).getNodeInstance().getNodeName());
    assertEquals("Start", ((ProcessNodeLeftEvent) processEventList.get(2)).getNodeInstance().getNodeName());
    assertEquals("Print", ((ProcessNodeTriggeredEvent) processEventList.get(3)).getNodeInstance().getNodeName());
    assertEquals("Print", ((ProcessNodeLeftEvent) processEventList.get(4)).getNodeInstance().getNodeName());
    assertEquals("End", ((ProcessNodeTriggeredEvent) processEventList.get(5)).getNodeInstance().getNodeName());
    assertEquals("End", ((ProcessNodeLeftEvent) processEventList.get(6)).getNodeInstance().getNodeName());
    assertEquals("org.drools.core.process.event", ((ProcessCompletedEvent) processEventList.get(7)).getProcessInstance().getProcessId());
    assertEquals("org.drools.core.process.event", ((ProcessCompletedEvent) processEventList.get(8)).getProcessInstance().getProcessId());
    assertEquals("End", ((ProcessNodeLeftEvent) processEventList.get(9)).getNodeInstance().getNodeName());
    assertEquals("End", ((ProcessNodeTriggeredEvent) processEventList.get(10)).getNodeInstance().getNodeName());
    assertEquals("Print", ((ProcessNodeLeftEvent) processEventList.get(11)).getNodeInstance().getNodeName());
    assertEquals("Print", ((ProcessNodeTriggeredEvent) processEventList.get(12)).getNodeInstance().getNodeName());
    assertEquals("Start", ((ProcessNodeLeftEvent) processEventList.get(13)).getNodeInstance().getNodeName());
    assertEquals("Start", ((ProcessNodeTriggeredEvent) processEventList.get(14)).getNodeInstance().getNodeName());
    assertEquals("org.drools.core.process.event", ((ProcessStartedEvent) processEventList.get(15)).getProcessInstance().getProcessId());
}
Also used : ProcessVariableChangedEvent(org.kie.api.event.process.ProcessVariableChangedEvent) RuleFlowProcess(org.jbpm.ruleflow.core.RuleFlowProcess) DroolsConsequenceAction(org.jbpm.workflow.core.impl.DroolsConsequenceAction) DroolsAction(org.jbpm.workflow.core.DroolsAction) Action(org.jbpm.process.instance.impl.Action) DroolsConsequenceAction(org.jbpm.workflow.core.impl.DroolsConsequenceAction) ActionNode(org.jbpm.workflow.core.node.ActionNode) ArrayList(java.util.ArrayList) ConnectionImpl(org.jbpm.workflow.core.impl.ConnectionImpl) ProcessContext(org.kie.api.runtime.process.ProcessContext) EventTypeFilter(org.jbpm.process.core.event.EventTypeFilter) KiePackage(org.kie.api.definition.KiePackage) ProcessNodeTriggeredEvent(org.kie.api.event.process.ProcessNodeTriggeredEvent) KieSession(org.kie.api.runtime.KieSession) ProcessNodeLeftEvent(org.kie.api.event.process.ProcessNodeLeftEvent) InternalKnowledgeBase(org.drools.core.impl.InternalKnowledgeBase) EventTrigger(org.jbpm.workflow.core.node.EventTrigger) DroolsAction(org.jbpm.workflow.core.DroolsAction) StartNode(org.jbpm.workflow.core.node.StartNode) ProcessEvent(org.kie.api.event.process.ProcessEvent) ProcessEventListener(org.kie.api.event.process.ProcessEventListener) ProcessStartedEvent(org.kie.api.event.process.ProcessStartedEvent) ProcessCompletedEvent(org.kie.api.event.process.ProcessCompletedEvent) EndNode(org.jbpm.workflow.core.node.EndNode) KnowledgePackageImpl(org.drools.core.definitions.impl.KnowledgePackageImpl) InternalKnowledgePackage(org.drools.core.definitions.InternalKnowledgePackage) Test(org.junit.Test) AbstractBaseTest(org.jbpm.test.util.AbstractBaseTest)

Example 15 with ActionNode

use of org.jbpm.workflow.core.node.ActionNode in project jbpm by kiegroup.

the class CompensationTest method createBoundaryEventCompensationHandler.

private void createBoundaryEventCompensationHandler(org.jbpm.workflow.core.NodeContainer nodeContainer, Node attachedToNode, final List<String> eventList, final String id) throws Exception {
    NodeCreator<BoundaryEventNode> boundaryNodeCreator = new NodeCreator<BoundaryEventNode>(nodeContainer, BoundaryEventNode.class);
    BoundaryEventNode boundaryNode = boundaryNodeCreator.createNode("boundary" + id);
    String attachedTo = (String) attachedToNode.getMetaData().get("UniqueId");
    boundaryNode.setMetaData("AttachedTo", attachedTo);
    boundaryNode.setAttachedToNodeId(attachedTo);
    EventTypeFilter eventFilter = new NonAcceptingEventTypeFilter();
    eventFilter.setType("Compensation");
    List<EventFilter> eventFilters = new ArrayList<EventFilter>();
    boundaryNode.setEventFilters(eventFilters);
    eventFilters.add(eventFilter);
    addCompensationScope(boundaryNode, nodeContainer, attachedTo);
    NodeCreator<ActionNode> actionNodeCreator = new NodeCreator<ActionNode>(nodeContainer, ActionNode.class);
    ActionNode actionNode = actionNodeCreator.createNode("handlerAction" + id);
    actionNode.setMetaData("isForCompensation", true);
    actionNode.setName("Execute");
    DroolsAction action = new DroolsConsequenceAction("java", null);
    action.setMetaData("Action", new Action() {

        public void execute(ProcessContext context) throws Exception {
            eventList.add("action" + id);
        }
    });
    actionNode.setAction(action);
    connect(boundaryNode, actionNode);
}
Also used : DroolsAction(org.jbpm.workflow.core.DroolsAction) DroolsConsequenceAction(org.jbpm.workflow.core.impl.DroolsConsequenceAction) DroolsAction(org.jbpm.workflow.core.DroolsAction) Action(org.jbpm.process.instance.impl.Action) DroolsConsequenceAction(org.jbpm.workflow.core.impl.DroolsConsequenceAction) ArrayList(java.util.ArrayList) ActionNode(org.jbpm.workflow.core.node.ActionNode) NonAcceptingEventTypeFilter(org.jbpm.process.core.event.NonAcceptingEventTypeFilter) BoundaryEventNode(org.jbpm.workflow.core.node.BoundaryEventNode) EventFilter(org.jbpm.process.core.event.EventFilter) ProcessContext(org.kie.api.runtime.process.ProcessContext) NonAcceptingEventTypeFilter(org.jbpm.process.core.event.NonAcceptingEventTypeFilter) EventTypeFilter(org.jbpm.process.core.event.EventTypeFilter) NodeCreator(org.jbpm.process.test.NodeCreator)

Aggregations

ActionNode (org.jbpm.workflow.core.node.ActionNode)48 DroolsConsequenceAction (org.jbpm.workflow.core.impl.DroolsConsequenceAction)41 EndNode (org.jbpm.workflow.core.node.EndNode)29 StartNode (org.jbpm.workflow.core.node.StartNode)28 ArrayList (java.util.ArrayList)25 RuleFlowProcess (org.jbpm.ruleflow.core.RuleFlowProcess)25 DroolsAction (org.jbpm.workflow.core.DroolsAction)24 Action (org.jbpm.process.instance.impl.Action)21 Test (org.junit.Test)20 EventTypeFilter (org.jbpm.process.core.event.EventTypeFilter)18 AbstractBaseTest (org.jbpm.test.util.AbstractBaseTest)18 ConnectionImpl (org.jbpm.workflow.core.impl.ConnectionImpl)18 KieSession (org.kie.api.runtime.KieSession)17 ProcessContext (org.kie.api.runtime.process.ProcessContext)17 EventNode (org.jbpm.workflow.core.node.EventNode)14 WorkItemNode (org.jbpm.workflow.core.node.WorkItemNode)14 ObjectDataType (org.jbpm.process.core.datatype.impl.type.ObjectDataType)12 Variable (org.jbpm.process.core.context.variable.Variable)11 TestProcessEventListener (org.jbpm.process.test.TestProcessEventListener)9 KnowledgeBuilderImpl (org.drools.compiler.builder.impl.KnowledgeBuilderImpl)8