|
uPortal 2.4.1 API Documentation |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jasig.portal.groups.GroupMemberImpl
org.jasig.portal.groups.EntityGroupImpl
Reference implementation for IEntityGroup
.
Groups do not keep references to their members but instead cache
member keys. The members are cached externally. The rules
for controlling access to the key caches are a bit obscure, but you
should understand them before writing code that updates groups.
Access to the caches themselves is synchronized via the cache
getters and setters. All requests to get group members and to add or
remove group members ultimately go through these methods. The
mutating methods, addMember()
and removeMember()
however, do a copy-on-write. That is, they first make a copy of the
cache, add or remove the member key, and then replace the original
cache with the copy. This permits multiple read and write threads to run
concurrently without throwing ConcurrentModificationExceptions
.
But it still leaves open the danger of data races because nothing in
this class guarantees serialized write access. You must impose this
from without, either via explicit locking (GroupService.getLockableGroup()
)
or by synchronizing access from the caller.
IEntityGroup
Constructor Summary | |
EntityGroupImpl(java.lang.String groupKey,
java.lang.Class entityType)
EntityGroupImpl |
Method Summary | |
void |
addMember(IGroupMember gm)
Adds IGroupMember gm to our member Map and conversely,
adds this to gm's group Map , after checking that the
addition does not violate group rules. |
boolean |
contains(IGroupMember gm)
Checks if GroupMember gm is a member of this. |
boolean |
deepContains(IGroupMember gm)
Checks recursively if GroupMember gm is a member of this. |
void |
delete()
Delegates to the factory. |
boolean |
equals(java.lang.Object obj)
Answers if Object o is an IGroupMember that refers to the same underlying
entity(ies) as this . |
java.util.HashMap |
getAddedMembers()
|
java.util.Iterator |
getAllEntities()
Returns an Iterator over the Set of this
IEntityGroup'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 IEntityGroup . |
java.lang.String |
getCreatorID()
Returns the name of the group creator. |
java.lang.String |
getDescription()
Returns the group description, which may be null. |
java.util.Iterator |
getEntities()
Returns an Iterator over this IEntityGroup's
members that are IEntities . |
EntityIdentifier |
getEntityIdentifier()
|
java.lang.String |
getEntityKey()
Returns the key of the underyling entity. |
java.lang.Class |
getEntityType()
Returns the entity type of this groups's leaf members. |
java.lang.String |
getGroupID()
|
java.lang.Class |
getLeafType()
Returns the entity type of this groups's members. |
java.lang.String |
getLocalKey()
Returns the key from the group service of origin. |
IEntityGroup |
getMemberGroupNamed(java.lang.String name)
Returns the named member IEntityGroup . |
java.util.Iterator |
getMembers()
Returns an Iterator over the GroupMembers in our
member Collection . |
java.lang.String |
getName()
Returns the group name. |
java.util.HashMap |
getRemovedMembers()
|
javax.naming.Name |
getServiceName()
Returns the Name of the group service of origin. |
java.lang.Class |
getType()
Returns this object's type for purposes of caching and locking, as opposed to the underlying entity type. |
boolean |
hasAdds()
Answers if there are any added memberships not yet committed to the database. |
boolean |
hasDeletes()
Answers if there are any deleted memberships not yet committed to the database. |
int |
hashCode()
Generates a hash code for the receiver. |
boolean |
hasMembers()
Answers if this IGroupMember has any members. |
boolean |
isDirty()
Answers if there are any added or deleted memberships not yet committed to the database. |
boolean |
isEditable()
Answers if this IEntityGroup can be changed or deleted. |
boolean |
isGroup()
|
void |
primSetName(java.lang.String newName)
|
void |
removeMember(IGroupMember gm)
Removes IGroupMember gm from our member Map and,
conversely, remove this from gm's group Map . |
void |
setCreatorID(java.lang.String newCreatorID)
|
void |
setDescription(java.lang.String newDescription)
|
void |
setLocalGroupService(IIndividualGroupService newIndividualGroupService)
Sets the group service of origin. |
void |
setName(java.lang.String newName)
We used to check duplicate sibling names but no longer do. |
void |
setServiceName(javax.naming.Name newServiceName)
Sets the service Name of the group service of origin. |
java.lang.String |
toString()
Returns a String that represents the value of this object. |
void |
update()
Delegate to the factory. |
void |
updateMembers()
Delegate to the factory. |
Methods inherited from class org.jasig.portal.groups.GroupMemberImpl |
addGroup, getAllContainingGroups, getContainingGroups, getKey, getUnderlyingEntityIdentifier, isDeepMemberOf, isEntity, isMemberOf, removeGroup |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.jasig.portal.groups.IGroupMember |
getAllContainingGroups, getContainingGroups, getKey, getUnderlyingEntityIdentifier, isDeepMemberOf, isEntity, isMemberOf |
Constructor Detail |
public EntityGroupImpl(java.lang.String groupKey, java.lang.Class entityType) throws GroupsException
Method Detail |
public void addMember(IGroupMember gm) throws GroupsException
IGroupMember
gm to our member Map
and conversely,
adds this
to gm's group Map
, after checking that the
addition does not violate group rules. Remember that we have added it so we can
update the database if necessary.
addMember
in interface IEntityGroup
gm
- org.jasig.portal.groups.IGroupMember
GroupsException
- is thrown if the member is a group and
this group already has a group with the same name or if the addition
of the group creates a circular reference.public boolean contains(IGroupMember gm) throws GroupsException
GroupMember
gm is a member of this.
contains
in interface IGroupMember
contains
in class GroupMemberImpl
gm
- org.jasig.portal.groups.IGroupMember
GroupsException
public boolean deepContains(IGroupMember gm) throws GroupsException
GroupMember
gm is a member of this.
deepContains
in interface IGroupMember
deepContains
in class GroupMemberImpl
gm
- org.jasig.portal.groups.IGroupMember
GroupsException
public void delete() throws GroupsException
delete
in interface IEntityGroup
GroupsException
- if the delete cannot be performed.public boolean equals(java.lang.Object obj)
IGroupMember
IGroupMember
that refers to the same underlying
entity(ies) as this
.
equals
in interface IGroupMember
obj
- the Object to compare with
Hashtable
public java.util.HashMap getAddedMembers()
public java.util.Iterator getAllEntities() throws GroupsException
Iterator
over the Set
of this
IEntityGroup's
recursively-retrieved members that are
IEntities
.
getAllEntities
in interface IGroupMember
getAllEntities
in class GroupMemberImpl
GroupsException
public java.util.Iterator getAllMembers() throws GroupsException
Iterator
over the Set
of recursively-retrieved
IGroupMembers
that are members of this IEntityGroup
.
getAllMembers
in interface IGroupMember
getAllMembers
in class GroupMemberImpl
GroupsException
public java.lang.String getCreatorID()
IEntityGroup
getCreatorID
in interface IEntityGroup
public java.lang.String getDescription()
IEntityGroup
getDescription
in interface IEntityGroup
public java.util.Iterator getEntities() throws GroupsException
Iterator
over this IEntityGroup's
members that are IEntities
.
getEntities
in interface IGroupMember
getEntities
in class GroupMemberImpl
GroupsException
public EntityIdentifier getEntityIdentifier()
getEntityIdentifier
in interface IBasicEntity
public java.lang.String getEntityKey()
public java.lang.Class getEntityType()
getEntityType
in interface IGroupMember
EntityTypes
public java.lang.String getGroupID()
public java.lang.Class getLeafType()
getLeafType
in interface IGroupMember
EntityTypes
public java.lang.String getLocalKey()
getLocalKey
in interface IEntityGroup
public IEntityGroup getMemberGroupNamed(java.lang.String name) throws GroupsException
IEntityGroup
.
getMemberGroupNamed
in interface IGroupMember
getMemberGroupNamed
in class GroupMemberImpl
name
- java.lang.String
GroupsException
public java.util.Iterator getMembers() throws GroupsException
Iterator
over the GroupMembers
in our
member Collection
.
getMembers
in interface IGroupMember
getMembers
in class GroupMemberImpl
GroupsException
public java.lang.String getName()
IEntityGroup
getName
in interface IEntityGroup
public java.util.HashMap getRemovedMembers()
public javax.naming.Name getServiceName()
getServiceName
in interface IEntityGroup
public java.lang.Class getType()
getType
in interface IGroupMember
getType
in class GroupMemberImpl
public boolean hasAdds()
public boolean hasDeletes()
public int hashCode()
hashCode
in interface IGroupMember
hashCode
in class GroupMemberImpl
Hashtable
public boolean hasMembers() throws GroupsException
IGroupMember
IGroupMember
has any members.
hasMembers
in interface IGroupMember
hasMembers
in class GroupMemberImpl
GroupsException
public boolean isDirty()
public boolean isEditable() throws GroupsException
IEntityGroup
can be changed or deleted.
isEditable
in interface IEntityGroup
GroupsException
public boolean isGroup()
isGroup
in interface IGroupMember
isGroup
in class GroupMemberImpl
public void primSetName(java.lang.String newName)
newName
- java.lang.Stringpublic void removeMember(IGroupMember gm) throws GroupsException
IGroupMember
gm from our member Map
and,
conversely, remove this from gm's group Map
. Remember that we
have removed it so we can update the database, if necessary.
removeMember
in interface IEntityGroup
gm
- org.jasig.portal.groups.IGroupMember
GroupsException
public void setCreatorID(java.lang.String newCreatorID)
setCreatorID
in interface IEntityGroup
newCreatorID
- java.lang.Stringpublic void setDescription(java.lang.String newDescription)
setDescription
in interface IEntityGroup
newDescription
- java.lang.Stringpublic void setLocalGroupService(IIndividualGroupService newIndividualGroupService) throws GroupsException
IEntityGroup
setLocalGroupService
in interface IEntityGroup
newIndividualGroupService
- IIndividualGroupService
GroupsException
public void setName(java.lang.String newName) throws GroupsException
setName
in interface IEntityGroup
newName
- java.lang.String
GroupsException
public void setServiceName(javax.naming.Name newServiceName) throws GroupsException
GroupsException
public java.lang.String toString()
public void update() throws GroupsException
update
in interface IEntityGroup
GroupsException
- if the update cannot be performed.public void updateMembers() throws GroupsException
updateMembers
in interface IEntityGroup
GroupsException
- if the update cannot be performed.
|
uPortal 2.4.1 API Documentation |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |