Search in sources :

Example 1 with AsyncEventNode

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

the class WorkflowProcessInstanceImpl method getNodeInstance.

public NodeInstance getNodeInstance(final Node node) {
    Node actualNode = node;
    // async continuation handling
    if (node instanceof AsyncEventNode) {
        actualNode = ((AsyncEventNode) node).getActualNode();
    } else if (useAsync(node)) {
        actualNode = new AsyncEventNode(node);
    }
    NodeInstanceFactory conf = NodeInstanceFactoryRegistry.getInstance(getKnowledgeRuntime().getEnvironment()).getProcessNodeInstanceFactory(actualNode);
    if (conf == null) {
        throw new IllegalArgumentException("Illegal node type: " + node.getClass());
    }
    NodeInstanceImpl nodeInstance = (NodeInstanceImpl) conf.getNodeInstance(actualNode, this, this);
    if (nodeInstance == null) {
        throw new IllegalArgumentException("Illegal node type: " + node.getClass());
    }
    if (((NodeInstanceImpl) nodeInstance).isInversionOfControl()) {
        getKnowledgeRuntime().insert(nodeInstance);
    }
    return nodeInstance;
}
Also used : 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) AsyncEventNode(org.jbpm.workflow.core.node.AsyncEventNode)

Example 2 with AsyncEventNode

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

the class CompositeNodeInstance method getNodeInstance.

public NodeInstance getNodeInstance(final Node node) {
    // TODO do this cleaner for start / end of composite?
    if (node instanceof CompositeNode.CompositeNodeStart) {
        CompositeNodeStartInstance nodeInstance = new CompositeNodeStartInstance();
        nodeInstance.setNodeId(node.getId());
        nodeInstance.setNodeInstanceContainer(this);
        nodeInstance.setProcessInstance(getProcessInstance());
        return nodeInstance;
    } else if (node instanceof CompositeNode.CompositeNodeEnd) {
        CompositeNodeEndInstance nodeInstance = new CompositeNodeEndInstance();
        nodeInstance.setNodeId(node.getId());
        nodeInstance.setNodeInstanceContainer(this);
        nodeInstance.setProcessInstance(getProcessInstance());
        return nodeInstance;
    }
    Node actualNode = node;
    // async continuation handling
    if (node instanceof AsyncEventNode) {
        actualNode = ((AsyncEventNode) node).getActualNode();
    } else if (useAsync(node)) {
        actualNode = new AsyncEventNode(node);
    }
    NodeInstanceFactory conf = NodeInstanceFactoryRegistry.getInstance(getProcessInstance().getKnowledgeRuntime().getEnvironment()).getProcessNodeInstanceFactory(actualNode);
    if (conf == null) {
        throw new IllegalArgumentException("Illegal node type: " + node.getClass());
    }
    NodeInstanceImpl nodeInstance = (NodeInstanceImpl) conf.getNodeInstance(actualNode, getProcessInstance(), this);
    if (nodeInstance == null) {
        throw new IllegalArgumentException("Illegal node type: " + node.getClass());
    }
    return nodeInstance;
}
Also used : NodeInstanceImpl(org.jbpm.workflow.instance.impl.NodeInstanceImpl) NodeInstanceFactory(org.jbpm.workflow.instance.impl.NodeInstanceFactory) CompositeNode(org.jbpm.workflow.core.node.CompositeNode) StateBasedNode(org.jbpm.workflow.core.node.StateBasedNode) StartNode(org.jbpm.workflow.core.node.StartNode) CompositeNode(org.jbpm.workflow.core.node.CompositeNode) EventSubProcessNode(org.jbpm.workflow.core.node.EventSubProcessNode) AsyncEventNode(org.jbpm.workflow.core.node.AsyncEventNode) 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) AsyncEventNode(org.jbpm.workflow.core.node.AsyncEventNode)

Aggregations

ActionNode (org.jbpm.workflow.core.node.ActionNode)2 AsyncEventNode (org.jbpm.workflow.core.node.AsyncEventNode)2 EndNode (org.jbpm.workflow.core.node.EndNode)2 EventNode (org.jbpm.workflow.core.node.EventNode)2 EventSubProcessNode (org.jbpm.workflow.core.node.EventSubProcessNode)2 StateBasedNode (org.jbpm.workflow.core.node.StateBasedNode)2 Node (org.kie.api.definition.process.Node)2 CompositeNode (org.jbpm.workflow.core.node.CompositeNode)1 DynamicNode (org.jbpm.workflow.core.node.DynamicNode)1 StartNode (org.jbpm.workflow.core.node.StartNode)1 NodeInstanceFactory (org.jbpm.workflow.instance.impl.NodeInstanceFactory)1 NodeInstanceImpl (org.jbpm.workflow.instance.impl.NodeInstanceImpl)1