org.springframework.ldap.samples.article.dao
Class PersonDaoImpl

java.lang.Object
  extended by org.springframework.ldap.samples.article.dao.PersonDaoImpl
All Implemented Interfaces:
PersonDao

public class PersonDaoImpl
extends Object
implements PersonDao

Default implementation of PersonDao. This implementation uses DirContextAdapter for managing attribute values. It has been specified in the Spring Context that the DirObjectFactory should be used when creating objects from contexts, which defaults to creating DirContextAdapter objects. This means that we can use a ContextMapper to map from the found contexts to our domain objects. This is especially useful since we in this case have properties in our domain objects that depend on parts of the DN. We could have worked with Attributes and an AttributesMapper implementation instead, but working with Attributes is a bore and also, working with AttributesMapper objects (or, indeed Attributes) does not give us access to the distinguished name. However, we do use it in one method that only needs a single attribute: getAllPersonNames().

Author:
Mattias Arthursson, Ulrik Sandberg

Constructor Summary
PersonDaoImpl()
           
 
Method Summary
 void create(Person person)
           
 void delete(Person person)
           
 List findAll()
           
 Person findByPrimaryKey(String country, String company, String fullname)
           
 List getAllPersonNames()
           
 void setLdapTemplate(LdapTemplate ldapTemplate)
           
 void update(Person person)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersonDaoImpl

public PersonDaoImpl()
Method Detail

create

public void create(Person person)
Specified by:
create in interface PersonDao

update

public void update(Person person)
Specified by:
update in interface PersonDao

delete

public void delete(Person person)
Specified by:
delete in interface PersonDao

getAllPersonNames

public List getAllPersonNames()
Specified by:
getAllPersonNames in interface PersonDao

findAll

public List findAll()
Specified by:
findAll in interface PersonDao

findByPrimaryKey

public Person findByPrimaryKey(String country,
                               String company,
                               String fullname)
Specified by:
findByPrimaryKey in interface PersonDao

setLdapTemplate

public void setLdapTemplate(LdapTemplate ldapTemplate)


Copyright © 2006-2011 Spring Framework. All Rights Reserved.