org.liquidsite.core.content
Class Lock

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

public class Lock
extends PersistentObject

A content object lock.


Field Summary
 
Fields inherited from class org.liquidsite.core.content.PersistentObject
BINDERS, LOWER_CASE, NUMBERS, UPPER_CASE
 
Constructor Summary
Lock(ContentManager manager, Content content)
          Creates a new lock with default values.
 
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(Lock obj)
          Checks if this lock equals another object.
 boolean equals(java.lang.Object obj)
          Checks if this lock equals another object.
 java.util.Date getAcquiredDate()
          Returns the lock acquired date.
 Content getContent()
          Returns the content object.
 int getContentId()
          Returns the content identifier.
 Domain getDomain()
          Returns the content domain.
 java.lang.String getDomainName()
          Returns the content domain name
 User getUser()
          Returns the lock owner user.
 java.lang.String getUserName()
          Returns the lock owner user name.
 boolean isOwner(User user)
          Checks if the specified user is the lock owner.
 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

Lock

public Lock(ContentManager manager,
            Content content)
Creates a new lock with default values.

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

equals

public boolean equals(java.lang.Object obj)
Checks if this lock equals another object. This method will only return true if the other object is a lock with the same content identifier.

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

equals

public boolean equals(Lock obj)
Checks if this lock equals another object. This method will only return true if the other object is a lock with the same content identifier.

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

toString

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

Returns:
a string representation of this object

isOwner

public boolean isOwner(User user)
Checks if the specified user is the lock owner.

Parameters:
user - the user to check
Returns:
true if the user is the lock owner, or false otherwise

getDomain

public Domain getDomain()
                 throws ContentException
Returns the content domain.

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

getDomainName

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

Returns:
the content domain name

getContent

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

Returns:
the content object
Throws:
ContentException - if the database couldn't be accessed properly

getContentId

public int getContentId()
Returns the content identifier.

Returns:
the content identifier

getUser

public User getUser()
             throws ContentException
Returns the lock owner user.

Returns:
the lock owner user
Throws:
ContentException - if the database couldn't be accessed properly

getUserName

public java.lang.String getUserName()
Returns the lock owner user name.

Returns:
the lock owner user name

getAcquiredDate

public java.util.Date getAcquiredDate()
Returns the lock acquired date.

Returns:
the lock acquired date

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