public static LdapUser createLdapUser(final String username, final String firstname, final String lastname, final String email, final String organization, final String description) { return (LdapUser) new LdapUser().setUid(username).setGivenName(firstname).setSurname(lastname).setMail(email) .setOrganization(organization).setDescription(description); }
protected void mapToObject(final String dn, final LdapPerson person, final Attributes attributes) throws NamingException { person.setSurname(LdapUtils.getAttributeStringValue(attributes, "sn")); person.setGivenName(LdapUtils.getAttributeStringValue(attributes, "givenName")); person.setUid(LdapUtils.getAttributeStringValue(attributes, "uid")); person.setEmployeeNumber(LdapUtils.getAttributeStringValue(attributes, "employeeNumber")); person.setOrganization(LdapUtils.getAttributeStringValue(attributes, "o")); person.setMail(LdapUtils.getAttributeStringValues(attributes, "mail")); person.setDescription(LdapUtils.getAttributeStringValue(attributes, "description")); person.setTelephoneNumber(LdapUtils.getAttributeStringValue(attributes, "telephoneNumber")); person.setMobilePhoneNumber(LdapUtils.getAttributeStringValues(attributes, "mobile")); person.setHomePhoneNumber(LdapUtils.getAttributeStringValue(attributes, "homePhone")); }
public static LdapPerson convert(final AddressDO address) { final LdapPerson person = new LdapPerson(); person.setSurname(address.getName()); person.setGivenName(address.getFirstName()); if (address.getId() != null) { person.setUid(UID_PREFIX + address.getId()); } person.setOrganization(address.getOrganization()); person.setDescription(address.getComment()); person.setMail(address.getEmail(), address.getPrivateEmail()); person.setTelephoneNumber(address.getBusinessPhone()); person.setHomePhoneNumber(address.getPrivatePhone()); person.setMobilePhoneNumber(address.getMobilePhone(), address.getPrivateMobilePhone()); return person; } }