Class StrongLockManager

java.lang.Object
com.jalios.jcms.db.BasicDBListener
com.jalios.jcms.StrongLockManager
All Implemented Interfaces:
DBConstants, DBListener, PluginComponent, JPropertiesListener

public class StrongLockManager extends BasicDBListener implements JPropertiesListener
This class manages StrongLock.
Since:
jcms-6.2.0
  • Field Details

  • Method Details

    • getInstance

      public static StrongLockManager getInstance()
    • propertiesChange

      public void propertiesChange(JProperties properties)
      Description copied from interface: JPropertiesListener
      Invoked after properties have been modified in JCMS and save on disk.

      You cannot alter the value received in parameters.

      Note that properties parameter may be null, a limited set of site properties, or all site properties.

      To check that a property has been modified, reload the "current" property instead using channel.getProperties or channel.getProperty.

      Specified by:
      propertiesChange in interface JPropertiesListener
      Parameters:
      properties - the properties which have been submitted to change
    • getStrongLock

      public StrongLock getStrongLock(Data data)
      Returns the StrongLock bound to given data.
      Parameters:
      data - the data
      Returns:
      the StrongLock bound to given data.
      Since:
      jcms-6.2.0
    • getStrongLock

      public StrongLock getStrongLock(Data data, boolean useCache)
      Returns the StrongLock bound to given data.
      Parameters:
      data - the data
      useCache - indicate if the cache can be used.
      Returns:
      the StrongLock bound to given data.
      Since:
      jcms-6.2.0
    • isLocked

      public boolean isLocked(Data data)
      Returns true if the given data is locked.
      Parameters:
      data - the data
      Returns:
      true if the given data is locked.
      Since:
      jcms-6.2.0
    • getLockedDataSet

      public <T extends Data> Set<T> getLockedDataSet(Class<T> clazz)
      Returns all the locked data for the given class.
      Type Parameters:
      T - Any Data type
      Parameters:
      clazz - the class
      Returns:
      all the locked data for the given class.
      Since:
      jcms-6.2.0
    • getLockedDataSet

      public <T extends Data> Set<T> getLockedDataSet(Class<T> clazz, boolean useCache)
      Returns all the locked data for the given class.
      Type Parameters:
      T - Any Data type
      Parameters:
      clazz - the class
      useCache - use the cache if true
      Returns:
      all the locked data for the given class.
      Since:
      jcms-6.2.0
    • getLockedDataSet

      public <T extends Data> Set<T> getLockedDataSet(Class<T> clazz, Member mbr)
      Returns all the locked data for the given class and locked by the given member.
      Type Parameters:
      T - Any Data type
      Parameters:
      clazz - the class
      mbr - the member
      Returns:
      all the locked data for the given class and locked by the given member.
      Since:
      jcms-9.0.1
    • lock

      public void lock(Data data, Member mbr)
      Lock the given data for the given member.
      Parameters:
      data - the data
      mbr - the member who puts the lock.
      Since:
      jcms-6.2.0
    • lock

      public void lock(Data data, Member mbr, String context, String contextData)
      Lock the given data for the given member.
      Parameters:
      data - the data
      mbr - the member who puts the lock.
      context - the context of the lock
      contextData - the context data (custom data put by context manager)
      Since:
      jcms-10.0.2
    • unlock

      public void unlock(Data data, Member mbr)
      Unlock the given data
      Parameters:
      data - the data
      mbr - the member who releases the lock (only the member who has locked and the admin can release the lock).
      Since:
      jcms-6.2.0
    • unlock

      public void unlock(Data data)
      Unlock the given data, without checking the member.
      Parameters:
      data - the data
      Since:
      jcms-6.2.0
    • unlock

      public void unlock(Data data, Member mbr, boolean force)
      Unlock the given data
      Parameters:
      data - the data
      mbr - the member who releases the lock
      force - if false only the member who has locked and the admin can release the lock.
      Since:
      jcms-6.2.0
    • canUnlock

      public boolean canUnlock(Data data, Member mbr)
      Returns true if the member can unlock the given data
      Parameters:
      data - the data
      mbr - the member
      Returns:
      true if the member can unlock the given data
      Since:
      jcms-9.0.0
    • canUnlock

      public boolean canUnlock(StrongLock lock, Member mbr)
      Returns true if the member can unlock the given lock
      Parameters:
      lock - the lock
      mbr - the member
      Returns:
      true if the member can unlock the given lock
      Since:
      jcms-9.0.0
    • checkLockMember

      public boolean checkLockMember(Data data, Member mbr)
      Returns true if the given member has locked the given data or if the data is not locked.
      Parameters:
      data - the data
      mbr - the member
      Returns:
      true if the given member has locked the given data or if the data is not locked.
      Since:
      jcms-6.2.0
    • checkLockMember

      public boolean checkLockMember(Data data, Member mbr, boolean useCache)
      Returns true if the given member has locked the given data or if the data is not locked.
      Parameters:
      data - the data
      mbr - the member
      useCache - indicate if the cache can be used.
      Returns:
      true if the given member has locked the given data or if the data is not locked.
      Since:
      jcms-10.0.1
    • getLockInfo

      public String getLockInfo(Data data, Locale locale)
      Returns a string which explains who has the lock on the given data (return "" if the data is not locked)
      Parameters:
      data - the data
      locale - the locale
      Returns:
      a string which explains who has the lock.
      Since:
      jcms-6.2.0
    • getLockInfo

      public String getLockInfo(Data data, Locale locale, boolean useCache)
      Returns a string which explains who has the lock on the given data (return "" if the data is not locked)
      Parameters:
      data - the data
      locale - the locale
      useCache - indicate if the cache can be used.
      Returns:
      a string which explains who has the lock.
      Since:
      jcms-6.2.0
    • canRequestUnlock

      public boolean canRequestUnlock(Data data, Member mbr)
      Returns true if the given member can request the unlock (by mail).
      Parameters:
      data - the data
      mbr - the member who request the unlock
      Returns:
      true if the given member can request the unlock.
      Since:
      jcms-8.0.0
    • requestUnlock

      public void requestUnlock(Data data, Member mbr, String message)
      Request to unlock the given data for the given member
      Parameters:
      data - the locked data
      mbr - the member who request the unlock
      message - a free message from the member who request the unlock
      Since:
      jcms-8.0.0
    • resetCache

      public void resetCache()
      Reset the cache. A new cache is initialized.
      Since:
      jcms-6.2.0
    • refreshCacheEntry

      public void refreshCacheEntry(Data data)
      Invalidate the cache entries for the given publication
      Parameters:
      data - the publication id
      Since:
      jcms-6.2.0
    • onPostInsert

      public void onPostInsert(DBData data, org.hibernate.event.PostInsertEvent event, boolean firstTime)
      Description copied from interface: DBListener
      This method is called after a DBData has been created.
      Specified by:
      onPostInsert in interface DBListener
      Overrides:
      onPostInsert in class BasicDBListener
      Parameters:
      data - the data.
      event - the event.
      firstTime - true on the JSync replica on which the operation took place and false on the other replicas.
      See Also:
    • onPostUpdate

      public void onPostUpdate(DBData data, org.hibernate.event.PostUpdateEvent event, boolean firstTime)
      Description copied from interface: DBListener
      This method is called after a DBData has been updated.
      Specified by:
      onPostUpdate in interface DBListener
      Overrides:
      onPostUpdate in class BasicDBListener
      Parameters:
      data - the data.
      event - the event.
      firstTime - true on the JSync replica on which the operation took place and false on the other replicas.
      See Also:
    • onPostDelete

      public void onPostDelete(DBData data, org.hibernate.event.PostDeleteEvent event, boolean firstTime)
      Description copied from interface: DBListener
      This method is called after a DBData has been deleted.
      Specified by:
      onPostDelete in interface DBListener
      Overrides:
      onPostDelete in class BasicDBListener
      Parameters:
      data - the deleted DBData. WARNING! In a JSync Cluster, when firstTime is false, this data will be null. In this case, to get information about this deleted data, you must use the event and in particular event.getId(), which returns the JPlatform ID of the data, and event.getDeletedState() which returns the attributes of the data.
      event - the event
      firstTime - true on the JSync replica on which the operation took place and false on the other replicas.
      See Also: