Package com.groiss.ldap
Class ClassMapping
java.lang.Object
com.groiss.ldap.ClassMapping
Maps a Java Class to an LDAP Object Class.
Is part of a schema mapping. Provides accessors to field values of a mapped object.
-
Constructor Summary
ConstructorDescriptionConstructs a class mapping and adds it to the provided schema mapping. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(AttributeMapping am) Adds an attribute mapping to this class mappingvoid
addSubLink
(SubLink subLink) Add a sublink to this class mappinggetAttMappingByAttName
(String name) Returns the attribute mapping with the specified attribute nameReturns the attribute mapping with the specified field nameint
Returns the number of attribute mappings of this class mappingReturns an iterator for the attribute mappings of this class mappingReturns the RDN of the subcontext of this class mappingReturns the name of the LDAP attribute which designates the subcontextReturns the value of the LDAP attribute which designates the subcontextGet a field by its name.getFieldContent
(Persistent o, String fieldName) Gets the content of an objects field by the fields name.Returns the fields of the java class.Returns the name of the Java class this mapping is for.Returns the name of the most specific LDAP Object classString[]
Return the set of LDAP object classes for this mappingReturns the name of the LDAP attribute which designates the relative distinguished name (RDN)Returns the value of the RDN of an objectgetSm()
Returns the schema mapping this class mapping belongs toReturns the sublinks of this class mappingvoid
setClassSubContext
(String classSubContext) Set the sub context for this class mapping.void
setJavaClassName
(String javaClassName) Set the class name of the java class for this mapping.void
setObjectClasses
(String[] objectClasses) Set the names of the LDAP Object classes for this class mapping.void
setRDNAttName
(String rDNAttName) Set the name of the LDAP attribute which designates the relative distinguished name (RDN)
-
Constructor Details
-
ClassMapping
Constructs a class mapping and adds it to the provided schema mapping.- Parameters:
sm
- the schema mapping to which the schema mapping is added
-
-
Method Details
-
getSm
Returns the schema mapping this class mapping belongs to- Returns:
- the schema mapping this class mapping belongs to
-
add
Adds an attribute mapping to this class mapping- Parameters:
am
- the attribute mapping to add
-
getAttMappingByAttName
Returns the attribute mapping with the specified attribute name- Parameters:
name
- the attribute name of the mapping to look up- Returns:
- the attribute mapping if one is found, null otherwise
-
getAttMappingByFieldName
Returns the attribute mapping with the specified field name- Parameters:
name
- the field name of the mapping to look up- Returns:
- the attribute mapping if one is found, null otherwise
-
getAttributeIterator
Returns an iterator for the attribute mappings of this class mapping- Returns:
- an iterator for the attribute mappings of this class mapping
-
getAttributeCount
public int getAttributeCount()Returns the number of attribute mappings of this class mapping- Returns:
- the number of attribute mappings of this class mapping
-
getJavaClassName
Returns the name of the Java class this mapping is for.- Returns:
- the name of the Java class this mapping is for.
-
setJavaClassName
Set the class name of the java class for this mapping. Also the fields of the java class are set.- Parameters:
javaClassName
- the class name- Throws:
Exception
- thrown when the class is not found or cannot be instantiated
-
getFields
Returns the fields of the java class.- Returns:
- a Map which maps fieldnames to java.lang.reflect.Field objects
-
getField
Get a field by its name.- Parameters:
fieldName
- the name of the field to get- Returns:
- the field
-
getFieldContent
Gets the content of an objects field by the fields name. The object must be an instance of the java class specified for this class mapping.- Parameters:
o
- The object which field content should be gotten.fieldName
- the name of the field- Returns:
- the content of the objects field.
- Throws:
IllegalAccessException
-
addSubLink
Add a sublink to this class mapping- Parameters:
subLink
- the sublink to add
-
getSubLinks
Returns the sublinks of this class mapping- Returns:
- an arrayList of SubLink objects of this class mapping
-
setObjectClasses
Set the names of the LDAP Object classes for this class mapping. Must be ordered from least specific to most specific class. e.g. "top","person","organizationalPerson"- Parameters:
objectClasses
-
-
getObjectClasses
Return the set of LDAP object classes for this mapping- Returns:
- the names of the LDAP object classes this mapping is for
-
getObjectClass
Returns the name of the most specific LDAP Object class- Returns:
- the name of the most specific LDAP Object class
-
setRDNAttName
Set the name of the LDAP attribute which designates the relative distinguished name (RDN)- Parameters:
rDNAttName
- the name of the attribute whose value is the RDN
-
getRDNAttName
Returns the name of the LDAP attribute which designates the relative distinguished name (RDN)- Returns:
- the name of the LDAP attribute which designates the relative distinguished name (RDN)
-
getRDNAttValue
Returns the value of the RDN of an object- Parameters:
o
- the object to get the value from. Must be an instance of the java class of this class mapping- Returns:
- the value of the RDN of the object
- Throws:
Exception
-
setClassSubContext
Set the sub context for this class mapping. e.g. "ou=People"- Parameters:
classSubContext
- the RDN of the context for this class mapping
-
getClassSubContext
Returns the RDN of the subcontext of this class mapping- Returns:
- the RDN of the subcontext of this class mapping
-
getClassSubContextAtt
Returns the name of the LDAP attribute which designates the subcontext- Returns:
- the name of the LDAP attribute which designates the subcontext
-
getClassSubContextVal
Returns the value of the LDAP attribute which designates the subcontext- Returns:
- the value of the LDAP attribute which designates the subcontext
-