1 Reply Latest reply on Mar 31, 2006 8:35 AM by darren hartford

    proposal - replace VariableAccess with VariableDefinition

    darren hartford Expert

      Hey all,
      After wasting way too many hours trying to reverse-engineer how you are supposed to make a custom TaskControllerHandler, I gave up and offer this proposal. This proposal is related to TaskController and offering 'hints' as to what is expected for capturing variable information from a TaskNode (usually a human, but would include aliens, binary-systems, HAL, etc).

      Replace all existing instances of VariableAccess with a generic VariableDefinition class. Most of the values accept String values, and it is up to the client software (i.e. such as the jbpm webapp) to determine what to do with the values supplied. Other than the class name change, this is mostly backward-compatible and maintain the Access class.

      Statics are offered as a reference/recommendation, but are up to the people implementing the client code and the related workflow configuration what values would be accepted.

      /*
       * JBoss, Home of Professional Open Source
       * Copyright 2005, JBoss Inc., and individual contributors as indicated
       * by the @authors tag. See the copyright.txt in the distribution for a
       * full listing of individual contributors.
       *
       * This is free software; you can redistribute it and/or modify it
       * under the terms of the GNU Lesser General Public License as
       * published by the Free Software Foundation; either version 2.1 of
       * the License, or (at your option) any later version.
       *
       * This software is distributed in the hope that it will be useful,
       * but WITHOUT ANY WARRANTY; without even the implied warranty of
       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
       * Lesser General Public License for more details.
       *
       * You should have received a copy of the GNU Lesser General Public
       * License along with this software; if not, write to the Free
       * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
       * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
       */
      package org.jbpm.context.def;
      
      import java.io.Serializable;
      
      /**
       * @author dhartford
       */
      public class VariableDefinition implements Serializable {
      
       private static final long serialVersionUID = 1L;
      
       public static String TYPE_STRING = "String";
       public static String TYPE_ARRAYOF_STRING = "ArrayOfString";
       public static String TYPE_BOOLEAN = "Boolean";
       public static String TYPE_ARRAYOF_BOOLEAN = "ArrayOfBoolean";
       public static String TYPE_INTEGER = "Integer";
       public static String TYPE_ARRAYOF_INTEGER = "ArrayOfInteger";
       public static String TYPE_FLOAT = "Float";
       public static String TYPE_ARRAYOF_FLOAT = "ArrayOfFloat";
       public static String TYPE_DATE = "Date";
       public static String TYPE_ARRAYOF_DATE = "ArrayOfDate";
       public static String TYPE_TIME = "Time";
       public static String TYPE_ARRAYOF_TIME = "ArrayOfTime";
       public static String TYPE_DATETIME = "DateTime";
       public static String TYPE_ARRAYOF_DATETIME = "ArrayOfDateTime";
      
       public static String UICOMPONENT_TEXTFIELD = "TextField";
       public static String UICOMPONENT_TEXTAREA = "TextArea";
       public static String UICOMPONENT_SELECTONE = "SelectOne";
       public static String UICOMPONENT_SELECTMANY = "SelectMany";
       public static String UICOMPONENT_RADIO= "Radio";
       public static String UICOMPONENT_CHECKBOX = "Checkbox";
      
      
       long id = 0;
       protected String variableName = null;
       protected Access access = null;
       protected String mappedName = null;
       protected String type = null;
       protected String uicomponent = null;
       protected String uicomponentHints = null;
       protected String validationEngine = null;
       protected String validationRule = null;
      
       // constructors /////////////////////////////////////////////////////////////
      
       public VariableDefinition() {
       }
      
       public VariableDefinition(String variableName, String access, String mappedName, String type, String uicomponent, String uicomponentHints, String validationEngine, String validationRule) {
       this.variableName = variableName;
       if (access!=null) access = access.toLowerCase();
       this.access = new Access(access);
       this.mappedName = mappedName;
       this.type = type;
       this.uicomponent = uicomponent;
       this.uicomponentHints = uicomponentHints;
       this.validationEngine = validationEngine;
       this.validationRule = validationRule;
      
       }
      
       // getters and setters //////////////////////////////////////////////////////
      
       /**
       * the mapped name. The mappedName defaults to the variableName in case
       * no mapped name is specified.
       */
       public String getMappedName() {
       if (mappedName==null) {
       return variableName;
       }
       return mappedName;
       }
      
       /**
       * specifies a comma separated list of access literals {read, write, required}.
       */
       public Access getAccess() {
       return access;
       }
       public String getVariableName() {
       return variableName;
       }
      
       public boolean isReadable() {
       return access.isReadable();
       }
      
       public boolean isWritable() {
       return access.isWritable();
       }
      
       public boolean isRequired() {
       return access.isRequired();
       }
      
       public boolean isLock() {
       return access.isLock();
       }
      
      public String getType() {
       return type;
      }
      
      public void setType(String type) {
       this.type = type;
      }
      
      public String getUicomponent() {
       return uicomponent;
      }
      
      public void setUicomponent(String uicomponent) {
       this.uicomponent = uicomponent;
      }
      
      public String getUicomponentHints() {
       return uicomponentHints;
      }
      
      public void setUicomponentHints(String uicomponentHints) {
       this.uicomponentHints = uicomponentHints;
      }
      
      public String getValidationEngine() {
       return validationEngine;
      }
      
      public void setValidationEngine(String validationEngine) {
       this.validationEngine = validationEngine;
      }
      
      public String getValidationRule() {
       return validationRule;
      }
      
      public void setValidationRule(String validationRule) {
       this.validationRule = validationRule;
      }
      }
      
      


      Obviously, need to modify all existing code (which there was a suprising number) to reflect this change, particularly the jpdlParser.

      Please supply feedback. If there is a way to accomplish this through a custom TaskControllerHandler, PLEASE offer an example.

      thanks and gl,
      -D

        • 1. Re: proposal - replace VariableAccess with VariableDefinitio
          darren hartford Expert

          I'm looking for a reply back soon as it is an important decision for long-term goals of using jBPM. I want to avoid modifying the original jBPM because of compatability problems in the future, but I'm unable to get jBPM to do what is needed otherwise.

          Please, can someone either add this to the existing jBPM source or show an example of how to accomplish this with a custom TaskControllerHandler (and, just as important, how to get objects out of a custom TaskControllerHandler?).

          -D