07-23-2015 03:45 AM
protected void mapSearchResultToUser( SearchResult result, UserEntity user) throws NamingException {
if (ldapConfigurator.getUserIdAttribute() != null) {
user.setId(result.getAttributes().get(ldapConfigurator.getUserIdAttribute()).get().toString());
}
if (ldapConfigurator.getUserFirstNameAttribute() != null) {
try{
user.setFirstName(result.getAttributes().get(ldapConfigurator.getUserFirstNameAttribute()).get().toString());
}catch(NullPointerException e){
user.setFirstName("");
}
}
if (ldapConfigurator.getUserLastNameAttribute() != null) {
try{
user.setLastName(result.getAttributes().get(ldapConfigurator.getUserLastNameAttribute()).get().toString());
}catch(NullPointerException e){
user.setLastName("");
}
}
if (ldapConfigurator.getUserEmailAttribute() != null) {
// here we need to catch NullPointerException as well
try {
user.setEmail(result.getAttributes().get(ldapConfigurator.getUserEmailAttribute()).get().toString());
}catch(NullPointerException e){
user.setEmail("");
}
}
}
07-23-2015 05:49 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.