
Originally Posted by
Marten Deinum
Bind put the user in there, would be pretty useless if it didn't would it now...
Hehe, yes that would be pretty useless, and that's what I understood originally and confused myself along the lines.
So then back to my original question, if bind puts it there, and I confirmed this with code, and with previous release I can use ParameterizedContextMapper to find all "Person" objects for instance, then what does one do in 3.0.3?
There is no longer SimpleLdapTemplate, now there's SpringSecurityLdapTemplate, and this does not take ParameterizedContextMapper.
The old code would work this way...
Code:
public List<Person> findAll() {
EqualsFilter filter = new EqualsFilter("objectclass", "person");
return ldapTemplate.search(DistinguishedName.EMPTY_PATH,
filter.encode(), getContextMapper());
}
protected ParameterizedContextMapper<Person> getContextMapper() {
return new PersonContextMapper();
}
SNIP
private class PersonContextMapper implements ParameterizedContextMapper<Person> {
public Person mapFromContext(Object ctxt) {
DirContextAdapter context = (DirContextAdapter) ctxt;
Person person = new Person();
person.setCommonName(context.getStringAttribute("cn"));
person.setEncPassword(context.getObjectAttribute("userPassword"));
person.setDistName(context.getNameInNamespace());
person.setUid(context.getStringAttribute("uid"));
person.setFirstName(context.getStringAttribute("givenName"));
person.setLastName(context.getStringAttribute("sn"));
person.setCountry(context.getStringAttribute("l"));
person.setMail(context.getStringAttribute("mail"));
person.setDescription(context.getStringAttribute("description"));
person.setCompany(context.getStringAttribute("o"));
person.setEmployeeNumber(context.getStringAttribute("employeeNumber"));
return person;
}
}