public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException { ExecutionImpl execution = createExecution(owner); String nodeName = rs.getString(names[0]); NodeImpl node = (NodeImpl) execution.getProcessDefinition().getNode(nodeName); execution.setNode(node); execution.setState(Execution.STATE_ACTIVE); return execution; }
public void execute(ExecutionImpl execution) { List<Activity> startActivities = findStartActivities(execution); if (!startActivities.isEmpty()) { ExecutionImpl parent = execution.createScope(execution.getActivity()); for (Activity startActivity: startActivities) { parent.setState(Execution.STATE_INACTIVE_CONCURRENT_ROOT); ExecutionImpl concurrentExecution = parent.createExecution(); concurrentExecution.setState(Execution.STATE_ACTIVE_CONCURRENT); concurrentExecution.execute(startActivity); } } else { throw new JbpmException("Could not find start activity for the sub-process " + execution.getActivityName()); } }
/** * Joins all the incoming executions currently waiting at the gateway. * * @return An execution that can be used to leave the gateway (one outgoing sequence flow) * or to create child executions on (fork behaviour when multiple outgoing sequence flow). */ protected ExecutionImpl join(ExecutionImpl execution) { Activity activity = execution.getActivity(); ExecutionImpl concurrentRoot = execution.getParent(); if (concurrentRoot == null) { return execution; } List<ExecutionImpl> joinedExecutions = getJoinedExecutions(concurrentRoot, activity); endJoinedExecutions(joinedExecutions); ExecutionImpl outgoingExecution = null; if (concurrentRoot.getExecutions().size() == 0) { outgoingExecution = concurrentRoot; outgoingExecution.setState(Execution.STATE_ACTIVE_ROOT); } else { outgoingExecution = concurrentRoot.createExecution(); outgoingExecution.setState(Execution.STATE_ACTIVE_CONCURRENT); } outgoingExecution.setActivity(activity); return outgoingExecution; }
/** * Joins the incoming executions. * Returns true if all executions have reached the gateway. */ protected boolean handleIncomingExecution(ExecutionImpl execution) { if (Execution.STATE_ACTIVE_CONCURRENT.equals(execution.getState())) { // force version increment in the parent execution Session session = EnvironmentImpl.getFromCurrent(Session.class); session.lock(execution.getParent(), lockMode); execution.setState(Execution.STATE_INACTIVE_JOIN); } execution.waitForSignal(); return isComplete(execution); }
if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) { concurrentRoot = execution; execution.setState(Execution.STATE_INACTIVE_CONCURRENT_ROOT); execution.setActivity(null); } else if (Execution.STATE_ACTIVE_CONCURRENT.equals(execution.getState())) { ExecutionImpl concurrentExecution = concurrentRoot.createExecution(transition.getName()); concurrentExecution.setActivity(activity); concurrentExecution.setState(Execution.STATE_ACTIVE_CONCURRENT); childExecutionsMap.put(transition, concurrentExecution);