public Object resolveVariable(String name) throws ELException { ExecutionContext executionContext = ExecutionContext.currentExecutionContext(); if ("taskInstance".equals(name)) return executionContext.getTaskInstance(); if ("processInstance".equals(name)) return executionContext.getProcessInstance(); if ("processDefinition".equals(name)) return executionContext.getProcessDefinition(); if ("token".equals(name)) return executionContext.getToken(); if ("taskMgmtInstance".equals(name)) return executionContext.getTaskMgmtInstance(); if ("contextInstance".equals(name)) return executionContext.getContextInstance(); TaskInstance taskInstance = executionContext.getTaskInstance(); if (taskInstance != null && taskInstance.hasVariableLocally(name)) { return taskInstance.getVariable(name); ContextInstance contextInstance = executionContext.getContextInstance(); if (contextInstance != null) { Token token = executionContext.getToken(); if (contextInstance.hasVariable(name, token)) { return contextInstance.getVariable(name); TaskMgmtInstance taskMgmtInstance = executionContext.getTaskMgmtInstance(); if (taskMgmtInstance != null) { SwimlaneInstance swimlaneInstance = taskMgmtInstance.getSwimlaneInstance(name);
/** * leave this node over the default transition. This method is only available * on node actions. Not on actions that are executed on events. Actions on * events cannot change the flow of execution. */ public void leaveNode() { getNode().leave(this); }
public void execute(ExecutionContext ctx) throws Exception { ctx.setVariable(_PROMPT_, prompt); if (end) { // make transition ctx.leaveNode(); } }
/** * creates an instance of the given task, for the given token. */ public TaskInstance createTaskInstance(Task task, Token token) { ExecutionContext executionContext = new ExecutionContext(token); executionContext.setTask(task); return createTaskInstance(task, executionContext); }
public String decide(ExecutionContext ctx) throws Exception { //get what we got from user String input = (String) ctx.getVariable(_INPUT_); Map transitions = ctx.getNode().getLeavingTransitionsMap(); if(transitions.get(input) == null) { return _END_; }else { return ""+input; } }
public Map createInputMap(ExecutionContext executionContext) { Token token = executionContext.getToken(); inputMap.put("node", executionContext.getNode()); inputMap.put("task", executionContext.getTask()); inputMap.put("taskInstance", executionContext.getTaskInstance()); ContextInstance contextInstance = executionContext.getContextInstance(); if (!hasReadableVariable()) {
protected Timer createTimer(ExecutionContext executionContext) { Timer timer = new Timer(executionContext.getToken()); timer.setName(timerName); timer.setRepeat(repeat); timer.setGraphElement(executionContext.getEventSource()); timer.setTaskInstance(executionContext.getTaskInstance()); if (event != null && (graphElement = event.getGraphElement()) != null) { try { executionContext.setTimer(timer); executionContext.setTimer(null);
public void fireEvent(String eventType, ExecutionContext executionContext) { Token token = executionContext.getToken(); if (log.isDebugEnabled()) log.debug(token + " fires event '" + eventType + "' on " + this); GraphElement eventSource = executionContext.getEventSource(); try { executionContext.setEventSource(this); JbpmContext jbpmContext = executionContext.getJbpmContext(); if (jbpmContext != null) { EventService eventService = (EventService) jbpmContext.getServices() .getService(EventService.SERVICE_NAME); if (eventService != null) eventService.fireEvent(eventType, this, executionContext); } fireAndPropagateEvent(eventType, executionContext); } finally { executionContext.setEventSource(eventSource); } }
.getProcessDefinition()); Thread.currentThread().setContextClassLoader(processClassLoader); log.debug(executionContext.getToken() + " leaves " + this + " over " + transition); executionContext.leaveNode(transition);
private void setVariables(Map outputMap, ExecutionContext executionContext) { if (variableAccesses == null) return; ContextInstance contextInstance = executionContext.getContextInstance(); Token token = executionContext.getToken(); for (Iterator iter = variableAccesses.iterator(); iter.hasNext();) { VariableAccess variableAccess = (VariableAccess) iter.next(); if (variableAccess.isWritable()) { Object value = outputMap.get(variableAccess.getMappedName()); contextInstance.setVariable(variableAccess.getVariableName(), value, token); } } }
/** * * @param context * @param payload */ static void preparePayload(ExecutionContext context, String payload) { context.getContextInstance().setTransientVariable(VariableConstants.payload, payload); } }
public void execute(ExecutionContext executionContext) throws Exception { SchedulerService schedulerService = executionContext.getJbpmContext().getServices().getSchedulerService(); schedulerService.deleteTimersByName(timerName, executionContext.getToken()); }
/** * is the collection of {@link TaskInstance}s for the given token that can trigger the token * to continue. */ public Collection getSignallingTasks(ExecutionContext executionContext) { Collection signallingTasks = new ArrayList(); if (taskInstances != null) { for (Iterator i = taskInstances.iterator(); i.hasNext();) { TaskInstance taskInstance = (TaskInstance) i.next(); if (taskInstance.isSignalling() && (executionContext.getToken().equals(taskInstance.getToken()))) { signallingTasks.add(taskInstance); } } } return signallingTasks; }
public void execute(ExecutionContext executionContext) { if ("true".equalsIgnoreCase(endCompleteProcess)) { executionContext.getProcessInstance().end(); } else { executionContext.getToken().end(); } }
public boolean execute(JbpmContext jbpmContext) throws Exception { Token token = getToken(); ExecutionContext executionContext = new ExecutionContext(token); executionContext.setAction(action); executionContext.setEvent(action.getEvent()); Node node; if (token != null && (node = token.getNode()) != null) { node.executeAction(action, executionContext); } else { action.execute(executionContext); } return true; }
/** * can optionally be used to indicate that the actor is starting to work on this task * instance. */ public void start() { if (start != null) { throw new IllegalStateException(this + " is already started"); } start = Clock.getCurrentTime(); // fire task start event if (token != null && task != null) { ExecutionContext executionContext = new ExecutionContext(token); executionContext.setTask(task); executionContext.setTaskInstance(this); task.fireEvent(Event.EVENTTYPE_TASK_START, executionContext); } }
/** * sends a signal to this token. leaves the current {@link #getNode() node} over the given * transition. */ public void signal(Transition transition) { signal(transition, new ExecutionContext(this)); }
/** * called by the implementation of this node to continue execution over the given transition. */ public void leave(ExecutionContext executionContext, Transition transition) { if (transition == null) throw new JbpmException("transition is null"); Token token = executionContext.getToken(); token.setNode(this); executionContext.setTransition(transition); // fire the leave-node event for this node fireEvent(Event.EVENTTYPE_NODE_LEAVE, executionContext); // log this node if (token.getNodeEnter() != null) { addNodeLog(token); } // update the runtime information for taking the transition // the transitionSource is used to calculate events on superstates executionContext.setTransitionSource(this); // take the transition transition.take(executionContext); }
public void leave(ExecutionContext executionContext, Transition transition) { TaskMgmtInstance tmi = executionContext.getTaskMgmtInstance(); Token token = executionContext.getToken(); if (tmi.hasBlockingTaskInstances(token)) { throw new IllegalStateException(this + " still has blocking tasks"); } removeTaskInstanceSynchronization(token); super.leave(executionContext, transition); }
.getProcessDefinition()); Thread.currentThread().setContextClassLoader(processClassLoader); GraphElement eventSource = executionContext.getEventSource(); if (eventSource == null) { throw e instanceof JbpmException ? (JbpmException) e