5 Replies Latest reply on Nov 1, 2005 11:31 AM by jpaagt

    Task controllers variables

    pedrosacosta

      I've an urgent question. I've read the jbpm userguide, but i didn't understand how can we retrive the variables.


      Let's suppose the somewhere in my processdefinition i have:

      <task name="clean ceiling">
       <controller>
       <variable name="a" access="read" mapped-name="x" />
       <variable name="b" access="read,write,required" mapped-name="y" />
       <variable name="c" access="read,write" />
       </controller>
      </task>
      


      Now i've created the class

      
      public class RegistoOcorrenciaHandler implements TaskControllerHandler{
      
       private static final long serialVersionUID = 1L;
      
       public void submitParameters(Map parameters, TaskInstance taskInstance)
      {
      
      ---> HELP ME HERE <----
      }
      


      what code should i put where to retrieve the value of the variables?

      If instead of the above xml file i've
      <task name="clean ceiling">
       <controller class="com.yourcom.CleanCeilingTaskControllerHandler">
       -- here goes your task controller handler configuration --
       </controller>
      </task>
      
      


      What should i do?


      I have another question.
      Suppose i have a jsp form, that submit values. And now i want to retrieve them in the submitParameters method.

      What should i do?


      Thank you very much for the time taken, but this is really urgent to me.

        • 1. Re: Task controllers variables
          kukeltje

          Before anyone start shouting 'see there he goes again'..... wait a minute so I can put my fingers in my ear..... ok, here I go...

          If it is really urgent you can always order commercial support.

          .
          .
          .
          finished?? ;-)

          No serious... it is true. We try to do our best. Look at the default taskcontrolerhandler and see what goes on there. It is a mix of the handler, taskbean and jsf. If that is of no help, please come back. And remind that you do not have to develop your own taskcontrollerhandler. Only if you want to add additional functionality you might.

          If I can find the 'contributors agrement' in paper form, I send it in and contribute enhancements to the ui framework. I do not think of this agreement during the day and cannot fax it from home. Tom? Can you send it to me again in pdf or so

          • 2. Re: Task controllers variables
            koen.aers

            Ronald,

            I saw your name on the contributors page at http://labs.jboss.com/portal/index.html?ctrl:id=page.default.con&noproject=true. I guess it is OK to commit your contributions...

            Regards,
            Koen

            • 3. Re: Task controllers variables
              pedrosacosta

              You're right kukeltje. But when the enterprise want me to do a project with only jboss, i've to fight against time. I said urgent, because it's really important to me to understand how taskcontroller works.

              I think that the documentation on-line of jboss is few. Where can i find more examples and can you advice for any book?

              Thanks.

              • 4. Re: Task controllers variables
                tobysaville

                use the taskInstance parameter to get the ContextInstance which holds your variables:

                taskInstance.getTaskMgmtInstance().getProcessInstance().getContextInstance().getVariable(varName);
                


                • 5. Re: Task controllers variables
                  jpaagt

                  You have two options.
                  1) Using TaskInstance: To retrieve a variable using a task instance, you have to declare this variable in the tasks controller with read access and access the variable with the following code:

                  TaskInstance taskInstance =...
                  List formParameters = taskInstance.getTaskFormParameters();
                  

                  2) Using ContextInstance: To retrieve any variable defined in the process somewhere, you can use the ContextInstance:
                  ProcessInstance processInstance = ...
                  ContextInstance contextInstance = processInstance.getContextInstance();
                  Object varValue = contextInstance.getVariable("varName");