Package org.jbpm.pvm.type

Examples of org.jbpm.pvm.type.Variable


    Map<String, Object> values = null;
    if (! isEmpty()) {
      values = new HashMap<String, Object>();
      for (Map.Entry<String, Variable> entry: variables.entrySet()) {
        String name = (String) entry.getKey();
        Variable variable = entry.getValue();
        values.put(name, variable.getValue());
      }
    }
    return values;
  }
View Full Code Here


  public void set(String key, Object value) {
    if (key==null) {
      throw new PvmException("name is null");
    }

    Variable variable = getVariable(key);
    // if there is already a variable instance and it doesn't support the current type...
    if ( (variable!=null)
         && (!variable.supports(value))
       ) {
      // delete the old variable instance
      log.fine("variable type change. deleting '"+key+"' from '"+this+"'");
      removeVariable(key);
      variable = null;
    }

    if (variable==null) {
      log.fine("create variable '"+key+"' in '"+this+"' with value '"+value+"'");
      variable = createVariable(key, value);
      setVariable(variable);
    } else {
      log.fine("update variable '"+key+"' in '"+this+"' to value '"+value+"'");
      variable.setValue(value);
    }
  }
View Full Code Here

  // internal methods /////////////////////////////////////////////////////////
 
  protected Variable createVariable(String key, Object value) {
 
    Variable variable = null;
    if (value==null) {
      log.finest("creating null variable for "+key);
      variable = new NullVariable();
    } else {
   
      Environment environment = Environment.getCurrent();
      if (environment!=null) {
        VariableTypeResolver variableTypeResolver = environment.get(VariableTypeResolver.class);
        if (variableTypeResolver!=null) {
          variable = variableTypeResolver.createVariable(key, value, this);
        }
      }
   
      if (variable==null) {
        log.finest("creating new unpersistable variable for "+key);
        variable = new UnpersistableVariable();
      }
    }
   
    variable.setName(key);
    variable.setExecution(execution);
    variable.setProcessInstance(processInstance);
    variable.setValue(value);
    // TODO add create-variable-log
   
    return variable;
  }
View Full Code Here

TOP

Related Classes of org.jbpm.pvm.type.Variable

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.