com.arsdigita.kernel
Class Role

java.lang.Object
  extended bycom.arsdigita.domain.DomainObject
      extended bycom.arsdigita.kernel.Role

public class Role
extends DomainObject

Represents a role within a group. The class of users who have a given role within a group are treated as a party, so that permissions can be assigned to a role within a group.

This class has not yet been reviewed and is subject to change.

Version:
1.0
Author:
Michael Bryzek
See Also:
Group.createRole(String)

Field Summary
static String versionId
           
 
Constructor Summary
Role(BigDecimal id)
          Wrapper for Role(OID).
Role(DataObject dataObject)
          Constructor.
Role(OID oid)
          Constructor.
 
Method Summary
 void add(Party party)
          Adds a party to this role.
 void addMember(User user)
          Deprecated. Use Role.add()
protected  void beforeSave()
          Persists any changes made to this object.
 boolean checkPermission(ACSObject target, PrivilegeDescriptor priv)
          Checks whether users in this role have the specified PrivilegeDescriptor on the specified target ACS object.
 boolean checkPermission(PrivilegeDescriptor priv)
          Wrapper to check a PrivilegeDescriptor for users in this role on the group that represents the people in this role.
 void delete()
          Deletes this role and all the users in it.
protected  String getBaseDataObjectType()
          Returns the base data object type for this domain object class.
 GroupCollection getContainedGroups()
          Returns a collection of groups that belong to this role.
 PartyCollection getContainedParties()
          Returns a collection of parties (users and subgroups) that belong to this role.
 UserCollection getContainedUsers()
          Returns a collection of users that are direct members in this role.
 String getDescription()
          Gets the description of this role.
 Group getGroup()
          Gets the group that represents the members of this role.
 BigDecimal getID()
          Gets the ID of this role.
 UserCollection getMemberUsers()
          Deprecated. Use Role.getContainedUsers()
 String getName()
          Gets the name of this role.
 void grantPermission(ACSObject target, PrivilegeDescriptor priv)
          Grants users in this role the specified privilege on the specified target ACS object.
 void grantPermission(PrivilegeDescriptor priv)
          Wrapper to grant a PrivilegeDescriptor to users in this role on the group that represents the people in this role.
protected  void initialize()
          Called from all of the DomainObject constructors to initalize or validate the new domain object or its encapsulated data object.
 void remove(Party party)
          Removes a party from this role.
 void removeMember(User user)
          Deprecated. Use Role.remove()
 void revokePermission(ACSObject target, PrivilegeDescriptor priv)
          Revokes the specified PrivilegeDescriptor on the specified target ACS object for users who have this role.
 void revokePermission(PrivilegeDescriptor priv)
          Revokes the specified PrivilegeDescriptor on the group representing people in this role for users who have this role.
 void setDescription(String description)
          Sets the description of this role.
 void setName(String name)
          Sets the name of this role.
 
Methods inherited from class com.arsdigita.domain.DomainObject
add, add, addToAssociation, afterDelete, afterSave, beforeDelete, clear, disconnect, equals, get, getObjectType, getOID, getSession, hashCode, isDeleted, isDisconnected, isModified, isNew, isPropertyModified, isValid, remove, remove, remove, removeFromAssociation, save, set, setAssociation, setAssociation, specializeDataObject, specializeDataObject, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values
Constructor Detail

Role

public Role(DataObject dataObject)
Constructor.

Parameters:
dataObject - The data object to use to create this role
See Also:
DomainObject.DomainObject(DataObject)

Role

public Role(OID oid)
     throws DataObjectNotFoundException
Constructor. The contained DataObject is retrieved from the persistent storage mechanism with an OID specified by oid.

Parameters:
oid - the OID for the retrieved DataObject
See Also:
DomainObject.DomainObject(OID), DataObject, OID

Role

public Role(BigDecimal id)
     throws DataObjectNotFoundException
Wrapper for Role(OID).

Method Detail

getBaseDataObjectType

protected String getBaseDataObjectType()
Description copied from class: DomainObject
Returns the base data object type for this domain object class. Intended to be overrided by subclasses whenever the subclass will only work if their primary data object is of a certain base type.

Overrides:
getBaseDataObjectType in class DomainObject
Returns:
The fully qualified name ("modelName.typeName") of the base data object type for this domain object class, or null if there is no restriction on the data object type for the primary data object encapsulated by this class.

initialize

protected void initialize()
Description copied from class: DomainObject
Called from all of the DomainObject constructors to initalize or validate the new domain object or its encapsulated data object. This was introduced in order to support efficient validation of the encapsualted data object's type. If the validation is typically performed in class constructors, then redundant validation is performed in superclass constructors. This validation now occurs here.

