Package org.jbpm.context.def

Examples of org.jbpm.context.def.VariableAccess


  Map getVariableNames() {
    Map variableNames = new HashMap();
    Iterator iter = variableAccesses.iterator();
    while (iter.hasNext()) {
      VariableAccess variableAccess = (VariableAccess) iter.next();
      if (variableAccess.isWritable()) {
        variableNames.put(variableAccess.getMappedName(), variableAccess.getVariableName());
      }
    }
    return variableNames;
  }
View Full Code Here


      ContextInstance contextInstance = processInstance.getContextInstance();

      if (variableAccesses!=null) {
        Iterator iter = variableAccesses.iterator();
        while (iter.hasNext()) {
          VariableAccess variableAccess = (VariableAccess) iter.next();
          String mappedName = variableAccess.getMappedName();
          if (variableAccess.isReadable()) {
            String variableName = variableAccess.getVariableName();
            Object value = contextInstance.getVariable(variableName, token);
            log.debug("creating task instance variable '"+mappedName+"' from process variable '"+variableName+"', value '"+value+"'");
            taskInstance.setVariableLocally(mappedName, value);
          } else {
            log.debug("creating task instance local variable '"+mappedName+"'. initializing with null value.");
View Full Code Here

      if (variableAccesses!=null) {
        String missingTaskVariables = null;
        Iterator iter = variableAccesses.iterator();
        while (iter.hasNext()) {
          VariableAccess variableAccess = (VariableAccess) iter.next();
          String mappedName = variableAccess.getMappedName();
          // first check if the required variableInstances are present
          if ( (variableAccess.isRequired())
               && (! taskInstance.hasVariableLocally(mappedName))
             ) {
            if (missingTaskVariables==null) {
              missingTaskVariables = mappedName;
            } else {
              missingTaskVariables += ", "+mappedName;
            }
          }
        }

        // if there are missing, required parameters, throw an IllegalArgumentException
        if (missingTaskVariables!=null) {
          throw new IllegalArgumentException("missing task variables: "+missingTaskVariables);
        }

        iter = variableAccesses.iterator();
        while (iter.hasNext()) {
          VariableAccess variableAccess = (VariableAccess) iter.next();
          String mappedName = variableAccess.getMappedName();
          String variableName = variableAccess.getVariableName();
          if (variableAccess.isWritable()) {
            Object value = taskInstance.getVariable(mappedName);
            if (value!=null) {
              log.debug("submitting task variable '"+mappedName+"' to process variable '"+variableName+"', value '"+value+"'");
              contextInstance.setVariable(variableName, value, token);
            }
View Full Code Here

      subContextInstance.setTransientVariables(superContextInstance.getTransientVariables());

      // loop over all the variable accesses
      Iterator iter = variableAccesses.iterator();
      while (iter.hasNext()) {
        VariableAccess variableAccess = (VariableAccess) iter.next();
        // 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

      ContextInstance subContextInstance = subProcessInstance.getContextInstance();

      // loop over all the variable accesses
      Iterator iter = variableAccesses.iterator();
      while (iter.hasNext()) {
        VariableAccess variableAccess = (VariableAccess) iter.next();
        // 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

    TaskController taskController = taskInstance.getTask().getTaskController();
    if (taskController!=null) {
      List variableAccesses = taskController.getVariableAccesses();
      Iterator iter = variableAccesses.iterator();
      while (iter.hasNext()) {
        VariableAccess variableAccess = (VariableAccess) iter.next();
        String mappedName = variableAccess.getMappedName();
        Object value = taskInstance.getVariable(mappedName);
        TaskFormParameter tfp = new TaskFormParameter(variableAccess, value);
        taskFormParameters.add(tfp);
      }
    }
View Full Code Here

        addProblem(new Problem(Problem.LEVEL_WARNING, "the name attribute of a variable element is required: "+variableElement.asXML()));
      }
      String access = variableElement.attributeValue("access", "read,write");
      String mappedName = variableElement.attributeValue("mapped-name");
     
      variableAccesses.add(new VariableAccess(variableName, access, mappedName));
    }
    return variableAccesses;
  }
View Full Code Here

      subContextInstance.setTransientVariables(superContextInstance.getTransientVariables());

      // loop over all the variable accesses
      Iterator iter = variableAccesses.iterator();
      while (iter.hasNext()) {
        VariableAccess variableAccess = (VariableAccess) iter.next();
        // 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

      ContextInstance subContextInstance = subProcessInstance.getContextInstance();

      // loop over all the variable accesses
      Iterator iter = variableAccesses.iterator();
      while (iter.hasNext()) {
        VariableAccess variableAccess = (VariableAccess) iter.next();
        // 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

        addProblem(new Problem(Problem.LEVEL_WARNING, "the name attribute of a variable element is required: "+variableElement.asXML()));
      }
      String access = variableElement.attributeValue("access", "read,write");
      String mappedName = variableElement.attributeValue("mapped-name");
     
      variableAccesses.add(new VariableAccess(variableName, access, mappedName));
    }
    return variableAccesses;
  }
View Full Code Here

TOP

Related Classes of org.jbpm.context.def.VariableAccess

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.