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
-
Method Summary
Modifier and TypeMethodDescriptionattributeFor
(Class<?> clazz, String fieldName) Get the attribute corresponding to the specified field name.Use the specified search filter and return a new one that only applies to entries of the specified class.getCalculatedId
(Object entry) Get the distinguished name for the specified object.String[]
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 directoryvoid
Set the distinguished name for the specified object.
-
Method Details
-
mapToLdapDataEntry
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
Used to convert from the JNDI LDAP representation of an Entry to the Java representation when reading from LDAP.- Throws:
NamingException
- on error.
-
getId
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
Set the distinguished name for the specified object.- Parameters:
entry
- the entry to set the name onid
- the name to set- Throws:
NamingException
- on error.
-
getCalculatedId
-
filterFor
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
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
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.- Returns:
- all relevant attribute names used in the given class (either for reading from LDAP or for writing to LDAP or both)
- Throws:
NamingException
- on error.
-