org.jasig.portal.groups
Interface IGroupMember

All Superinterfaces:
IBasicEntity
All Known Subinterfaces:
IEntity, IEntityGroup, ILockableEntityGroup
All Known Implementing Classes:
EntityGroupImpl, EntityImpl, EntityTestingGroupImpl, GroupMemberImpl, LockableEntityGroupImpl, SearchResultsGroupImpl

public interface IGroupMember
extends IBasicEntity

An IGroupMember defines common behavior for both the leaf IEntity and composite IEntityGroup sub-types that together make up a Groups structure.

An IGroupMember can answer both its parents and its children but has no api for adding or removing them. These methods are defined on the composite type, IEntityGroup, since you add a member to a group, and not vice versa.

Because it extends IBasicEntity, an IGroupMember has an EntityIdentifier that can be used to cache and lock it. A leaf IGroupMember also has a separate EntityIdentifier for its underlying entity. This second EntityIdentifier is used to create and record group memberships. In the case of a composite (non-leaf) IGroupMember, both EntityIdentifiers are the same.

Take care to implement equals() and hashCode() so that duplicates returned from "deep" methods can be recognized.

Version:
$Revision: 1.10 $
Author:
Dan Ellentuck

Method Summary
 boolean contains(IGroupMember gm)
          Answers if IGroupMember gm is a member of this.
 boolean deepContains(IGroupMember gm)
          Answers if IGroupMember gm is a recursive member of this.
 boolean equals(java.lang.Object o)
          Answers if Object o is an IGroupMember that refers to the same underlying entity(ies) as this.
 java.util.Iterator getAllContainingGroups()
          Returns an Iterator over the Set of this IGroupMember's recursively-retrieved parent groups.
 java.util.Iterator getAllEntities()
          Returns an Iterator over the Set of this IGroupMember's recursively-retrieved members that are IEntities.
 java.util.Iterator getAllMembers()
          Returns an Iterator over the Set of recursively-retrieved IGroupMembers that are members of this.
 java.util.Iterator getContainingGroups()
          Returns an Iterator over this IGroupMember's parent groups.
 java.util.Iterator getEntities()
          Returns an Iterator over this IGroupMember's members that are IEntities.
 java.lang.Class getEntityType()
          Returns the underlying entity type.
 java.lang.String getKey()
          Returns the key of the underlying entity.
 java.lang.Class getLeafType()
           
 IEntityGroup getMemberGroupNamed(java.lang.String name)
          Returns the named IEntityGroup from our members Collection.
 java.util.Iterator getMembers()
          Returns an Iterator over the IGroupMembers in our member Collection.
 java.lang.Class getType()
          Returns the type of the underlying entity.
 EntityIdentifier getUnderlyingEntityIdentifier()
          Returns EntityIdentifier for this IGroupMember's underlying entity.
 int hashCode()
           
 boolean hasMembers()
          Answers if this IGroupMember has any members.
 boolean isDeepMemberOf(IGroupMember gm)
          Answers if this is a recursive member of IGroupMember gm.
 boolean isEntity()
           
 boolean isGroup()
           
 boolean isMemberOf(IGroupMember gm)
          Answers if this is a member of IGroupMember gm.
 
Methods inherited from interface org.jasig.portal.IBasicEntity
getEntityIdentifier
 

Method Detail

contains

boolean contains(IGroupMember gm)
                 throws GroupsException
Answers if IGroupMember gm is a member of this.

Parameters:
gm - org.jasig.portal.groups.IGroupMember
Returns:
boolean
Throws:
GroupsException

deepContains

boolean deepContains(IGroupMember gm)
                     throws GroupsException
Answers if IGroupMember gm is a recursive member of this.

Parameters:
gm - org.jasig.portal.groups.IGroupMember
Returns:
boolean
Throws:
GroupsException

equals

boolean equals(java.lang.Object o)
Answers if Object o is an IGroupMember that refers to the same underlying entity(ies) as this.

