Package org.jbpm.context.exe

Examples of org.jbpm.context.exe.ContextInstance


            boolean updated = false;

            final Object targetValue = targetExpression.getValue(elContext);
            if (targetValue instanceof ProcessInstance) {
                final ProcessInstance processInstance = (ProcessInstance) targetValue;
                final ContextInstance contextInstance = processInstance.getContextInstance();
                for (String name : deletes) {
                    contextInstance.deleteVariable(name);
                    updated = true;
                }
                for (String name : updates) {
                    contextInstance.setVariable(name, updatesHashMap.get(name));
                    updated = true;
                }
            } else if (targetValue instanceof Token) {
                final Token token = (Token) targetValue;
                final ProcessInstance processInstance = token.getProcessInstance();
                final ContextInstance contextInstance = processInstance.getContextInstance();
                for (String name : deletes) {
                    contextInstance.deleteVariable(name, token);
                    updated = true;
                }
                for (String name : updates) {
                    contextInstance.setVariable(name, updatesHashMap.get(name), token);
                    updated = true;
                }
            } else if (targetValue instanceof TaskInstance) {
                final TaskInstance task = (TaskInstance) targetValue;
                for (String name : deletes) {
View Full Code Here


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

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

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

    // 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

                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

    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

      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

    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

            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

    fireStartEvent(initialNode);
  }

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

      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

TOP

Related Classes of org.jbpm.context.exe.ContextInstance

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.