org.liquidsite.core.content
Class PermissionList

java.lang.Object
  extended byorg.liquidsite.core.content.PersistentObject
      extended byorg.liquidsite.core.content.PermissionList

public class PermissionList
extends PersistentObject

A content object permission list. All the permissions in the list must reference a single object, the permission reference object. This object must be either a domain or a content object.


Field Summary
 
Fields inherited from class org.liquidsite.core.content.PersistentObject
BINDERS, LOWER_CASE, NUMBERS, UPPER_CASE
 
Constructor Summary
PermissionList(ContentManager manager, Content content)
          Creates a new empty permission list for a content object.
PermissionList(ContentManager manager, Domain domain)
          Creates a new empty permission list for a domain.
 
Method Summary
protected  void doDelete(DataSource src, User user)
          Deletes the object data from the database.
protected  void doInsert(DataSource src, User user, boolean restore)
          Inserts the object data into the database.
protected  void doUpdate(DataSource src, User user)
          Updates the object data in the database.
protected  void doValidate()
          Validates the object data before writing to the database.
 boolean equals(java.lang.Object obj)
          Checks if this permission list equals another object.
 boolean equals(PermissionList obj)
          Checks if this permission list equals another object.
 Content getContent()
          Returns the permission reference content object.
 int getContentId()
          Returns the permission reference content identifier.
 Domain getDomain()
          Returns the permission reference domain.
 java.lang.String getDomainName()
          Returns the permission reference domain name
 Permission[] getPermissions()
          Returns an array of the permissions in this list.
 boolean isEmpty()
          Checks if the permission list is empty.
 void setPermissions(Permission[] permissions)
          Sets the content of the permission list.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class org.liquidsite.core.content.PersistentObject
decodeMap, delete, delete, encodeMap, getContentManager, hasAdminAccess, hasPublishAccess, hasReadAccess, hasWriteAccess, isPersistent, restore, restore, save, save, validateChars, validateSize
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PermissionList

public PermissionList(ContentManager manager,
                      Domain domain)
Creates a new empty permission list for a domain.

Parameters:
manager - the content manager to use
domain - the domain object

PermissionList

public PermissionList(ContentManager manager,
                      Content content)
Creates a new empty permission list for a content object.

Parameters:
manager - the content manager to use
content - the content object
Method Detail

equals

public boolean equals(java.lang.Object obj)
Checks if this permission list equals another object. This method will only return true if the other object is a permission list for the same domain or content object.

Parameters:
obj - the object to compare with
Returns:
true if the other object is an identical permission list, or false otherwise

equals

public boolean equals(PermissionList obj)
Checks if this permission list equals another object. This method will only return true if the other object is a permission list for the same domain or content object.

Parameters:
obj - the object to compare with
Returns:
true if the other object is an identical permission list, or false otherwise

toString

public java.lang.String toString()
Returns a string representation of this object.

Returns:
a string representation of this object

isEmpty

public boolean isEmpty()
Checks if the permission list is empty. An empty permission list means that the parent object permission list should be used instead.

Returns:
true if the permission list is empty, or false otherwise

getDomain

public Domain getDomain()
                 throws ContentException
Returns the permission reference domain.

Returns:
the permission reference domain
Throws:
ContentException - if no content manager is available

getDomainName

public java.lang.String getDomainName()
Returns the permission reference domain name

Returns:
the permission reference domain name

getContent

public Content getContent()
                   throws ContentException
Returns the permission reference content object.

Returns:
the permission reference content object, or null if the permission reference is a domain object
Throws:
ContentException - if the database couldn't be accessed properly

getContentId

public int getContentId()
Returns the permission reference content identifier.

Returns:
the permission reference content identifier, or zero (0) if the permission reference is a domain object

getPermissions

public Permission[] getPermissions()
Returns an array of the permissions in this list.

Returns:
an array of the permissions in this list

setPermissions

public void setPermissions(Permission[] permissions)
Sets the content of the permission list. All previous permissions will be removed by this method.

Parameters:
permissions - the new array of permissions

doValidate

protected void doValidate()
                   throws ContentException
Validates the object data before writing to the database.

Specified by:
doValidate in class PersistentObject
Throws:
ContentException - if the object data wasn't valid

doInsert

protected void doInsert(DataSource src,
                        User user,
                        boolean restore)
                 throws ContentException
Inserts the object data into the database. If the restore flag is set, no automatic changes should be made to the data before writing to the database.

Specified by:
doInsert in class PersistentObject
Parameters:
src - the data source to use
user - the user performing the operation
restore - the restore flag
Throws:
ContentException - if the database couldn't be accessed properly

doUpdate

protected void doUpdate(DataSource src,
                        User user)
                 throws ContentException
Updates the object data in the database.

Specified by:
doUpdate in class PersistentObject
Parameters:
src - the data source to use
user - the user performing the operation
Throws:
ContentException - if the database couldn't be accessed properly

doDelete

protected void doDelete(DataSource src,
                        User user)
                 throws ContentException
Deletes the object data from the database.

Specified by:
doDelete in class PersistentObject
Parameters:
src - the data source to use
user - the user performing the operation
Throws:
ContentException - if the database couldn't be accessed properly