Search in sources :

Example 1 with EndNodeInstance

use of org.jbpm.workflow.instance.node.EndNodeInstance in project jbpm by kiegroup.

the class WorkflowProcessInstanceImpl method nodeInstanceCompleted.

public void nodeInstanceCompleted(NodeInstance nodeInstance, String outType) {
    Node nodeInstanceNode = nodeInstance.getNode();
    if (nodeInstanceNode != null) {
        Object compensationBoolObj = nodeInstanceNode.getMetaData().get("isForCompensation");
        boolean isForCompensation = compensationBoolObj == null ? false : ((Boolean) compensationBoolObj);
        if (isForCompensation) {
            return;
        }
    }
    if (nodeInstance instanceof EndNodeInstance || ((org.jbpm.workflow.core.WorkflowProcess) getWorkflowProcess()).isDynamic() || nodeInstance instanceof CompositeNodeInstance) {
        if (((org.jbpm.workflow.core.WorkflowProcess) getProcess()).isAutoComplete()) {
            if (canComplete()) {
                setState(ProcessInstance.STATE_COMPLETED);
            }
        }
    } else {
        throw new IllegalArgumentException("Completing a node instance that has no outgoing connection is not supported.");
    }
}
Also used : CompositeNodeInstance(org.jbpm.workflow.instance.node.CompositeNodeInstance) DynamicNode(org.jbpm.workflow.core.node.DynamicNode) AsyncEventNode(org.jbpm.workflow.core.node.AsyncEventNode) StateBasedNode(org.jbpm.workflow.core.node.StateBasedNode) EventSubProcessNode(org.jbpm.workflow.core.node.EventSubProcessNode) 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) EndNodeInstance(org.jbpm.workflow.instance.node.EndNodeInstance) WorkflowProcess(org.kie.api.definition.process.WorkflowProcess)

Aggregations

ActionNode (org.jbpm.workflow.core.node.ActionNode)1 AsyncEventNode (org.jbpm.workflow.core.node.AsyncEventNode)1 DynamicNode (org.jbpm.workflow.core.node.DynamicNode)1 EndNode (org.jbpm.workflow.core.node.EndNode)1 EventNode (org.jbpm.workflow.core.node.EventNode)1 EventSubProcessNode (org.jbpm.workflow.core.node.EventSubProcessNode)1 StateBasedNode (org.jbpm.workflow.core.node.StateBasedNode)1 CompositeNodeInstance (org.jbpm.workflow.instance.node.CompositeNodeInstance)1 EndNodeInstance (org.jbpm.workflow.instance.node.EndNodeInstance)1 Node (org.kie.api.definition.process.Node)1 WorkflowProcess (org.kie.api.definition.process.WorkflowProcess)1