ca.tnt.ldaputils.impl
Class LdapGroup

Package class diagram package LdapGroup
java.lang.Object
  extended by ca.tnt.ldaputils.impl.LdapEntry
      extended by ca.tnt.ldaputils.impl.LdapGroup
All Implemented Interfaces:
ILdapEntry, ILdapGroup, Serializable, Comparable

public class LdapGroup
extends LdapEntry
implements ILdapGroup, Serializable, Comparable

LDAPGroup implementation.

Created : 14-Apr-2006 6:57:16 PM MST

MINOR : When removing members, check for existence, then fail silently if it does not exist. Otherwise, remove it.

Author:
Trenton D. Adams
See Also:
Serialized Form

Field Summary
protected  SortedSet<String> sortedMembers
          REQUIRED_FEATURE replace with SortedMap of ILdapOrganization entries, once we have gotten around infinite recursion.
 
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
LdapGroup()
           
 
Method Summary
 void addMember(ILdapEntry ldapEntry)
          Add a member to this group.
 int compareTo(Object o)
           
 boolean equals(Object o)
           
 SortedSet<String> getBusinessCategories()
          Retrieves a list of business categories for this group.
 SortedSet getMembers()
          Returns a non-null SortedSet of group members.
 Map getMembers(String keyAttribute, int objectType)
           
 int hashCode()
           
 void removeMember(ILdapEntry ldapEntry)
          Remove a member from this group.
 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
 

Field Detail

sortedMembers

protected final SortedSet<String> sortedMembers
REQUIRED_FEATURE replace with SortedMap of ILdapOrganization entries, once we have gotten around infinite recursion. However, this should probably be done in an example object in the test package, not here, as we do not necessarily want to link back to the original object. Then again, maybe we should simply be creating two separate sub projects. One for common Classes, doing it the way we "think", and one that is the actual framework.

SortedSet of members of the group, in DN String format.

Constructor Detail

LdapGroup

public LdapGroup()
Method Detail

getMembers

public Map getMembers(String keyAttribute,
                      int objectType)
               throws InvalidNameException
Specified by:
getMembers in interface ILdapGroup
Parameters:
keyAttribute - key for the map
Returns:
map of members with organization as the key. The members are of type @link{LDAPFactory.LDAP_TNT_BUSINESS} @param keyAttribute
Throws:
InvalidNameException

getMembers

public SortedSet getMembers()
Description copied from interface: ILdapGroup
Returns a non-null SortedSet of group members. If there are no members, the set's size is ZERO.

Specified by:
getMembers in interface ILdapGroup
Returns:
all members in DN format, in alphabetical order.

addMember

public void addMember(ILdapEntry ldapEntry)
Description copied from interface: ILdapGroup
Add a member to this group.

Specified by:
addMember in interface ILdapGroup
Parameters:
ldapEntry - the ldap object corresponding to the member to add.

removeMember

public void removeMember(ILdapEntry ldapEntry)
Description copied from interface: ILdapGroup
Remove a member from this group.

Specified by:
removeMember in interface ILdapGroup
Parameters:
ldapEntry - the ldap object corresponding to the member to add.

toString

public String toString()
Overrides:
toString in class LdapEntry

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

getBusinessCategories

public SortedSet<String> getBusinessCategories()
Retrieves a list of business categories for this group.

Specified by:
getBusinessCategories in interface ILdapGroup
Returns:
a SortedSet of category names