5 Replies Latest reply on Jan 22, 2013 9:27 AM by Shobhit Tyagi

    Group Assignment

    Shobhit Tyagi Master

      Hi,

       

      I tried assigning task to a group. EVerything is good except a couple of issues i am having.

       

      a) When we retrieve a taskSummary object for a group task, we can get to know its userid provided it is not a group task but in case it is a group task, how do we get its group ID? Since a user might be part of various groups, so it becomes important to know to which group the task was assigned.

       

      b) Secondly, I am able to retrieve the task but when I try to claim it, I get the following permission exception :

       

       

       org.jbpm.task.service.PermissionDeniedException: User '[User:'mary']' does not have permissions to execution operation 'Claim' on task id 1
      
       
       public static void claimTask(long taskId, String userId)
      {
       connect();
       BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
       try
       {
       // client.release(taskId, "Administrator", responseHandler); 
        client.claim(taskId, userId, responseHandler);
        responseHandler.waitTillDone(5000);
       }
       catch(Exception e)
       {
        CustomExceptionHandler.handleException(e);
       }
      }
      
      

      The code looks like above. I tried to release it from Administrator's queue too. but it did not work may be coz the task is in ready state until it is claimed.

       

      Regards.

        • 1. Re: Group Assignment
          Shobhit Tyagi Master

          Well I have solved the second part by adding a list of groups to the method claim.

           

           

          client.getTasksAssignedAsPotentialOwner(userId, groups, "en-UK", summaryHandler);
          

           

          But still wondering about 1st question.

          1 of 1 people found this helpful
          • 2. Re: Group Assignment
            Thomas Setiabudi Expert

            Hi roxy1987,

             

            What version of JBPM do you use?

             

            in JBPM5.4, Human Task Service will use UserGroupCallback to get the user's group, so when the userGroupCallback component cannot prove that mary belong to the group in which the task is assigned, you will get that error.

             

            You can give mary membership to the group by editing the roles.properties file or you can override and write your own implementation of userGroupCallback if you get your user and group relation on other place such as database.

             

            if you write your own implementation of userGroupCallback, make sure you tell HumanTaskService to use your component by specifying it on

            \jbpm-human-task-war.war\WEB-INF\web.xml

            <param-name>user.group.callback.class</param-name>
            <param-value>org.jbpm.task.identity.DefaultUserGroupCallbackImpl</param-value>

             

            Regards,

            Thomas Setiabudi

             

             

             

             

            • 3. Re: Group Assignment
              Shobhit Tyagi Master

              Thanks for your reply Thomas. I am able to workout the 2nd question. I just need the name of the group to which the task was assigned. Is there no way to get the group id using the taskSummary Object that I have?

              I cant find out the information using just the id of the user as it is gonna be assigned to many different groups.

               

              Regards.

              • 4. Re: Group Assignment
                Thomas Setiabudi Expert

                Hi Roxy1987,

                 

                By Default, The TaskSummary object does not have information about the name of the group.

                 

                If you are using JBPM5.4, you can look at the query to get content of TaskSummary at
                jbpm-human-task-war.war\WEB-INF\classes\META-INF\Taskorm-JPA2.xml

                 

                You can try to modify that query, or you can just query the database directly to get the name of the group.

                 

                 

                 

                Regards,

                Thomas Setiabudi

                1 of 1 people found this helpful
                • 5. Re: Group Assignment
                  Shobhit Tyagi Master

                  Yeah well I guess thats what I would need to do. Thanks Thomas. Your help Much appreciated.