7 Replies Latest reply on Aug 24, 2009 10:19 AM by Ronald van Kuijk

    extending tasks

    Sofie Ravyts Newbie


      We are currently converting our application from jbpm3 to jbpm4.
      In the old version, we extended the TaskInstance with some extra properties by registring our own TaskFactory in the jbpm config file and extending the hibernate mapping for TaskInstance.

      How is this possible in jbpm4? Is there something like a TaskFactory we can overrule in the configs?


        • 1. Re: extending tasks
          sri r Newbie

          with jbpm4, you can use custom-task or extend TaskActivity class

          • 2. Re: extending tasks
            Sofie Ravyts Newbie

            We don't want to create custom tasks, we want to extend the task object's data model.

            So it is not the execution we want to change, but the actual task persisted data model.

            • 3. Re: extending tasks
              Ronald van Kuijk Master

              Uhhhmmm... if you want to extend the datamodel you have to have a corresponding class. In jBPM4 that is the TaskActivity class, so by extending that and changing the corresponding config files you achieve what you want I think, so rams.rapo is right

              • 4. Re: extending tasks
                Sofie Ravyts Newbie

                But in jbpm3 we could register a custom task factory, so the tasks were created using the extended class with the extra properties initialized in the constructor (using the execution context).

                I can't seem to find anything in the manuals (user en dev) for doing this?

                • 5. Re: extending tasks
                  Ronald van Kuijk Master

                  that same can be done in jbpm4 with changing the file (jbpm.jpdl.activities.xml) that references the task activity (no factory needed). That is what rams.rapo meant. You might need to change ./pvm/src/main/resources/jbpm.task.hbm.xml as well but that might depend on what you want.

                  What is even greater, you can change more of the behaviour of the task in jbpm.jpdl.activities.xml

                  But keep in mind that this part is not fully stabilized yet

                  • 6. Re: extending tasks
                    Sofie Ravyts Newbie

                    When I look closer into the source code I can see what you are trying to suggest (extend TaskActivity) and create my own kind of task and use this one in the execute method of TaskActivity (correct me if I'm wrong).

                    But the actual creation of the TaskImpl object is happening in the DBSessionImpl class. Isn't it dangerous not using this anymore (it is used in two other locations as well: NewTaskCmd and createSubTask() in TaskImpl )?
                    Also, this would mean that I have to duplicate all the code from TaskActivity - execute method (and hope it doesn't change too much).

                    • 7. Re: extending tasks
                      Ronald van Kuijk Master

                      Ah... ok I personally missed that. Will look into that in a few days since this would mean extensibility is less easy.