on 02-26-2007 7:21 AM
Hai,
I try to search the protal users with first name or last name. i try with this below code but i am not getting the user details.
public String [] searchUsers(String firstName,String lastName){
try {
IUserSearchFilter filter=userFactory.getUserSearchFilter();
if(firstName!=null && (firstName.trim().length()>0))
filter.setFirstName("%"+firstName+"%",ISearchAttribute.LIKE_OPERATOR,false);
if(lastName!=null && (lastName.trim().length()>0))
filter.setLastName("%"+lastName+"%",ISearchAttribute.LIKE_OPERATOR,false);
ISearchResult result=userFactory.searchUsers(filter);
String[] ids=new String[result.size()];
int j=0;
for(Iterator i=new PrincipalIterator(result);i.hasNext();){
IUser userO=(IUser)i.next();
ids[j]=userO.getUniqueID();
j++;
}
return ids;
} catch (UMException e) {
return null;
}
Where is the problem in the code .
Help me to solve this problem.
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Nagaraj,
is the code working fine?
please give points if i have solved your problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
now code is working fine .
I didnt change any thing in code. I dnt know why its not workde before
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear naga Raju,
Sorry for delayed reply.
please write the piece if code in view's init method and execute it.
You will get the user's list
ISearchResult rst = UMFactory.getUserFactory().getUniqueIDs();
IUserFactory usf = UMFactory.getUserFactory();
IUser iuser = null;
IUserListElement userElement = null;
int i = 0;
while (rst.hasNext()) {
iuser =
UMFactory.getUserFactory().getUser(rst.next().toString());
String email = iuser.getEmail();
String fname = iuser.getFirstName();
String lname = iuser.getLastName();
//diplay the email, first name and lastname
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
while (searchResult.hasNext() && i < 50) {
searchResultElement = wdContext.createSearchResultElement();
String uniqueid = (String) searchResult.next();
IUser user = userFactory.getUser(uniqueid);
searchResultElement.setFirstName(user.getFirstName());
This is working fine for me
Regards
BP
Award points if found usefull
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Naga Raju,
please let me know what database you are using for the Potal, is it LDAP or UME?
Anil Dichpally
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
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.