on 05-29-2007 1:17 PM
Hi,
I'm struggling with a UME user search problem. I have multiple search fields: lastname, firstname, department
Searching in this fields is working with the default IPrincipalSearchFilter.SEARCHMETHOD_AND (default)
<a href="http://help.sap.com/javadocs/NW04/current/um/com/sap/security/api/IPrincipalSearchFilter.html#setSearchMethod(int)">JavaDocs SearchMethod_AND</a>
Now I would like to add an additional search field for searching in telephone, cellphone as well. BUT searching for a phone number with searching for one of the other fields should not be a AND search. Is this possible?
Here is the actual non-working code:
Vector retVector = new Vector();
//get Userdata with IUserFactory
//////////////////////////////////////////////////////
IResourceFactory resourceFactory = ResourceFactory.getInstance();
IURLGeneratorService urlGen = (IURLGeneratorService)resourceFactory.getServiceFactory().getService(IServiceTypesConst.URLGENERATOR_SERVICE);
IUserFactory userFac = UMFactory.getUserFactory();
IUserSearchFilter srcFilter = null;
try
{
srcFilter = userFac.getUserSearchFilter();
} catch (UMException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
if(lastName.length() > 0)
srcFilter.setLastName(lastName + "*",ISearchAttribute.LIKE_OPERATOR, false);
if(firstName.length() > 0)
srcFilter.setFirstName(firstName + "*",ISearchAttribute.LIKE_OPERATOR, false);
if(department.length() > 0)
srcFilter.setDepartment(department + "*", ISearchAttribute.LIKE_OPERATOR, false);
//Here I need help!!!!!!! Please advice!!!
if(telephone.length() > 0)
{
srcFilter.setTelephone("*" + telephone, ISearchAttribute.LIKE_OPERATOR, false);
srcFilter.setCellPhone("*" + telephone, ISearchAttribute.LIKE_OPERATOR, false);
}
//if(mobil.length() > 0)
// srcFilter.setCellPhone("*" + mobil, ISearchAttribute.LIKE_OPERATOR, false);
//Set maxium value for Result and thus limit the static variable SIZE_LIMIT_EXCEEDED
//This method can only be used, if only one search attribute is specified -> thanks SAP
if(srcFilter.getElementSize() <= 1)
srcFilter.setMaxSearchResultSize(300);
ISearchResult srcResult = null;
try
{
srcResult = userFac.searchUsers(srcFilter);
} catch (UMException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
Thanks for any help...
Stefan
Hello,
I could still need some help. Is there no one who could give me a tip? Could I explain my problem clearly enough or do you need some more information about my problem?
Or is the search topic with searchFilter not a very common used thing?
Is there a possibility to do a search in the received search result? Can anyone explain how this would work?
Any ideas are welcome.
Regards,
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
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.