ca.tnt.ldaputils.impl
Class LdapOrganization

Package class diagram package LdapOrganization
java.lang.Object
  extended by ca.tnt.ldaputils.impl.LdapEntry
      extended by ca.tnt.ldaputils.impl.LdapOrganization
All Implemented Interfaces:
TypeHandler, ILdapEntry, ILdapOrganization, Comparable
Direct Known Subclasses:
LdapBusiness

public class LdapOrganization
extends LdapEntry
implements ILdapOrganization, Comparable, TypeHandler

Implements an LDAP organization object.

Created : 16-Apr-2006 10:25:36 PM MST

Author:
Trenton D. Adams

Field Summary
 
Fields inherited from class ca.tnt.ldaputils.impl.LdapEntry
attributes, isNew, modificationItems, modified, objectClasses
 
Fields inherited from interface ca.tnt.ldaputils.ILdapEntry
ADD_ATTRIBUTE, REMOVE_ATTRIBUTE, REPLACE_ATTRIBUTE
 
Constructor Summary
LdapOrganization()
          Initializes an empty SortedMap for the businessCategories.
 
Method Summary
 int compareTo(Object o)
           
 boolean equals(Object o)
           
 SortedMap<String,? extends ILdapGroup> getBusinessCategories()
          Retrieves a Map of categories where the key is the category name, and the value is the ILdapGroup.
 String getCategoryDN()
          returns the category dn with a bind variable.
 String getFacsimileTelephoneNumber()
           
 String getLocality()
           
 String getOrganization()
           
 String getPostalAddress()
           
 String getPostalCode()
           
 String getPostOfficeBox()
           
 String getStreet()
           
 String getTelephoneNumber()
           
 List getValues(Class classType, Class refType, Object instance)
          Processes LdapEntity objects for the given classType, and return them in a list, for binding or updating.
 int hashCode()
           
 Object processValues(List list, Class refType)
          Processes LdapEntity objects for the given classType.
 void setBusinessCategories(String[] categories, int operation)
           
 void setFacsimileTelephoneNumber(String fax, int operation)
           
 void setLocality(String city, int operation)
           
 void setOrganization(String organizationName, int operation)
           
 void setPostalAddress(String postalAddress, int operation)
           
 void setPostalCode(String postalCode, int operation)
           
 void setPostOfficeBox(String postOfficeBox, int operation)
           
 void setStreet(String street, int operation)
           
 void setTelephoneNumber(String telephoneNumber, int operation)
           
 String toString()
           
 
Methods inherited from class ca.tnt.ldaputils.impl.LdapEntry
convertInstance, getAttributes, getAttributeValues, getBindAttributes, getCn, getCN, getDescription, getDn, getObjectClasses, getStringAttribute, getStringValue, isObjectClass, modifyAttribute, modifyBatchAttribute, modifyBatchAttributes, save, setCn, setDn, setObjectClasses, updateAttribute
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ca.tnt.ldaputils.ILdapEntry
convertInstance, getAttributeValues, getBindAttributes, getCn, getCN, getDescription, getDn, getObjectClasses, getStringValue, modifyAttribute, modifyBatchAttribute, modifyBatchAttributes, save, setCn, setDn
 

Constructor Detail

LdapOrganization

public LdapOrganization()
Initializes an empty SortedMap for the businessCategories.

Method Detail

getBusinessCategories

public SortedMap<String,? extends ILdapGroup> getBusinessCategories()
Description copied from interface: ILdapOrganization
Retrieves a Map of categories where the key is the category name, and the value is the ILdapGroup. This allows iteration through the keys, just for the category names, or iteration through the values for the values, or retrieving values by key

Specified by:
getBusinessCategories in interface ILdapOrganization
Returns:
the Map of categories as described

getTelephoneNumber

public String getTelephoneNumber()
Specified by:
getTelephoneNumber in interface ILdapOrganization

getFacsimileTelephoneNumber

