Interface ObjectDirectoryMapper
-
- All Known Implementing Classes:
DefaultObjectDirectoryMapper
public interface ObjectDirectoryMapper
The ObjectDirectoryMapper keeps track of managed class metadata and is used byLdapTemplate
to map to/from entity objects annotated with the annotations specified in theorg.springframework.ldap.odm.annotations
package. Instances of this class are typically intended for internal use only.- Since:
- 2.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
attributeFor(java.lang.Class<?> clazz, java.lang.String fieldName)
Get the attribute corresponding to the specified field name.Filter
filterFor(java.lang.Class<?> clazz, Filter baseFilter)
Use the specified search filter and return a new one that only applies to entries of the specified class.javax.naming.Name
getCalculatedId(java.lang.Object entry)
javax.naming.Name
getId(java.lang.Object entry)
Get the distinguished name for the specified object.java.lang.String[]
manageClass(java.lang.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, java.lang.Class<T> clazz)
Used to convert from the JNDI LDAP representation of an Entry to the Java representation when reading from LDAP.void
mapToLdapDataEntry(java.lang.Object entry, LdapDataEntry context)
Used to convert from Java representation of an Ldap Entry when writing to the Ldap directoryvoid
setId(java.lang.Object entry, javax.naming.Name id)
Set the distinguished name for the specified object.
-
-
-
Method Detail
-
mapToLdapDataEntry
void mapToLdapDataEntry(java.lang.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, java.lang.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
javax.naming.Name getId(java.lang.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(java.lang.Object entry, javax.naming.Name id)
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
javax.naming.Name getCalculatedId(java.lang.Object entry)
-
filterFor
Filter filterFor(java.lang.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
java.lang.String attributeFor(java.lang.Class<?> clazz, java.lang.String fieldName)
Get the attribute corresponding to the specified field name.- Parameters:
clazz
- the clazz.fieldName
- the field name.- Returns:
- the attribute name.
- Throws:
java.lang.IllegalArgumentException
- if the fieldName is not present in the class or if it is not mapped to an attribute.
-
manageClass
java.lang.String[] manageClass(java.lang.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.- 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.
-
-