cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve Data source for a user in UME

Former Member
0 Kudos

Can anyone please let me know how I can find the data source of a user account in UME using the UME AP I?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I got the answer,

String [] ds = user.getAttribute(IPrincipal.DEFAULT_NAMESPACE, IPrincipal.DATASOURCE);

log("User data source -- "

+ ds[0]);

Answers (2)

Answers (2)

Former Member
0 Kudos
SandipAgarwalla
Active Contributor
0 Kudos

Ranjith

What is the need to know the datasource ar runtime?? Its already known while configuration..

Anyways, you can get it from the IUser Object ...This object has a Constant Field - Datasource

The code could be -

Iuser userObj = UMFactory.getUserFactory().GetUser() <thru logon id or something>

read the datasource contant from the object..

Else, get the datasource from the Unique ID of the User....The unique ID contains a format

<DatasourceName.UserID> if I remember correctly.

Give it a try and see if it works..

Sandip

Former Member
0 Kudos

Hi Sandip,

UME is configured to pull data from 2 data sources (LDAP, EXTERNAL_LDAP). My objective is to get all users from the data source EXTERNAL_LDAP.

user.getUniqueName() -- is returning just the userid.

user.getUniqueID() -- is returning "USER.EXTERNAL_LDAP.<userid>"

So, I thought of getting all the users using

ISearchResult result = userFactory.getUniqueIDs(); 

and then  looping result to get only those users that start with "USER.EXTERNAL_LDAP". But somehow this code is not working fine in all environments. I get the results in sandbox and dev but when I try to run the code in QA, I get only 400 users at a time.

Can you please help me with this ?

I also tried this code to just retrive users from EXTERNAL_LDAP.

 

   IUserFactory userFactory = UMFactory.getUserFactory();

   ISearchResult result = userFactory.getUniqueIDs();

   log(result.size());

   IUserSearchFilter sf = userFactory.getUserSearchFilter();

   sf.setUniqueName("*USER.EXTERNAL_LDAP.*", ISearchAttribute.LIKE_OPERATOR, false);

   ISearchResult sr = userFactory.searchUsers(sf);

   log(sr.size());

result -- returns all the users from LDAP & EXTERNAL_LDAP. 

sr - returns 0

As I mentioned earlier, as user.getUniqueName() is not giving me the result in the format, "USER.EXTERNAL_LDAP.<userid>", I am not able to use this code to filter the users based on uniquename. Also, I dont see any search filter like sf.setUniquerID(...)

Please help. !!