Skip to Content
Former Member
May 29, 2007 at 12:17 PM

UME user search with multiple search fields (AND / OR search)



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)

JavaDocs" target="_blank">">JavaDocs SearchMethod_AND

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;		
		srcFilter = userFac.getUserSearchFilter();
	} catch (UMException e)
		// TODO Auto-generated catch block
	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)

	ISearchResult srcResult = null;
		srcResult = userFac.searchUsers(srcFilter);
	} catch (UMException e1) 
		// TODO Auto-generated catch block

Thanks for any help...