Fix for LDAP-25: Added an additional finder method to reference doc.

This commit is contained in:
Mattias Arthursson
2008-10-22 08:40:39 +00:00
parent 040496cbf6
commit 9c0d1afe7a

View File

@@ -253,7 +253,9 @@ import org.springframework.ldap.core.ContextMapper;
import org.springframework.ldap.core.LdapTemplate;
import org.springframework.ldap.core.DirContextAdapter;
import org.springframework.ldap.core.support.DistinguishedName;
import org.springframework.ldap.filter.AndFilter;
import org.springframework.ldap.filter.EqualsFilter;
import org.springframework.ldap.filter.WhitespaceWildcardsFilter;
public class PersonDaoImpl implements PersonDao {
private LdapTemplate ldapTemplate;
@@ -284,6 +286,12 @@ public class PersonDaoImpl implements PersonDao {
return (Person) ldapTemplate.lookup(dn, getContextMapper());
}
public List findByName(String name) {
AndFilter filter = new AndFilter();
filter.and(new EqualsFilter("objectclass", "person")).and(new WhitespaceWildcardsFilter("cn",name));
return ldapTemplate.search(DistinguishedName.EMPTY_PATH, filter.encode(), getContextMapper());
}
public List findAll() {
EqualsFilter filter = new EqualsFilter("objectclass", "person");
return ldapTemplate.search(DistinguishedName.EMPTY_PATH, filter.encode(), getContextMapper());