use of org.jbpm.workflow.instance.impl.NodeInstanceFactory 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;
}
Aggregations