use of org.gluu.oxtrust.model.SimplePerson in project oxTrust by GluuFederation.
the class PersonService method getUserByUid.
/*
* (non-Javadoc)
*
* @see
* org.gluu.oxtrust.ldap.service.IPersonService#getUserByUid(java.lang.String)
*/
@Override
public User getUserByUid(String uid) {
String personDn = getDnForPerson(null);
Filter userUidFilter;
if (dataSourceTypeService.isSpanner(personDn)) {
userUidFilter = Filter.createEqualityFilter(OxConstants.UID, StringHelper.toLowerCase(uid));
} else {
userUidFilter = Filter.createEqualityFilter(Filter.createLowercaseFilter(OxConstants.UID), StringHelper.toLowerCase(uid));
}
List<SimplePerson> users = persistenceEntryManager.findEntries(personDn, SimplePerson.class, userUidFilter, 1);
if ((users != null) && (users.size() > 0)) {
return persistenceEntryManager.find(User.class, users.get(0).getDn());
}
return null;
}
Aggregations