Discussion:
[jboss-user] [jBPM] - userGroupCallback : getGroupTaskList
Sandra Renaud
2013-02-14 14:15:58 UTC
Permalink
Sandra Renaud [https://community.jboss.org/people/joploya] created the discussion

"userGroupCallback : getGroupTaskList"

To view the discussion, visit: https://community.jboss.org/message/797693#797693

--------------------------------------------------------------
Hello,

I encounter problem while retrieving group tasks list. Indeed their is a unique method call for user and group task in LocalTaskService. But when I pass a group id in argument to the function
it call this method in TAskServiceSession :

@SuppressWarnings("unchecked")
          public List<TaskSummary> getTasksAssignedAsPotentialOwnerByStatus(String userId, List<Status> status, String language) {
        doCallbackUserOperation(userId);
        List<String> groupIds = doUserGroupCallbackOperation(userId, null);
       
        HashMap<String, Object> params = addParametersToMap(
                "userId", userId,
                "groupIds", groupIds,
                "language", language,
                "status", status);
        return (List<TaskSummary>) tpm.queryWithParametersInTransaction("TasksAssignedAsPotentialOwnerByStatusWithGroups", params);
    }
 


Because userId parameter is actually a groupId, the second call return an empty List.
So query failed because it miss an argument:

where t.archived = 0
and ( potentialOwners.id = :userId
        or potentialOwners.id in () )


I don't figure out what is wrong in my implementation.

Thankyou very much to help me.

Regards,
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/797693#797693]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
roxy1987
2013-02-14 15:00:42 UTC
Permalink
roxy1987 [https://community.jboss.org/people/roxy1987] created the discussion

"Re: userGroupCallback : getGroupTaskList"

To view the discussion, visit: https://community.jboss.org/message/797709#797709

--------------------------------------------------------------
Sandra,

The group task thing troubled me a lot too.
I dont know whats wrong with your impl but this is what I do :

//Connect the task handler
BlockingTaskSummaryResponseHandler summaryHandler = new BlockingTaskSummaryResponseHandler();
ArrayList<Object> groupTaskDetail = new ArrayList<Object>();
List<TaskSummary> tasks = null;
 
List<String> groups = getGroupsForUser(userId);  // Get the group IDs for the target user..
client.getTasksAssignedAsPotentialOwner(userId, groups, "en-UK", summaryHandler);
tasks = summaryHandler.getResults();


Regards.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/797709#797709]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Sandra Renaud
2013-03-20 08:07:26 UTC
Permalink
Sandra Renaud [https://community.jboss.org/people/joploya] created the discussion

"Re: userGroupCallback : getGroupTaskList"

To view the discussion, visit: https://community.jboss.org/message/803735#803735

--------------------------------------------------------------
Finally, I resolved my problem by adding the userId in the groupList so this list is never empty. (Even if the userId correspond to a groupId)

/**


     * Returns list of group ids for specified user id.
     *
     * @param userId                  the user id assigned to the task
     * @param groupIds                list of group ids assigned to the task
     * @param allExistingGroupIds   list of all currently known group ids
     *
     * @return List of group ids.
     */
     @Override
     public List<String> getGroupsForUser(String userId, List<String> groupIds, List<String> allExistingGroupIds) {

         logger.debug("Get groups for user "+userId);
         List<String> userGroups = new ArrayList<>();

         //To avoid an error inside the named request of human task, always add the userId inside group list
         userGroups.add(userId);

         User user = getLdapUser(userId);
         if(user != null){
userGroups.addAll(user.getGroups());
         }
         return userGroups;
     }


Regards.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/803735#803735]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Loading...