2 Replies Latest reply on Dec 18, 2012 12:40 AM by qin tao

    How to check if a user can claim a task

    Ashok Kuppuswamy Newbie

      Is there a easy way to check if a user can claim a particular task. Right now, I am getting all the tasks that the user can potentially own and checking if the task that I am looking for is present.

       

       

      {code}

       

        taskIdToCheck = somtaskId;

       

                                    List<TaskSummary> userTaskList = taskService.getTasksAssignedAsPotentialOwner(userId, "en-UK");

                                    for(TaskSummary taskSummary : userTaskList){

                                              if(taskIdToCheck  == (new Long(taskId).longValue())){

              // task is claimable

                                                             break;

                                              }

                                    }

      {code}

        • 1. Re: How to check if a user can claim a task
          Thomas Setiabudi Expert

          Hi Ashok Kuppuswamy,

           

          Why do you need to do that? I think after you get a list of task that the user assigned as potential owner, all the task in your list is claimable by the user.

           

          If you want to claim the task, just use the taskClient function to claim the task.

          Basically what will happen is the Human Task Service will check again if that Task is claimable by the user by using its UserGroupCallback component, calling getGroupsForUser. If the user still able to claim the task, then the task will be claimed, if not, it will return an exception saying that the user does not have right to do that action (claim task).

           

           

          Regards,

          Thomas Setiabudi

          • 2. Re: How to check if a user can claim a task
            qin tao Newbie

            taskService.getTasksAssignedAsPotentialOwner(userId, "en-UK");

            this method may be return ten Thousands of  data , when database increase。

             

            I think you could write a query method  by self.