Spring LDAP

org.springframework.ldap.odm.core
Interface ObjectDirectoryMapper

All Known Implementing Classes:
DefaultObjectDirectoryMapper

public interface ObjectDirectoryMapper

The ObjectDirectoryMapper keeps track of managed class metadata and is used by LdapTemplate to map to/from entity objects annotated with the annotations specified in the org.springframework.ldap.odm.annotations package. Instances of this class are typically intended for internal use only.

Since:
2.0
Author:
Mattias Hellborg Arthursson

Method Summary
 String attributeFor(Class<?> clazz, String fieldName)
          Get the attribute corresponding to the specified field name.
 Filter filterFor(Class<?> clazz, Filter baseFilter)
          Use the specified search filter and return a new one that only applies to entries of the specified class.
 Name getCalculatedId(Object entry)
           
 Name getId(Object entry)
          Get the distinguished name for the specified object.
 void manageClass(Class<?> clazz)
          Check if the specified class is already managed by this instance; if not, check the metadata and add the class to the managed classes.
<T> T
mapFromLdapDataEntry(LdapDataEntry ctx, Class<T> clazz)
          Used to convert from the JNDI LDAP representation of an Entry to the Java representation when reading from LDAP.
 void mapToLdapDataEntry(Object entry, LdapDataEntry context)
          Used to convert from Java representation of an Ldap Entry when writing to the Ldap directory
 void setId(Object entry, Name id)
          Set the distinguished name for the specified object.
 

Method Detail

mapToLdapDataEntry

void mapToLdapDataEntry(Object entry,
                        LdapDataEntry context)
Used to convert from Java representation of an Ldap Entry when writing to the Ldap directory

Parameters:
entry - - The entry to convert.
context - - The LDAP context to store the converted entry
Throws:
NamingException - on error.

mapFromLdapDataEntry

<T> T mapFromLdapDataEntry(LdapDataEntry ctx,
                           Class<T> clazz)
Used to convert from the JNDI LDAP representation of an Entry to the Java representation when reading from LDAP.

Throws:
NamingException - on error.

getId

Name getId(Object entry)
Get the distinguished name for the specified object.

Parameters:
entry - the entry to get distinguished name for.
Returns:
the distinguished name of the entry.
Throws:
NamingException - on error.

setId

void setId(Object entry,
           Name id)
Set the distinguished name for the specified object.

Parameters:
entry - the entry to set the name on
id - the name to set
Throws:
NamingException - on error.

getCalculatedId

Name getCalculatedId(Object entry)

filterFor

Filter filterFor(Class<?> clazz,
                 Filter baseFilter)
Use the specified search filter and return a new one that only applies to entries of the specified class. In effect this means padding the original filter with an objectclass condition.

Parameters:
clazz - the class.
baseFilter - the filter we want to use.
Returns:
the original filter, modified so that it only applies to entries of the specified class.
Throws:
NamingException - on error.

attributeFor

String attributeFor(Class<?> clazz,
                    String fieldName)
Get the attribute corresponding to the specified field name.

Parameters:
clazz - the clazz.
fieldName - the field name.
Returns:
the attribute name.
Throws:
IllegalArgumentException - if the fieldName is not present in the class or if it is not mapped to an attribute.

manageClass

void manageClass(Class<?> clazz)
Check if the specified class is already managed by this instance; if not, check the metadata and add the class to the managed classes.

Parameters:
clazz - the class to manage.
Throws:
NamingException - on error.

Spring LDAP