6 Replies Latest reply on Jul 28, 2006 3:19 AM by dlipski

    Task parameters

    dlipski

      Hi
      Is it possible to define in process definition file some parameters for tasks? I'm asking because i have few very similar tasks and i would like to use one task in many task nodes but i have to 'configure' it. If it is possible how to read these parameters by jBPM API ?

        • 1. Re: Task parameters
          newbie007

          I guess that is possible using the variables. When you configure your task (by adding actions, swimlane etc in JPD), you can specify the variables using the "Controller" menu. These variables can be retrived using the API:

          taskInstance.getTask().getTaskController().getVariableAccesses()


          Thanks.



          • 2. Re: Task parameters
            dlipski

            Thanks for your reply. But as i understand documentation (11.5 "Task controllers") they are intended to translate and extract information from the process variables, not to define new variables. Tag (nested in controller) have attributes name, acces & mapped-name. I'm looking for some 'value' attrbiute. For example:

            <controller>
             <variable mapped-name="myVar" value="someVal"/>
            </controller>
            


            Is something like this possible ?

            • 3. Re: Task parameters
              kukeltje

              Oh yes, this is possible..... just use an actionhandler that can work with a xml structure. There are some examples in the source, docs, this forum... just don't look at the xml tag as the variable name but do something like

              <numbers>
              <entry><key>one</key><value>1</value></entry>
              <entry><key>two</key><value>2</value></entry>
              <entry><key>three</key><value>3</value></entry>
              </numbers>


              Where the value of key is the variable name and the value of value is the value (heee that is nice ;-))

              The rest should be obvious

              • 4. Re: Task parameters
                dlipski

                 

                use an actionhandler that can work with a xml structure


                But all i found is that action handlers can be used to parametrize actions, not other types such as task's.I know i can do something like this:

                <action class="org.test.MyAction">
                 <city>Atlanta</city>
                 <rounds>5</rounds>
                </action>
                


                But is it possible to assign ActionHandler to Task ?

                Thanks

                • 5. Re: Task parameters
                  kukeltje

                  read the docs.... lots of 'events' including a TASK-CREATE etc......

                  • 6. Re: Task parameters
                    dlipski

                    Thanks I forgot about task events, and was trying to do that in some other way.