5 Replies Latest reply on Oct 11, 2007 5:31 AM by kukeltje

    Feature Request - Task Properties

    simonbaker

      I dont know if this is already possible; if so, I'd appreciate advice.

      More and more we find we have a need for "task properties" that are definable in the Task element in the processdefinition.xml file and retrievable from a Task object. For instance, it would be useful to put:

       <task-node name="Record Officer - Check Expiration">
       <task name="Record Officer - Check Expiration" blocking="true">
       <assignment class="MyAssignmentClass">
       <currentStep>Record Officer - Check Expiration</currentStep>
       <Role>Record Officer</Role>
       </assignment>
       <properties class="MyPropertiesClass"
       <managerRole>Manager</managerRole>
       <maxDurationDays>5</maxDurationDays>
       <expirationEmail>joe@company.com</expirationEmail>
       <helpPhone>555-555-5555</helpPhone>
       </properties>
       </task>
       <transition name="Done" to="Decide if Record Officer Complete"></transition>
       </task-node>
      


      The
      <properties>
      element is the proposed new feature.

      This would then allow:
      TaskInstance taskinst = ...
      
      MyPropertiesClass taskProps =
       (MyPropertiesClass) taskinst.getTask().getProperties();
      
      if (elapsedDays > taskProps.maxDurationDays)
      {
       sendEmail(taskProps.expirationEmail, "Overdue!");
       // etc.
      }
      


      Essentially, JBPM would use reflection to set the members of the MyPropertiesClass object which would be stored in an Object member of the Task and retrieved with the getter "Task.getProperties()", similar to other delegation object initializations. It would be required that MyPropertiesClass be serializable for storing by Hibernate. Perhaps a HashMap could be a default "properties" object.

      Is anyone interested in such a feature, or is it already possible?


        • 1. Re: Feature Request - Task Properties
          tellierj

          Yes I need it too, and also for the process.

          Actually I use the description tag for process and task since version 3.2.1 like this :

          [key1=value1][key2=value2]...

          and I parse the description of GraphElement with a regular expression :

          \[(\w|[^w^=]*)=(\w|[^w^=]*)\]


          • 2. Re: Feature Request - Task Properties
            dleerob

            I also think some sort of properties would be helpful.

            I also would like to see properties for variables. I have added a few extras to my forms.xml, to set certain securities and other info for my variables. This way, my framework knows which variables are allowed to be seen, and by who.

            Eg:

            <forms>
            
             <form task="Request For New Employee" form="form.requestForNewEmployee.jsp" order="1">
             <variable name="IsReplacement" displayName="Is Replacement" />
             <variable name="EmployeeReplaced" displayName="Employee Replaced" />
             <variable name="JobDescription" displayName="Job Description" />
             <variable name="CostCentre" displayName="Cost Centre" />
             <variable name="ExpectedCost" displayName="Expected Cost" securityGroup="Payroll" securityRoleInGroup="Team Leader"/>
             <variable name="Motivation" displayName="Motivation" />
             </form>
            </forms>

            As you can see the Expected Cost variable, for example, would not be displayed to any user except the Team Leader of the Payroll group.

            I would prefer this sort of functionality to be added on the processdefinition.xml, perhaps as properties, as was mentioned above.

            • 3. Re: Feature Request - Task Properties
              kukeltje

              @All: You can try to develop your own taskcontroller which supports all of your individual needs. Then you can add anything you want to the processdefinition

              • 4. Re: Feature Request - Task Properties
                simonbaker

                Ok, but if we all develop task controllers (and extend Task class, etc.) we all do the work many times instead of it being done once and available to all.

                But I can see maybe more discussion is needed to see what the common needs are.

                Perhaps someone can take a crack at what Ronald suggested and, if it works out well, offer it as a prototype for the new feature.

                Or perhaps we could create a download area where we can share solutions in toolkit form.

                • 5. Re: Feature Request - Task Properties
                  kukeltje

                  Sorry, I did not mean all separately. If you all agree on co-developing an extended taskcontroller, we can post that on the wiki.... for everyone to use. If it proves to be a real need for many more people, we can think of including it in the core