Package org.jbpm.pvm.internal.type

Examples of org.jbpm.pvm.internal.type.Variable


  public void createSystemVariable(String key, Object value) {
    createSystemVariable(key, value, null);
  }

  public void createSystemVariable(String key, Object value, String typeName) {
    Variable variable = createVariableObject(key, value, typeName, false);
    systemVariables.put(variable.getKey(), variable);
  }
View Full Code Here


    Variable variable = createVariableObject(key, value, typeName, false);
    systemVariables.put(variable.getKey(), variable);
  }

  public void setSystemVariable(String key, Object value) {
    Variable variable = systemVariables.get(key);
    if (variable!=null) {
      log.debug("setting system variable '"+key+"' in '"+this+"' to value '"+value+"'");
      variable.setValue(value);
    } else {
      log.debug("creating system variable '"+key+"' in '"+this+"' to value '"+value+"'");
      createSystemVariable(key, value, null);
    }
  }
View Full Code Here

      createSystemVariable(key, value, null);
    }
  }
 
  public Object getSystemVariable(String key) {
    Variable variable = systemVariables.get(key);
    if (variable!=null) {
      return variable.getValue();
    }
    return null;
  }
View Full Code Here

  public void createVariable(String key, Object value) {
    createVariable(key, value, null, false);
  }

  public void createVariable(String key, Object value, String typeName, boolean isHistoryEnabled) {
    Variable variable = createVariableObject(key, value, typeName, isHistoryEnabled);
    variables.put(variable.getKey(), variable);
    hasVariables = true;
  }
View Full Code Here

          type = typeSet.findTypeByMatch(key, value);
        }
      }
    }
   
    Variable variable = null;

    if (type!=null) {
      Class<?> variableClass = type.getVariableClass();
      try {
        log.trace("creating new "+type+" variable "+key);
        variable = (Variable) variableClass.newInstance();
      } catch (Exception e) {
        throw new JbpmException("couldn't instantiate variable instance class '"+variableClass.getName()+"'");
      }
      Converter converter = type.getConverter();
      variable.setConverter(converter);

    } else {
      if (value==null) {
        log.trace("creating null variable for "+key);
        variable = new NullVariable();
      } else {
        log.trace("creating new unpersistable variable for "+key);
        variable = new UnpersistableVariable();
      }
    }

    variable.setKey(key);
    variable.setExecution(getExecution());
    variable.setTask(getTask());
    variable.setHistoryEnabled(isHistoryEnabled);

    if (isHistoryEnabled) {
      HistoryEvent.fire(new VariableCreate(variable));
    }
   
    variable.setValue(value);

    return variable;
  }
View Full Code Here

    return variable;
  }

  public void setVariable(String key, Object value) {
    Variable variable = getVariableObject(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.debug("variable type change. deleting '"+key+"' from '"+this+"'");
      removeVariable(key);
      variable = null;
    }

    if (variable!=null) {
      log.debug("updating variable '"+key+"' in '"+this+"' to value '"+value+"'");
      variable.setValue(value);

    } else if (getParentVariableScope()==null) {
      createVariable(key, value, null, false);

    } else {
View Full Code Here

      }
    }
  }
 
  public Object getVariable(String key) {
    Variable variable = getVariableObject(key);
    if (variable!=null) {
      return variable.getValue();
    }
   
    ScopeInstanceImpl parentScope = getParentVariableScope();
    if (parentScope!=null) {
      return parentScope.getVariable(key);
View Full Code Here

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

             || (parentScope!=null && parentScope.hasVariables())
           );
  }

  public boolean removeVariable(String key) {
    Variable variable = null;
    if (hasVariables) {
      variable = variables.remove(key);
      if (variables.isEmpty()) {
        hasVariables = false;
      }
View Full Code Here

  public void createVariable(String key, Object value) {
    createVariable(key, value, null, false);
  }

  public void createVariable(String key, Object value, String typeName, boolean isHistoryEnabled) {
    Variable variable = createVariableObject(key, value, typeName, isHistoryEnabled);
    variables.put(variable.getKey(), variable);
    hasVariables = true;
  }
View Full Code Here

TOP

Related Classes of org.jbpm.pvm.internal.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.