6 Replies Latest reply on Jun 29, 2011 7:13 AM by ranjithrp

    Create task for user group

    ranjithrp

      Hi All,

       

      Im new to jBPM and im trying to use the human task component of jBPM as standalone task manager.

      I was able to add task to a user successfully, by creating an mvel expression and by using the apis present in the TaskClient class.

      But while following the same path to create task for a user group i get the following error.

       

      Referential integrity constraint violation: "FK1EE418D2C122ED2: PUBLIC.PEOPLEASSIGNMENTS_POTOWNERS FOREIGN KEY(ENTITY_ID) REFERENCES PUBLIC.ORGANIZATIONALENTITY(ID)"; SQL statement:

      insert into PeopleAssignments_PotOwners (task_id, entity_id) values (?, ?)

       

      As per the documentation it looks like i can add tasks to a user group (or just add tasks unassigned to any user), but can someone point me as to how that can be accomplished.

       

      Also will i be able to edit a task (say the description or the priority) after the task has been created?

       

      Thanks

      Ranjith

        • 1. Re: Create task for user group
          krisverlaenen

          Hi,

           

          Did you register your group before trying to assign a task to it (similar to how you register a User, e.g. using TaskServiceSession.addGroup(..) or using a config file to load users/groups)?

           

          Kris

          • 2. Re: Create task for user group
            ranjithrp

            Thanks Kris for the reply. It worked. I was in the assumption that jBPM task manager would add the user/usergroup assigned to a task automatically.

             

            Im still stuck with editting a task. All im able to see is i can add a new task, but how can i edit an already existing task?

            • 3. Re: Create task for user group
              krisverlaenen

              The service does not allow you to just edit a task at random.  There are a lot of methods that allow you to update the life cycle or associate data with the task.  In general, this should be sufficient for most use cases, as you aren't really allowed to change a task at random, only use the supported life cycle methods.

               

              What type of data specifically do you want to change?

               

              Kris 

              • 4. Re: Create task for user group
                ranjithrp

                Hi Kris,

                 

                With the lifecycle methods i was able to change the status etc of the tasks. But what i was looking for was something like an admin user changing the priority of the tasks or a user adding additional comments to the existing tasks.

                 

                Can you point me to some documentation about the usage of these methods (jBPM 5 user guide doesnt have much about the lifecycle management i guess)

                 

                Thanks

                Ranjith

                • 5. Re: Create task for user group
                  krisverlaenen

                  The TaskClient is the API that you should be using for normal operations, and it's defined by the WS-HumanTask specification.

                   

                  At this point, there are no operations to simply modify a Task randomly, as it's not defined in the specification.  It shouldn't be too difficult to add, if you just look at TaskServiceSession.addTask, I guess we could just add a similar one for saveTask that would just save the task using the entity manager.  If you might be interested in giving that a try, I can try and help and guide you through it?

                   

                  Kris

                  • 6. Re: Create task for user group
                    ranjithrp

                    I was able to create a custom API for saveTask by following the lines of TaskServiceSession.addTask method. But i was not sure if that was the right approach and if there is any inbuilt API which can be used for this.

                     

                    Thanks Kris for the suggestions. I would reach out if i have any other questions.

                     

                    Thanks

                    Ranjith