Class PageLock

  • All Implemented Interfaces:
    java.io.Serializable

    public class PageLock
    extends java.lang.Object
    implements java.io.Serializable
    Describes a lock acquired by an user on a page. For the most part, the regular developer does not have to instantiate this class.

    The PageLock keeps no reference to a WikiPage because otherwise it could keep a reference to a page for a long time.

    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      PageLock​(Page page, java.lang.String locker, java.util.Date acquired, java.util.Date expiry)
      Creates a new PageLock.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Date getAcquisitionTime()
      Returns the timestamp on which this lock was acquired.
      java.util.Date getExpiryTime()
      Returns the timestamp on which this lock will expire.
      java.lang.String getLocker()
      Returns the locker name.
      java.lang.String getPage()
      Returns the name of the page which is locked.
      long getTimeLeft()
      Returns the amount of time left in minutes, rounded up to the nearest minute (so you get a zero only at the last minute).
      boolean isExpired()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PageLock

        public PageLock​(Page page,
                        java.lang.String locker,
                        java.util.Date acquired,
                        java.util.Date expiry)
        Creates a new PageLock. The lock is not attached to any objects at this point.
        Parameters:
        page - WikiPage which is locked.
        locker - The username who locked this page (for display purposes).
        acquired - The timestamp when the lock is acquired
        expiry - The timestamp when the lock expires.
    • Method Detail

      • getPage

        public java.lang.String getPage()
        Returns the name of the page which is locked.
        Returns:
        The name of the page.
      • getLocker

        public java.lang.String getLocker()
        Returns the locker name.
        Returns:
        The name of the locker.
      • getAcquisitionTime

        public java.util.Date getAcquisitionTime()
        Returns the timestamp on which this lock was acquired.
        Returns:
        The acquisition time.
      • getExpiryTime

        public java.util.Date getExpiryTime()
        Returns the timestamp on which this lock will expire.
        Returns:
        The expiry date.
      • getTimeLeft

        public long getTimeLeft()
        Returns the amount of time left in minutes, rounded up to the nearest minute (so you get a zero only at the last minute).
        Returns:
        Time left in minutes.