/** extract the process definition from the factory. This should be * the last method in the chain of subsequent invoked methods on this * factory object. */ public ClientProcessDefinition done() { resolveDestinations(); if (processDefinition.getInitial()==null) { throw new PvmException("no initial node"); } return processDefinition; }
public void initializeProcessInstance(ProcessDefinitionImpl processDefinition, String key) { this.processDefinition = processDefinition; this.node = (NodeImpl) processDefinition.getInitial(); this.processInstance = this; this.state = STATE_CREATED; this.key = key; IdGenerator keyGenerator = Environment.getFromCurrent(IdGenerator.class, false); if (keyGenerator!=null) { this.id = keyGenerator.createId(processDefinition, null, this); } }
/** marks the last created node as the initial node in the process. */ public ProcessFactory initial() { if (node==null) { throw new PvmException("no current node"); } if (processDefinition.getInitial()!=null) { throw new PvmException("duplicate initial node"); } processDefinition.setInitial(node); return this; }
protected ExecutionImpl initializeScopes() { LinkedList<NodeImpl> enteredNodes = new LinkedList<NodeImpl>(); NodeImpl initial = processDefinition.getInitial(); ExecutionImpl scopedExecution = null; if (initial!=null) { enteredNodes.add(initial); NodeImpl parentNode = initial.getParentNode(); while (parentNode!=null) { enteredNodes.addFirst(parentNode); parentNode = parentNode.getParentNode(); } scopedExecution = this; initializeVariables(processDefinition, this); initializeTimers(processDefinition); for (NodeImpl enteredNode: enteredNodes) { if (enteredNode.isLocalScope()) { scopedExecution.setNode(enteredNode); scopedExecution = scopedExecution.createScope(enteredNode); } } scopedExecution.setNode(initial); } return scopedExecution; }