Vue combinée Vue Plate Arborescence
Sujets [ Précédent | Suivant ]
Peter Svehla
Custom field parameters ignored by UserLocalServiceUtil.search()
25 août 2014 23:58
Réponse

Peter Svehla

Rang: New Member

Publications: 4

Date d'inscription: 18 mars 2012

Publications Récentes

Hi,

I'm trying to retrieve a user record based on a custom field search (indexed):

1long companyId = 10154;
2
3String dn = "CN=Fred Smith,OU=Corporate,DC=company,DC=com";
4LinkedHashMap<String, Object> params = new LinkedHashMap<String, Object>();
5params.put("distinguishedName", dn);
6Sort sort = new Sort("prefName", Sort.STRING_TYPE, true);
7Hits users = UserLocalServiceUtil.search(companyId, null, WorkflowConstants.STATUS_ANY, params, QueryUtil.ALL_POS, QueryUtil.ALL_POS, sort);
8out.println(users.toList());


The trouble is that the search returns all the users in the system, not just the user with the desired dn.

I get the same result on 6.1.20 and 6.2.0.4, so I'm thinking it's more likely that the problem is with my understanding of the API than a bug in Liferay.

Can anyone spot what I've done wrong?

Thanks,
Peter.