IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.



#Automation


#Applicationintegration
#webMethods
#Integration
 View Only
  • 1.  Getting the groups a user belong

    Posted 03/12/09 07:49 PM

    Hi:

    I need to add the groups the user belong to the column “Accepted By” in the task search results porlet.

    What is the best way to get the groups the user belongs to based on the information provided by getTaskDisplayProvider().getAcceptedPrincipalsListProvider();

    Thanks
    Edgardo


    #webMethods
    #webMethods-BPMS
    #MWS-CAF-Task-Engine


  • 2.  RE: Getting the groups a user belong

    Posted 03/12/09 09:28 PM

    There are two points to make:

    1. Task Engine does not support assigning task to groups. Only to individual users and roles
    2. It also does not support accepting a task by a group, only by individual users.

    But it seems like what you are really looking for is for a way to discover and display just groups (or roles) which user who accepted a task is a member of.

    TaskDisplayProvider.getAcceptedPrincipalsListProvider() returns you list of display names of accepted users, this is not what you need. Instead you need to obtain list of user IDs who accepted a task, from .getTaskInfo().getAcceptedByList() (where is managed bean representing current task)

    Having the IDs of the user you now can determine groups and roles user is a member of using common directory service APIs. Details about this API can be found at:

    http://www.ajax-softwareag.com/articles/Y4LCDN/Caf-7-1-1JavaDocs/com/webmethods/sc/directory/package-summary.html

    The code you would need is something like this:
    IDirectorySession s = DirectorySystemFactory.getDirectorySystem().createSession();
    s.getGroupMembership(userID);


    #MWS-CAF-Task-Engine
    #webMethods-BPMS
    #webMethods


  • 3.  RE: Getting the groups a user belong

    Posted 03/12/09 11:37 PM

    Thanks:

    It seems that the format returned by getAcceptedByList() is not what getGroupMembership() needs. I get an Exception with the message

    Invalid Object ID

    getAcceptedByList() returns the user names as a String
    getGroupMembership() expects a principalId: what format principalId must be (just the username, the DN…)? I tryied with different combinations and always got the same exception.

    Thanks
    Edgardo


    #webMethods-BPMS
    #webMethods
    #MWS-CAF-Task-Engine


  • 4.  RE: Getting the groups a user belong

    Posted 03/12/09 11:46 PM

    Yes, you are correct. getAcceptedByList() returns array of usernames. So first you need to lookup a principal by its name:

    IDirectoryPrincipal user = s.lookupPrincipalByName(name, IDirectoryPrincipal.TYPE_USER);

    then

    s.getGroupMembership(user.getID());

    Alex


    #webMethods-BPMS
    #webMethods
    #MWS-CAF-Task-Engine


  • 5.  RE: Getting the groups a user belong

    Posted 03/13/09 04:41 PM

    Thanks!

    Here is the code if someone needs to implement it

    IDirectorySession session = DirectorySystemFactory.getDirectorySystem().createSession();
    :
    :
    ITaskInfo task = getTaskDisplayProvider().getTaskInfo();
    String acceptedBy = task.getAcceptedByList();
    IDirectoryPrincipal principal = session.lookupPrincipalByName(acceptedBy[0],IDirectoryPrincipal.TYPE_USER);
    List groups = session.getGroupMembership(principal.getID());
    for(IDirectoryGroup aGroup : groups) r += " - " + aGroup.getName();

    Edgardo


    #MWS-CAF-Task-Engine
    #webMethods-BPMS
    #webMethods