tags:

views:

243

answers:

1

Hi, I try to get the Subgroup of a Group in the standard Cognos Namespace.

Quering the Contentstore to get ALL groups works fine. The standard methodes to get "members" of objects return the users or only the "root" group (the group I want the subgroups of). Nothing else....

Am I doing something wrong or is it just "not to be done" ?

A: 

I found a way of doing it:

Assuming you have the searchpath for the group you want the subgroups of. Query the contentstore for it with following PropEnum:

PropEnum[] props = { 
    PropEnum.defaultName, 
    PropEnum.searchPath, 
    PropEnum.members };

As result you get a BaseClass[] object (with only one element though...). Import com.cognos.developer.schemas.bibus._3.Group <--- this is part of the Cognos SDK libraries and now you can cast the object[0] to Group.

object.getMembers().getValue()[] is an array of all members INCLUDING groups, roles, accounts.

In java it looks like this (query for the object already done):

Group group = (Group)object[0];
BaseClass obj = null;
for (int i = 0; i < group.getMembers().getValue().length; i++){
   obj = group.getMembers().getValue();
   System.out.println(obj.getSearchPath().getValue());
}
Boomy