cancel
Showing results for 
Search instead for 
Did you mean: 

How to search for UME users using UME APIs !

Former Member
0 Kudos

Hello all,

I have a custom Web Dynpro application which searches for users from the UME Store. I know how to do a basic UME search, but have few questions in case of a complex search

1) How to search for all users based on a given custom UME attribute

2) How to search for users for a given role name. The role name search should do a pattern match (like operator). The role name wouldnt be the unique Id of the role rather the Role Description.

3) How do you search for multiple search criterias (like custom attribute, last name etc)? The user can enter all the criterias or just one of them, the search needs to be aware of that.

Appreciate your help.

Thank you, John

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi John,

The questions you are asking are very broad, you have to make use of UME API to code your requirements.

Refer the [UME API|http://www.sdn.sap.com/irj/scn/events?rid=/library/uuid/3641e490-0201-0010-c68f-e51221925714&overridelayout=true]

And search on here, you'll get many threads with code snippets.

Hope this helps, if you get stuck in your code, post your errors/exceptions...

Former Member
0 Kudos

Hey Srinivas,

Thanks for pointing me to the pdf.

I think I have been very specific on the requirements. And I got my answer for the first question.

Still I am not sure how can you search for a user based on a role name and the search should do a pattern match for the role.

Also, how can you search for multiple search criterias?

Appreciate your help

John

Former Member
0 Kudos

>

> Still I am not sure how can you search for a user based on a role name and the search should do a pattern match for the role.

>

> Also, how can you search for multiple search criterias?

> John

What I understand is, you want to search for users based on a role name ?

Refer page 25 in the UME API document which has the following code:

"This example illustrates how to search for users with last name "Sm?th*" "

IUserFactory userFact = UMFactory.getUserFactory();
IUserSearchFilter userFilt = userFact.getUserSearchFilter();
userFilt.setLastName("Sm?th*", ISearchAttribute.LIKE_OPERATOR,
false);
ISearchResult result = userFact.searchUsers(userFilt);
if (result.getState() == ISearchResult.SEARCH_RESULT_OK) {
while (result.hasNext()) {
String uniqId = (String) result.next();
IUser thisUser = userFact.getUser(uniqId);
String name = thisUser.getDisplayName();
...
}
} else {
// print error or warning
}

If you do a search, I am sure you'll find the relevant code.

Former Member
0 Kudos

I stil did not find any information on how to search for users based on a given role description and the search should do a pattern match for the description.

Thanks, John

Former Member
0 Kudos
try {
			 IUserFactory iuf = UMFactory.getUserFactory();
			 IUserSearchFilter usf = iuf.getUserSearchFilter();
			
//				Input field for search parameter
			 String search = wdContext.currentContextElement().getSearch_Input();
		 IGroup grpEntered = UMFactory.getGroupFactory().getGroupByUniqueName(search);				  
		 boolean firstUser = true;
					   Iterator userIterator = grpEntered.getUserMembers(true);
				 if(!userIterator.hasNext()){
					wdComponentAPI.getMessageManager().reportSuccess("No users");
				 } 
				 else{	
			               //Loop through the users and check the conditions.
					   while(userIterator.hasNext()){
                                           }

                                  }
            }catch (Exception e) {
			   wdComponentAPI.getMessageManager().reportException(e.toString(), true);
	    }

The above code is based on a group. You can follow the same approach based on a role. I myself don't know how to implement "Pattern matching" based on the input.

Hope this helps. If this is resolved for you, feel free to mark it answered and assign relevant points.

Former Member
0 Kudos

Seems like there is no API to find users for pattern match to a Role Description.

Thanks for your replies.

John