Examples of VariableScopeInstance


Examples of org.jbpm.process.instance.context.variable.VariableScopeInstance

      }
      return variableScope.getVariable(variableName);
    }
   
    public void setVariable(String variableName, Object value) {
      VariableScopeInstance variableScope = (VariableScopeInstance)
        resolveContextInstance(VariableScope.VARIABLE_SCOPE, variableName);
      if (variableScope == null) {
        variableScope = (VariableScopeInstance) getProcessInstance().getContextInstance(VariableScope.VARIABLE_SCOPE);
        if (variableScope.getVariableScope().findVariable(variableName) == null) {
          variableScope = null;
        }
      }
      if (variableScope == null) {
        System.err.println("Could not find variable " + variableName);
        System.err.println("Using process-level scope");
        variableScope = (VariableScopeInstance) ((ProcessInstance)
          getProcessInstance()).getContextInstance(VariableScope.VARIABLE_SCOPE);
      }
      variableScope.setVariable(variableName, value);
    }
View Full Code Here

Examples of org.jbpm.process.instance.context.variable.VariableScopeInstance

              List<NodeInstance> nodeInstances = new ArrayList<NodeInstance>();
              for (Object o: collection) {
                String variableName = getForEachNode().getVariableName();
                NodeInstance nodeInstance = (NodeInstance)
                ((NodeInstanceContainer) getNodeInstanceContainer()).getNodeInstance(getForEachSplitNode().getTo().getTo());
                VariableScopeInstance variableScopeInstance = (VariableScopeInstance)
                  nodeInstance.resolveContextInstance(VariableScope.VARIABLE_SCOPE, variableName);
                variableScopeInstance.setVariable(variableName, o);
                nodeInstances.add(nodeInstance);
              }
              for (NodeInstance nodeInstance: nodeInstances) {
                ((org.jbpm.workflow.instance.NodeInstance) nodeInstance).trigger(this, getForEachSplitNode().getTo().getToType());
              }
View Full Code Here

Examples of org.jbpm.process.instance.context.variable.VariableScopeInstance

        }

        private Collection<?> evaluateCollectionExpression(String collectionExpression) {
            // TODO: should evaluate this expression using MVEL
          Object collection = null;
            VariableScopeInstance variableScopeInstance = (VariableScopeInstance)
                resolveContextInstance(VariableScope.VARIABLE_SCOPE, collectionExpression);
            if (variableScopeInstance != null) {
              collection = variableScopeInstance.getVariable(collectionExpression);
            } else {
              try {
                collection = MVEL.eval(collectionExpression, new NodeInstanceResolverFactory(this));
              } catch (Throwable t) {
                throw new IllegalArgumentException(
View Full Code Here

Examples of org.jbpm.process.instance.context.variable.VariableScopeInstance

            for (NodeInstance nodeInstance: groupNodeInstances) {
              stream.writeLong(nodeInstance.getId());
            }
          }
        }
        VariableScopeInstance variableScopeInstance = (VariableScopeInstance) workFlow.getContextInstance(VariableScope.VARIABLE_SCOPE);
        Map<String, Object> variables = variableScopeInstance.getVariables();
        List<String> keys = new ArrayList<String>(variables.keySet());
        Collection<Object> values = variables.values();
       
        Collections.sort(keys,
                new Comparator<String>() {
View Full Code Here

Examples of org.jbpm.process.instance.context.variable.VariableScopeInstance

                    stream.writeLong(id);
                }
            } else {
                stream.writeInt(0);
            }
            VariableScopeInstance variableScopeInstance = (VariableScopeInstance) compositeNodeInstance.getContextInstance(VariableScope.VARIABLE_SCOPE);
            if (variableScopeInstance == null) {
              stream.writeInt(0);
            } else {
              Map<String, Object> variables = variableScopeInstance.getVariables();
              List<String> keys = new ArrayList<String>(variables.keySet());
              Collections.sort(keys,
                      new Comparator<String>() {
                          public int compare(String o1,
                                  String o2) {
View Full Code Here

Examples of org.jbpm.process.instance.context.variable.VariableScopeInstance

            // - Marshalled Object
    int nbVariables = stream.readInt();
    if (nbVariables > 0) {
      Context variableScope = ((org.jbpm.process.core.Process) process)
          .getDefaultContext(VariableScope.VARIABLE_SCOPE);
      VariableScopeInstance variableScopeInstance = (VariableScopeInstance) processInstance
          .getContextInstance(variableScope);
      for (int i = 0; i < nbVariables; i++) {
        String name = stream.readUTF();
        try {
          int index = stream.readInt();
          ObjectMarshallingStrategy strategy = context.resolverStrategyFactory
              .getStrategy(index);

          Object value = strategy.read(stream);
          variableScopeInstance.internalSetVariable(name, value);
        } catch (ClassNotFoundException e) {
          throw new IllegalArgumentException(
              "Could not reload variable " + name);
        }
      }
View Full Code Here

Examples of org.jbpm.process.instance.context.variable.VariableScopeInstance

                }
                String n = join.getN();
                Integer number = null;
                if (n.startsWith("#{") && n.endsWith("}")) {
                  n = n.substring(2, n.length() - 1);
                  VariableScopeInstance variableScopeInstance = (VariableScopeInstance)
                    resolveContextInstance(VariableScope.VARIABLE_SCOPE, n);
                  if (variableScopeInstance == null) {
                    throw new IllegalArgumentException(
                    "Could not find variable " + n + " when executing join.");
                  }
                  Object value = variableScopeInstance.getVariable(n);
                  if (value instanceof Number) {
                    number = ((Number) value).intValue();
                  } else {
                    throw new IllegalArgumentException(
                    "Variable " + n + " did not return a number when executing join: " + value);
View Full Code Here

Examples of org.jbpm.process.instance.context.variable.VariableScopeInstance

            case PersisterEnums.DYNAMIC_NODE_INSTANCE:
                int nbVariables = stream.readInt();
                if (nbVariables > 0) {
                    Context variableScope = ((org.jbpm.process.core.Process) ((org.jbpm.process.instance.ProcessInstance)
                    processInstance).getProcess()).getDefaultContext(VariableScope.VARIABLE_SCOPE);
                    VariableScopeInstance variableScopeInstance = (VariableScopeInstance) ((CompositeContextNodeInstance) nodeInstance).getContextInstance(variableScope);
                    for (int i = 0; i < nbVariables; i++) {
                        String name = stream.readUTF();
                        try {
                            Object value = stream.readObject();
                            variableScopeInstance.internalSetVariable(name, value);
                        } catch (ClassNotFoundException e) {
                            throw new IllegalArgumentException("Could not reload variable " + name);
                        }
                    }
                }
View Full Code Here

Examples of org.jbpm.process.instance.context.variable.VariableScopeInstance

        }
      }
      return null;
    }
    // else retrieve the variable scope
    VariableScopeInstance variableScopeInstance = (VariableScopeInstance)
      getContextInstance(VariableScope.VARIABLE_SCOPE);
    if (variableScopeInstance == null) {
      return null;
    }
    return variableScopeInstance.getVariable(name);
  }
View Full Code Here

Examples of org.jbpm.process.instance.context.variable.VariableScopeInstance

                result.putAll(variables);
            }
            return result;
        }
        // else retrieve the variable scope
        VariableScopeInstance variableScopeInstance = (VariableScopeInstance)
            getContextInstance(VariableScope.VARIABLE_SCOPE);
        if (variableScopeInstance == null) {
            return null;
        }
        return variableScopeInstance.getVariables();
  }
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.