on 05-02-2007 12:01 PM
Hi Friends;
I want to get all groups in portal using security api. how can i handle this?
Thanks
Eray,
please check the below code, you will get groups in drop down.
model = new DefaultListModel();
IGroupFactory groupFactory = UMFactory.getGroupFactory();
IGroupSearchFilter filter = groupFactory.getGroupSearchFilter();
ISearchResult result = groupFactory.searchGroups(filter);
IGroup group=null;
model.addItem("", "Select a Group");
model.setSingleSelection(true);
while (result.hasNext()) {
group = groupFactory.getGroup(result.next().toString());
model.addItem(""+group.getUniqueID(), group.getDescription());
}
model.setSelection(group.getDescription());
regards
Anil Dichpally
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anil;
Thanks For your reply, I found another but yours is nice than mine...
I write secondary code
String AllGroups = "";
try {
com.sap.security.api.IGroupFactory grpFact =
UMFactory.getGroupFactory();
IGroupSearchFilter grpFilt = grpFact.getGroupSearchFilter();
grpFilt.setDisplayName("*", ISearchAttribute.LIKE_OPERATOR, false);
ISearchResult result = grpFact.searchGroups(grpFilt);
if (result.getState() == ISearchResult.SEARCH_RESULT_OK) {
while (result.hasNext()) {
String guniqId = (String) result.next();
IGroup thisGroup = grpFact.getGroup(guniqId);
IGroup grp = UMFactory.getGroupFactory().getGroup(guniqId);
String name = thisGroup.getDisplayName();
if(!AllGroups.equals("")){
AllGroups = AllGroups+","+name;
}
else{
AllGroups = name;
}
}
}
return (AllGroups.split(","));
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
User | Count |
---|---|
84 | |
9 | |
9 | |
8 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.