Examples of VariableScope


Examples of org.jbpm.process.core.context.variable.VariableScope

    private static final long serialVersionUID = 510l;
   
    public RuleFlowProcess() {
        setType(RULEFLOW_TYPE);
        // TODO create contexts on request ?
        VariableScope variableScope = new VariableScope();
        addContext(variableScope);
        setDefaultContext(variableScope);
        SwimlaneContext swimLaneContext = new SwimlaneContext();
        addContext(swimLaneContext);
        setDefaultContext(swimLaneContext);
View Full Code Here

Examples of org.jbpm.process.core.context.variable.VariableScope

        if ("code".equals(type)) {
            if (prefix.startsWith("return ")) {
                prefix = prefix.substring(7);
            }
            String result = "rule dummy when eval( ";
            VariableScope variableScope = (VariableScope) process.getDefaultContext(VariableScope.VARIABLE_SCOPE);
            if (variableScope != null) {
                for (Variable variable: variableScope.getVariables()) {
                    DataType type = variable.getType();
                    result +=  type.getStringType() + " " + variable.getName() + "; ";
                }
            }
            return result + prefix;
View Full Code Here

Examples of org.jbpm.process.core.context.variable.VariableScope

    private IPropertyDescriptor[] descriptors;

    public CompositeContextNodeWrapper() {
        setNode(new CompositeContextNode());
        getCompositeNode().setName("CompositeNode");
        VariableScope variableScope = new VariableScope();
        getCompositeContextNode().addContext(variableScope);
        getCompositeContextNode().setDefaultContext(variableScope);
    }
View Full Code Here

Examples of org.jbpm.process.core.context.variable.VariableScope

          "        results = new HashMap<String, Object>();\n" +
          "        // add results here\n";
        }
        for (Map.Entry<String, String> entry: taskNode.getOutMappings().entrySet()) {
          String type = null;
          VariableScope variableScope = (VariableScope) taskNode.resolveContext(VariableScope.VARIABLE_SCOPE, entry.getValue());
          if (variableScope != null) {
            type = variableScope.findVariable(entry.getValue()).getType().getStringType();
          }
          testCode +=
            "        // results.put(\"" + entry.getKey() + "\", value);" + (type == null ? "" : " // type " + type) + "\n";
        }
        testCode +=
View Full Code Here

Examples of org.jbpm.process.core.context.variable.VariableScope

                  task = new TaskDef(taskName);
                  tasks.put(taskName, task);
                }
                for (Map.Entry<String, String> entry: node.getInMappings().entrySet()) {
                  if (task.getInputParams().get(entry.getKey()) == null) {
                    VariableScope variableScope = (VariableScope) node.resolveContext(VariableScope.VARIABLE_SCOPE, entry.getValue());
                        if (variableScope != null) {
                          task.getInputParams().put(entry.getKey(), variableScope.findVariable(entry.getValue()).getType().getStringType());
                        }
                  }
                }
                for (Map.Entry<String, String> entry: node.getOutMappings().entrySet()) {
                  if (task.getOutputParams().get(entry.getKey()) == null) {
                    VariableScope variableScope = (VariableScope) node.resolveContext(VariableScope.VARIABLE_SCOPE, entry.getValue());
                        if (variableScope != null && !"outcome".equals(entry.getKey())) {
                          task.getOutputParams().put(entry.getKey(), variableScope.findVariable(entry.getValue()).getType().getStringType());
                        }
                  }
                }
              }
                WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
View Full Code Here

Examples of org.jbpm.pvm.VariableScope

  /** @see Execution#setVariable(String, Object) */
  public void setVariable(String key, Object value) {
    // first search for the most inner variable scope that has a variable for
    // the given key
    VariableScope variableScope = findVariableScope(key);
   
    // if no variable scope exists for the given variable
    if (variableScope==null) {
      // then take the most outer scope of the process instance
      List<VariableScope> processInstanceVariableScopes = processInstance.getVariableScopes();
      if ( (processInstanceVariableScopes!=null)
           && (! processInstanceVariableScopes.isEmpty())
         ) {
        int lastIndex = processInstanceVariableScopes.size()-1;
        variableScope = processInstanceVariableScopes.get(lastIndex);

      } else { // means the process instance doesn't have a variable scope yet
        // create the most outer variable scope
        variableScope = processInstance.createVariableScope();
      }
    }
    variableScope.set(key, value);
  }
View Full Code Here

Examples of org.jbpm.pvm.VariableScope

      }
    }
  }

  public Object getVariable(String key) {
    VariableScope variableScope = findVariableScope(key);
    if (variableScope!=null) {
      return variableScope.get(key);
    }
    return null;
  }
View Full Code Here

Examples of org.jbpm.pvm.VariableScope

  public Set<String> getVariableKeys() {
    Set<String> variableKeys = new HashSet<String>();
    VariableScopeIterator iter = new VariableScopeIterator(this);
    while (iter.hasNext()) {
      VariableScope variableScope = iter.next();
      Set<String> keys = variableScope.keys();
      if (keys!=null) {
        variableKeys.addAll(keys);
      }
    }
    return variableKeys;
View Full Code Here

Examples of org.jbpm.pvm.VariableScope

 
  public Map<String, Object> getVariables() {
    Map<String, Object> allVariables = new HashMap<String, Object>();
    VariableScopeIterator iter = new VariableScopeIterator(this);
    while (iter.hasNext()) {
      VariableScope variableScope = iter.next();
      Map<String, Object> localVariables = variableScope.getAll();
      if (localVariables!=null) {
        for(String key: localVariables.keySet()) {
          if (! allVariables.containsKey(key)) {
            allVariables.put(key, localVariables.get(key));
          }
View Full Code Here

Examples of org.jbpm.pvm.VariableScope

    return createVariableScope(null);
  }
 
  public VariableScope createVariableScope(List<VariableDefinition> variableDefinitions) {
    log.finest("creating variable scope on "+this);
    VariableScope variableScope = newVariableScope();
    pushVariableScope(variableScope);
    if (variableDefinitions!=null) {
      for (VariableDefinition variableDefinition: variableDefinitions) {
        String variableName = variableDefinition.getName();
        Object initialValue = variableDefinition.getInitialValue(this);
        variableScope.set(variableName, initialValue);
      }
    }
    return variableScope;
  }
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.