public static Object getFromCurrent(String name) { return getFromCurrent(name, true); }
public static <T> T getFromCurrent(Class<T> type) { return getFromCurrent(type, true); }
public void initializeProcessInstance( final ProcessDefinitionImpl processDefinition, final String key) { this.processDefinition = processDefinition; this.node = processDefinition.getInitial(); this.processInstance = this; this.state = STATE_CREATED; this.key = key; final IdGenerator keyGenerator = Environment.getFromCurrent(IdGenerator.class, false); if (keyGenerator != null) { this.id = keyGenerator.createId(processDefinition, null, this); } }
public String createId(ProcessDefinition processDefinition, Execution parent, Execution execution) { String base = null; if (parent != null) { base = parent.getId(); } else { base = processDefinition.getId(); } String executionPart = null; if (execution.getKey() != null) { executionPart = execution.getKey(); } else if (execution.getName() != null) { executionPart = execution.getName(); } else { ExecutionImpl executionImpl = (ExecutionImpl) execution; Session session = Environment.getFromCurrent(Session.class); session.save(executionImpl); executionPart = Long.toString(executionImpl.getDbid()); } return base + "/" + executionPart; }
/** @see Execution#createProcessInstance(String) */ public ExecutionImpl createExecution(final String name) { // creating a child execution implies that this execution // is not a leave any more and therefore, it is inactivated if (isActive()) { lock(STATE_INACTIVE); this.propagation = Propagation.EXPLICIT; } // create child execution final ExecutionImpl childExecution = newChildExecution(); childExecution.processDefinition = this.processDefinition; childExecution.processInstance = this.processInstance; childExecution.node = this.node; childExecution.state = STATE_ACTIVE; childExecution.name = name; log.debug("creating " + childExecution); // add it to this execution addExecution(childExecution); // invalidate the cached executionsMap this.executionsMap = null; final IdGenerator keyGenerator = Environment.getFromCurrent(IdGenerator.class, false); if (keyGenerator != null) { childExecution.id = keyGenerator.createId(this.processDefinition, this, childExecution); } return childExecution; }