Overrides:
equals in class java.lang.Object
Parameters:
o -
Returns:
boolean

getAllContainingGroups

java.util.Iterator getAllContainingGroups()
                                          throws GroupsException
Returns an Iterator over the Set of this IGroupMember's recursively-retrieved parent groups.

Returns:
java.util.Iterator
Throws:
GroupsException

getAllEntities

java.util.Iterator getAllEntities()
                                  throws GroupsException
Returns an Iterator over the Set of this IGroupMember's recursively-retrieved members that are IEntities.

Returns:
java.util.Iterator
Throws:
GroupsException

getAllMembers

java.util.Iterator getAllMembers()
                                 throws GroupsException
Returns an Iterator over the Set of recursively-retrieved IGroupMembers that are members of this.

Returns:
java.util.Iterator
Throws:
GroupsException

getContainingGroups

java.util.Iterator getContainingGroups()
                                       throws GroupsException
Returns an Iterator over this IGroupMember's parent groups.

Returns:
java.util.Iterator
Throws:
GroupsException

getEntities

java.util.Iterator getEntities()
                               throws GroupsException
Returns an Iterator over this IGroupMember's members that are IEntities.

Returns:
java.util.Iterator
Throws:
GroupsException

getEntityType

java.lang.Class getEntityType()
Returns the underlying entity type. For an IEntityGroup, this is analagous to Class as applied to an Array; it is an attribute of the group object. For an IEntity, it is the entity type of the group the entity belongs to, which may be any Class the underlying entity can be legally cast to. Thus, an IEntity with an underlying entity of type Manager could have an entity type of Employee as long as Employee was a superclass of Manager.

Returns:
java.lang.Class

getKey

java.lang.String getKey()
Returns the key of the underlying entity.

Returns:
String

getLeafType

java.lang.Class getLeafType()
See Also:
getEntityType()

getMemberGroupNamed

IEntityGroup getMemberGroupNamed(java.lang.String name)
                                 throws GroupsException
Returns the named IEntityGroup from our members Collection.

Parameters:
name - java.lang.String
Returns:
org.jasig.portal.groups.IEntityGroup
Throws:
GroupsException

getMembers

java.util.Iterator getMembers()
                              throws GroupsException
Returns an Iterator over the IGroupMembers in our member Collection.

Returns:
java.util.Iterator
Throws:
GroupsException

getType

java.lang.Class getType()
Returns the type of the underlying entity. For a group this will be IEntityGroup. For an entity, it will be the type of the underlying EntityIdentifier.

Returns:
java.lang.Class

getUnderlyingEntityIdentifier

EntityIdentifier getUnderlyingEntityIdentifier()
Returns EntityIdentifier for this IGroupMember's underlying entity. In the case of an IEntityGroup, it will be the EntityIdentifier for this. In the case of an IEntity, it will be the EntityIdentifier that identifies the underlying IPerson, ChannelDefinition, etc.

Returns:
org.jasig.portal.EntityIdentifier

hashCode

int hashCode()
Overrides:
hashCode in class java.lang.Object
Returns:
int

hasMembers

boolean hasMembers()
                   throws GroupsException
Answers if this IGroupMember has any members.

Returns:
boolean
Throws:
GroupsException

isDeepMemberOf

boolean isDeepMemberOf(IGroupMember gm)
                       throws GroupsException
Answers if this is a recursive member of IGroupMember gm.

Parameters:
gm - org.jasig.portal.groups.IGroupMember
Returns:
boolean
Throws:
GroupsException

isEntity

boolean isEntity()
Returns:
boolean

isGroup

boolean isGroup()
Returns:
boolean

isMemberOf

boolean isMemberOf(IGroupMember gm)
                   throws GroupsException
Answers if this is a member of IGroupMember gm.

Parameters:
gm - org.jasig.portal.groups.IGroupMember
Returns:
boolean
Throws:
GroupsException