on 11-12-2014 12:36 PM
Hi Exeperts ,
I have a requirement in my project
1) I need to get all the users assgined to a particular Group . The Group name will be enterd from the UI Screen . We have find out all the users present in that Group.
2) from this userlist , again I have to find out the users are that are locked by some "X" userId .
for example there is a group with name - "demogroup" and 500 users are assinged to this group then
1) I have to find out all the 500 users assinged to this - "demogroup"
2) from this 500 user list , Again I have to find out the users that are locked by some user eg: anusha
Can anybody help me with code for this requirement .
Many Thanks
Anusha .
first check fi the grp exist using the below method
--
boolean groupExist = false;
try
{
IGroupFactory grpFactory = UMFactory.getGroupFactory();
IGroupSearchFilter grpfilter = grpFactory.getGroupSearchFilter();
grpfilter.setSearchAttribute(IPrincipal.DEFAULT_NAMESPACE,IPrincipal.UNIQUE_NAME,groupUniqueName,ISearchAttribute.LIKE_OPERATOR, false);
ISearchResult search = grpFactory.searchGroups(grpfilter);
// if(search.size()==0)
// {
// grpfilter.setSearchAttribute(IPrincipal.DEFAULT_NAMESPACE,IPrincipal.DESCRIPTION, description,ISearchAttribute.LIKE_OPERATOR, false);
// search = grpFactory.searchGroups(grpfilter);
// }
while (search.hasNext())
{
groupExist = true;
break;
}
}catch(Exception e)
{
handleException(e, " ");
}finally
{
return groupExist;
}
if(groupExist)
{
IGroupFactory grpFactory = UMFactory.getGroupFactory();
IUserFactory usrFactory = UMFactory.getUserFactory();
IGroupSearchFilter grpSearchFilter = grpFactory.getGroupSearchFilter();
grpSearchFilter.setDisplayName("grpname",1,false);
ISearchResult grpResult = grpFactory.searchGroups(grpSearchFilter);
IGroup grpInd = grpFactory.getGroup("");
Iterator iterUsers = grpInd.getUserMembers(false);
//ISearchResult userList = (ISearchResult)grpInd.getUserMembers(false);
wdContext.nodeUserList().invalidate();
I***********************.IUserListElement userElement = wdContext.nodeUserList().createUserListElement();
userElement.setUserId("");
userElement.setUserDisplayName("Please select a user");
wdContext.nodeUserList().addElement(userElement);
IUser objUser = null;
String strUserId = "";
while(iterUsers.hasNext()){
strUserId = (String) iterUsers.next();
objUser = usrFactory.getUser(strUserId);
userElement = wdContext.nodeUserList().createUserListElement();
userElement.setUserId(objUser.getName());
//userElement.setUserDisplayName(objUser.getName()"-"objUser.getDisplayName());
wdContext.nodeUserList().addElement(userElement);
}
}
Regard
Govardan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.