public String getFacsimileTelephoneNumber()
Specified by:
getFacsimileTelephoneNumber in interface ILdapOrganization

getStreet

public String getStreet()
Specified by:
getStreet in interface ILdapOrganization

getPostOfficeBox

public String getPostOfficeBox()
Specified by:
getPostOfficeBox in interface ILdapOrganization

getPostalCode

public String getPostalCode()
Specified by:
getPostalCode in interface ILdapOrganization

getPostalAddress

public String getPostalAddress()
Specified by:
getPostalAddress in interface ILdapOrganization

getLocality

public String getLocality()
Specified by:
getLocality in interface ILdapOrganization

getOrganization

public String getOrganization()
Specified by:
getOrganization in interface ILdapOrganization

setBusinessCategories

public void setBusinessCategories(String[] categories,
                                  int operation)
Specified by:
setBusinessCategories in interface ILdapOrganization

setTelephoneNumber

public void setTelephoneNumber(String telephoneNumber,
                               int operation)
Specified by:
setTelephoneNumber in interface ILdapOrganization

setFacsimileTelephoneNumber

public void setFacsimileTelephoneNumber(String fax,
                                        int operation)
Specified by:
setFacsimileTelephoneNumber in interface ILdapOrganization

setStreet

public void setStreet(String street,
                      int operation)
Specified by:
setStreet in interface ILdapOrganization

setPostOfficeBox

public void setPostOfficeBox(String postOfficeBox,
                             int operation)
Specified by:
setPostOfficeBox in interface ILdapOrganization

setPostalCode

public void setPostalCode(String postalCode,
                          int operation)
Specified by:
setPostalCode in interface ILdapOrganization

setPostalAddress

public void setPostalAddress(String postalAddress,
                             int operation)
Specified by:
setPostalAddress in interface ILdapOrganization

setLocality

public void setLocality(String city,
                        int operation)
Specified by:
setLocality in interface ILdapOrganization

setOrganization

public void setOrganization(String organizationName,
                            int operation)
Specified by:
setOrganization in interface ILdapOrganization

toString

public String toString()
Overrides:
toString in class LdapEntry

getCategoryDN

public String getCategoryDN()
returns the category dn with a bind variable.

CRITICAL dn return value config option (issue-23)

Returns:
the dn with a bind variable.

equals

public boolean equals(Object o)
Overrides:
equals in class LdapEntry

hashCode

public int hashCode()
Overrides:
hashCode in class LdapEntry

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable
Overrides:
compareTo in class LdapEntry

processValues

public Object processValues(List list,
                            Class refType)
Description copied from interface: TypeHandler
Processes LdapEntity objects for the given classType. For example, if we want our data stored in a Map, we would access each object in the list, grab what we think the key should be, use that as the key, and the object itself as the value, and put it into the map. The field of course would be defined something like Map aggregateField

The type handler MUST handle ALL collection types that LdapEntity aggregates are stored in, except List, SortedSet, or native java arrays. If it does not, the data simply won't be stored in the object. The data will then either be whatever your default constructor sets it to, or null. YOUR PROBLEM, not ours. ;)

Specified by:
processValues in interface TypeHandler
Parameters:
list - the data that we need to put into a Collection of some sort.
refType - the type of the field
Returns:
the new collection defined by classType

getValues

public List getValues(Class classType,
                      Class refType,
                      Object instance)
Description copied from interface: TypeHandler
Processes LdapEntity objects for the given classType, and return them in a list, for binding or updating. For example, if you have a processValues() that stores attribute values in a Map, you need to be able to convert it back to a list, for binding, or updating.

If you are using the aggregate functionality, you MUST convert the attribute data back to it's original type, such as String.

The implementation MUST return a non-null List, whether empty or not; otherwise the annotation processing will throw a NullPointerException

Specified by:
getValues in interface TypeHandler
Parameters:
classType - the Class of the field that we're trying to handle.
refType - the type of the field
instance - the instance of the field, might be a collection, or some other type
Returns:
the List of attribute values.