Overrides:
initialize in class DomainObject

getID

public BigDecimal getID()
Gets the ID of this role.

Returns:
the ID of this role.

setName

public void setName(String name)
Sets the name of this role.

Parameters:
name - the name of this role

getName

public String getName()
Gets the name of this role.

Returns:
the name of this role.

setDescription

public void setDescription(String description)
Sets the description of this role.

Parameters:
description - the description of this role

getDescription

public String getDescription()
Gets the description of this role.

Returns:
the description of this role.

getMemberUsers

public UserCollection getMemberUsers()
Deprecated. Use Role.getContainedUsers()

Returns a collection of users that are direct members in this role. NOTE: Any prior calls to addMember() or removeMember() will not affect the resulting collection unless save() has been called after adding or removing the member(s).

Returns:
a collection of users that are direct members in this role.

getContainedUsers

public UserCollection getContainedUsers()
Returns a collection of users that are direct members in this role. NOTE: Any prior calls to addMember() or removeMember() will not affect the resulting collection unless save() has been called after adding or removing the member(s).

Returns:
a collection of users that are direct members in this role.

getContainedGroups

public GroupCollection getContainedGroups()
Returns a collection of groups that belong to this role. NOTE: Any prior calls to add() or remove() will not affect the resulting collection unless save() has been called after adding or removing the member(s).

Returns:
a collection of groups that belong to this role.

getContainedParties

public PartyCollection getContainedParties()
Returns a collection of parties (users and subgroups) that belong to this role. NOTE: Any prior calls to add() or remove() will not affect the resulting collection unless save() has been called after adding or removing any members.

Returns:
a collection of parties that belong to this role

add

public void add(Party party)
Adds a party to this role.

Parameters:
party - the party to add to this role

remove

public void remove(Party party)
Removes a party from this role.

Parameters:
party - the party to remove from this role

addMember

public void addMember(User user)
Deprecated. Use Role.add()

Adds a user to this role.

Parameters:
user - the user to add to this role

removeMember

public void removeMember(User user)
Deprecated. Use Role.remove()

Removes a user from this role.

Parameters:
user - the user to remove from this role

beforeSave

protected void beforeSave()
Persists any changes made to this object. Also automatically generates an ID for this role if one is not already specified.

Overrides:
beforeSave in class DomainObject
See Also:
DataObject.save()

delete

public void delete()
            throws PersistenceException
Deletes this role and all the users in it.

Overrides:
delete in class DomainObject
Throws:
PersistenceException
See Also:
DataObject.delete()

grantPermission

public void grantPermission(ACSObject target,
                            PrivilegeDescriptor priv)
Grants users in this role the specified privilege on the specified target ACS object.

Parameters:
target - the ACS object on which to grant the privilege
priv - the privilege to grant
See Also:
PermissionService.grantPermission(PermissionDescriptor)

grantPermission

public void grantPermission(PrivilegeDescriptor priv)
Wrapper to grant a PrivilegeDescriptor to users in this role on the group that represents the people in this role.

Parameters:
priv - the privilege to grant

checkPermission

public boolean checkPermission(ACSObject target,
                               PrivilegeDescriptor priv)
Checks whether users in this role have the specified PrivilegeDescriptor on the specified target ACS object.

Parameters:
target - the ACS object to check
priv - the privilege to check for
Returns:
true if the users have the PrivilegeDescriptor on the specified target; false otherwise.
See Also:
PermissionService.checkPermission(PermissionDescriptor)

checkPermission

public boolean checkPermission(PrivilegeDescriptor priv)
Wrapper to check a PrivilegeDescriptor for users in this role on the group that represents the people in this role.


revokePermission

public void revokePermission(ACSObject target,
                             PrivilegeDescriptor priv)
Revokes the specified PrivilegeDescriptor on the specified target ACS object for users who have this role.

Parameters:
target - the ACS object that has the privilege to revoke
priv - the privilege to revoke
See Also:
PermissionService.revokePermission(PermissionDescriptor)

revokePermission

public void revokePermission(PrivilegeDescriptor priv)
Revokes the specified PrivilegeDescriptor on the group representing people in this role for users who have this role.

Parameters:
priv - the privilege to revoke
See Also:
PermissionService.revokePermission(PermissionDescriptor)

getGroup

public Group getGroup()
Gets the group that represents the members of this role. This is used primarily to support tests. This is a temporary solution to support CMS permissioning. It will change in the future and this method will probably not be supported at that point.



Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2337 UTC