7 Replies Latest reply on Dec 18, 2015 6:13 PM by Arif Mohammed

    getting group specific tasks

    Arif Mohammed Novice

      Hi,

       

          I have 2 groups and users as follows. And I as a user irrespective of how many groups I belong to (say usr3 belongs to group1 and group2) I want to retrieve only the tasks associated to a particular group say group1. What is the API to get group specific tasks ? I see getTasksAssignedAsPotentialOwnerByStatusByGroup in 5.4 is deprecated. What is the alternative method to get group specific tasks ?

             group1: usr1,usr2,usr3

             group2: usr3,usr4

        • 1. Re: getting group specific tasks
          Maciej Swiderski Master

          group based queries rely on UserGroupCallback information so make use when you issue query you have UserGroupCallback registered that is aware of your users and groups and then use regular queries for given user so it will fetch group tasks for that user according to his/her group membership.

           

          HTH

          • 2. Re: getting group specific tasks
            Arif Mohammed Novice

            Yes I have registered UserGroupCallback and user to group mapping is working fine but here the issue is different. Though a particular user say usr1 belongs to 2 groups say group1 and group2, I would like to retrieve the tasks assigned to usr1 and group1(excluding group2 tasks). As of now the queries are based on user name not the group name. As I said there is one method getTasksAssignedAsPotentialOwnerByStatusByGroup but it is deprecated. I have to call this method as follows getTasksAssignedAsPotentialOwnerByStatusByGroup(null, groupIds,sts,locale); where groupIds contain just "group1". Once I get this list I have to remove the tasks which are not owned by "usr1".

            • 3. Re: getting group specific tasks
              Arif Mohammed Novice

              Hello jBPM Team.

               

              My requirement is very simple as explained above. I have a customized task list in my application and I would like to retrieve the tasks associated to a group no matter who are the users in that group and no matter who am I(as a user). I was using deprecated API getTasksAssignedAsPotentialOwnerByStatusByGroup in 5.4 and it is removed in version 6. If there is no alternative API how can I extend the existing API to fulfill the above requirement ? Can I write my own JPA queries ?

              • 4. Re: getting group specific tasks
                Maciej Swiderski Master

                some methods are still available in the InternalTaskService so cast the TaskService instance to get access to them.

                 

                HTH

                • 5. Re: getting group specific tasks
                  Arif Mohammed Novice

                  But we are not supposed to use internal API's right. I am trying to use getTasksByVariousFields(null,null,null,null,groupList,null,statusList,null,true); At a first glance it looks convincing but there is no documentation and I have to look how does it fit to my need. Will this method work for my case ?

                  • 6. Re: getting group specific tasks
                    Maciej Swiderski Master

                    everything that is inside kie-internal is sort of in transition to become (eventually) the public api so I would say it's safe to use it with note in mind that it might change over the releases but usually it's kept backward compatible.

                    The getTaskByVariousFileds is more a technical method and should not be used by client code directly as this is still something that might change over time so I would recommend to stick to more dedicated methods instead.

                     

                    HTH

                    • 7. Re: getting group specific tasks
                      Arif Mohammed Novice

                      Hi Maciej,

                       

                          I was using InternalTaskService and it was working fine until 6.1.0.Final but all of a sudden this behaviour is changed in 6.3.0.Final. This feature is very much needed, not sure why it does not work. Can you please look at this thread https://developer.jboss.org/thread/266789

                       

                         Is there any other alternate way of writing custom queries to fetch the task details (example providing our own orm.xml)

                       

                      Note: The author of the above thread was me, I forgot the old ID so has to create the new one.