Examples of ContextInstance


Examples of org.jbpm.context.exe.ContextInstance

    // feed the readable variableInstances
    if ((variableAccesses != null) && (!variableAccesses.isEmpty()))
    {

      ContextInstance superContextInstance = executionContext.getContextInstance();
      ContextInstance subContextInstance = subProcessInstance.getContextInstance();

      // loop over all the variable accesses
      for (VariableAccess variableAccess : variableAccesses)
      {
        // if this variable access is writable
        if (variableAccess.isWritable())
        {
          // the variable is copied from the sub process mapped name
          // to the super process variable name
          String mappedName = variableAccess.getMappedName();
          Object value = subContextInstance.getVariable(mappedName);
          String variableName = variableAccess.getVariableName();
          log.debug("copying sub process var '" + mappedName + "' to super process var '" + variableName + "': " + value);
          if (value != null)
          {
            superContextInstance.setVariable(variableName, value, superProcessToken);
View Full Code Here

Examples of org.jbpm.context.exe.ContextInstance

                final TaskInstance task = (TaskInstance) entity;
                oldValue = task.getVariable(name);
                task.setVariable(name, value);
            } else if (entity instanceof Token) {
                final Token token = (Token) entity;
                final ContextInstance contextInstance = token.getProcessInstance().getContextInstance();
                oldValue = contextInstance.getVariable(name, token);
                contextInstance.setVariable(name, value, token);
            } else if (entity instanceof ProcessInstance) {
                final ProcessInstance processInstance = (ProcessInstance) entity;
                final ContextInstance contextInstance = processInstance.getContextInstance();
                oldValue = contextInstance.getVariable(name);
                contextInstance.setVariable(name, value);
            } else {
                context.setError("Error updating variable", "The value given for the 'entity' attribute is not a task, token, or process instance");
                return;
            }
            if (oldValueTargetExpression != null) {
View Full Code Here

Examples of org.jbpm.context.exe.ContextInstance

    Node node = token.getNode();
    return node.getLeavingTransitionsMap().keySet();
  }

  protected void storeTransitionNames(Collection<String> transitionNames, Token token) {
    ContextInstance ci = token.getProcessInstance().getContextInstance();
    if (ci == null)
      throw new JbpmException("an interleave start node requires the availability of a context");
    ci.setVariable(variableName, transitionNames, token);
  }
View Full Code Here

Examples of org.jbpm.context.exe.ContextInstance

      throw new JbpmException("an interleave start node requires the availability of a context");
    ci.setVariable(variableName, transitionNames, token);
  }

  public Collection<String> retrieveTransitionNames(Token token) {
    ContextInstance ci = token.getProcessInstance().getContextInstance();
    Collection<?> collection = (Collection<?>) ci.getVariable(variableName, token);
    return collection != null ? CollectionUtil.checkCollection(collection, String.class) : null;
  }
View Full Code Here

Examples of org.jbpm.context.exe.ContextInstance

    Collection<?> collection = (Collection<?>) ci.getVariable(variableName, token);
    return collection != null ? CollectionUtil.checkCollection(collection, String.class) : null;
  }

  public void removeTransitionNames(Token token) {
    ContextInstance ci = token.getProcessInstance().getContextInstance();
    ci.setVariable(variableName,null, token);
  }
View Full Code Here

Examples of org.jbpm.context.exe.ContextInstance

            if (entity instanceof TaskInstance) {
                final TaskInstance task = (TaskInstance) entity;
                value = task.getVariable(name);
            } else if (entity instanceof Token) {
                final Token token = (Token) entity;
                final ContextInstance contextInstance = token.getProcessInstance().getContextInstance();
                value = contextInstance.getVariable(name, token);
            } else if (entity instanceof ProcessInstance) {
                final ProcessInstance processInstance = (ProcessInstance) entity;
                final ContextInstance contextInstance = processInstance.getContextInstance();
                value = contextInstance.getVariable(name);
            } else {
                context.setError("Error getting variable", "The value given for the 'entity' attribute is not a task, token, or process instance");
                return;
            }
            targetExpression.setValue(elContext, value);
View Full Code Here

Examples of org.jbpm.context.exe.ContextInstance

    fireStartEvent(initialNode);
  }

  public void addInitialContextVariables(Map<String, Object> variables)
  {
    ContextInstance contextInstance = getContextInstance();
    if ((contextInstance != null) && (variables != null))
    {
      contextInstance.addVariables(variables);
    }
  }
View Full Code Here

Examples of org.jbpm.context.exe.ContextInstance

      result = processInstance;
    }

    if (variables != null)
    {
      ContextInstance contextInstance = processInstance.getContextInstance();
      Iterator iter = variables.keySet().iterator();
      while (iter.hasNext())
      {
        String variableName = (String)iter.next();
        contextInstance.setVariable(variableName, variables.get(variableName));
      }
    }

    jbpmContext.save(processInstance);
View Full Code Here

Examples of org.jbpm.context.exe.ContextInstance

      "</process-definition>"
    );
    processDefinition = saveAndReload(processDefinition);
   
    ProcessInstance processInstance = new ProcessInstance(processDefinition);
    ContextInstance contextInstance = processInstance.getContextInstance();
    contextInstance.setVariable("a", "value a");
    contextInstance.setVariable("b", "value b");
    processInstance.signal();
    jbpmContext.save(processInstance);

    commitAndCloseSession();

    SchedulerThread schedulerThread = new SchedulerThread(jbpmConfiguration);
    schedulerThread.executeTimers();
   
    beginSessionTransaction();
   
    processInstance = jbpmContext.loadProcessInstance(processInstance.getId());
    contextInstance = processInstance.getContextInstance();
   
    assertEquals("value a", contextInstance.getVariable("a") );
    assertEquals("value b updated", contextInstance.getVariable("b") );
   
    TaskInstance taskInstance = (TaskInstance) processInstance.getTaskMgmtInstance().getTaskInstances().iterator().next();
    assertEquals("value a updated", taskInstance.getVariable("a") );
    assertEquals("value b updated", taskInstance.getVariable("b") );
  }
View Full Code Here

Examples of org.jbpm.context.exe.ContextInstance

  public void testStates() {
    log.info("");
    log.info("=== CREATING PROCESS INSTANCE =======================================================");
    log.info("");
    ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate("states");
    ContextInstance contextInstance = processInstance.getContextInstance();
    contextInstance.setVariable("hotel", "best western");
    contextInstance.setVariable("city", "wengen");
    contextInstance.setVariable("ski conditions", "excellent");
    contextInstance.setVariable("slopes", "well prepared and sunny");
    contextInstance.setVariable("food", "just enough");
    processInstance.signal();

    newTransaction();
   
    log.info("");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.