Package org.jbpm.graph.exe

Examples of org.jbpm.graph.exe.ExecutionContext


  public TaskInstance createTaskInstance(Task task) {
    return createTaskInstance(task, (ExecutionContext)null);
  }

  public TaskInstance createTaskInstance(Token token) {
    return createTaskInstance(null, new ExecutionContext(token));
  }
View Full Code Here


  /**
   * creates a new task instance on the given token, for the given task.
   */
  public TaskInstance createTaskInstance(Task task, Token token) {
    ExecutionContext executionContext = new ExecutionContext(token);
    executionContext.setTask(task);
    return createTaskInstance(task, executionContext);
  }
View Full Code Here

   */
  public TaskInstance createStartTaskInstance() {
    TaskInstance taskInstance = null;
    Task startTask = taskMgmtDefinition.getStartTask();
    Token rootToken = processInstance.getRootToken();
    ExecutionContext executionContext = new ExecutionContext(rootToken);
    taskInstance = createTaskInstance(startTask, executionContext);
    taskInstance.setActorId(SecurityHelper.getAuthenticatedActorId());
    return taskInstance;
  }
View Full Code Here

    iter = forkedTokens.iterator();
    while( iter.hasNext() ) {
      ForkedToken forkedToken = (ForkedToken) iter.next();
      Token childToken = forkedToken.token;
      String leavingTransitionName = forkedToken.leavingTransitionName;
      ExecutionContext childExecutionContext = new ExecutionContext(childToken);
      if (leavingTransitionName!=null) {
        leave(childExecutionContext, leavingTransitionName);
      } else {
        leave(childExecutionContext);
      }
View Full Code Here

    this.destination = other.destination;
  }

  public void execute() {
    try {
      ExecutionContext executionContext = new ExecutionContext(token);
      action.execute(executionContext );
    } catch (Exception e) {
      throw new JbpmException("couldn't execute '"+action+"' on '"+token+"'", e);
    }
  }
View Full Code Here

  public void execute() {
    if (! node.equals(token.getNode())) {
      throw new JbpmException("couldn't continue execution for '"+token+"', token moved");
    }
    ExecutionContext executionContext = new ExecutionContext(token);
    node.execute(executionContext);
   
    JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
    if (jbpmContext!=null) {
      jbpmContext.save(token);
View Full Code Here

import org.jbpm.jpdl.el.VariableResolver;

public class JbpmVariableResolver implements VariableResolver {

  public Object resolveVariable(String name) throws ELException {
    ExecutionContext executionContext = ExecutionContext.currentExecutionContext();
    Object value = null;
   
    if ("taskInstance".equals(name)) {
      value = executionContext.getTaskInstance();

    } else if ("processInstance".equals(name)) {
      value = executionContext.getProcessInstance();

    } else if ("processDefinition".equals(name)) {
      value = executionContext.getProcessDefinition();

    } else if ("token".equals(name)) {
      value = executionContext.getToken();

    } else if ("taskMgmtInstance".equals(name)) {
      value = executionContext.getTaskMgmtInstance();
     
    } else if ("contextInstance".equals(name)) {
      value = executionContext.getContextInstance();

    } else if ( (executionContext.getTaskInstance()!=null)
                && (executionContext.getTaskInstance().hasVariableLocally(name))
              ) {
      value = executionContext.getTaskInstance().getVariable(name);

    } else {
      ContextInstance contextInstance = executionContext.getContextInstance();
      Token token = executionContext.getToken();
      value = contextInstance.getVariable(name, token);
    }

    return value;
  }
View Full Code Here

    Token token = processInstance.getRootToken();
        processInstance.getContextInstance().setVariable("v1", helloWorldTokenScope, token);
        processInstance.getContextInstance().setVariable("g2", helloWorldGlobalScope);
        processInstance.getContextInstance().setVariable("h3", objectTokenScope, token);
        processInstance.getContextInstance().setVariable("i4", objectGlobalScope);
        ExecutionContext executionContext = new ExecutionContext(token);

        JBpmObjectMapper mapper = new JBpmObjectMapper();
        Message message = mapper.mapFromJBpmToEsbMessage(bpmToEsbVars, Boolean.FALSE, executionContext);

        assertEquals(helloWorldTokenScope,String.valueOf(message.getBody().get("esbObj1")));
View Full Code Here

        Token token = processInstance.getRootToken();
        processInstance.getContextInstance().createVariable("v1", helloWorldTokenScope, token);
        processInstance.getContextInstance().createVariable("g2", helloWorldGlobalScope);
        processInstance.getContextInstance().createVariable("h3", objectTokenScope, token);
        processInstance.getContextInstance().createVariable("i4", objectGlobalScope);
        ExecutionContext executionContext = new ExecutionContext(token);

        JBpmObjectMapper mapper = new JBpmObjectMapper();
        Message message = mapper.mapFromJBpmToEsbMessage(jbpmToEsbVars, Boolean.FALSE, executionContext);
        assertEquals(message.getBody().getNames().length,0);
    }
View Full Code Here

        Token token = processInstance.getRootToken();
        processInstance.getContextInstance().createVariable("v1", helloWorldTokenScope, token);
        processInstance.getContextInstance().createVariable("g2", helloWorldGlobalScope);
        processInstance.getContextInstance().createVariable("h3", objectTokenScope, token);
        processInstance.getContextInstance().createVariable("i4", objectGlobalScope);
        ExecutionContext executionContext = new ExecutionContext(token);

        JBpmObjectMapper mapper = new JBpmObjectMapper();
        Message message = mapper.mapFromJBpmToEsbMessage(bpmToEsbVars, Boolean.FALSE, executionContext);
        //We should find 2 variables which are named just like their jBPM counterparts.
        assertEquals(message.getBody().getNames().length,4);
View Full Code Here

TOP

Related Classes of org.jbpm.graph.exe.ExecutionContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.