Class StrongLockManager

    • Field Detail

      • CACHE_ENABLED_PROP

        public static final java.lang.String CACHE_ENABLED_PROP
        See Also:
        Constant Field Values
      • CACHE_MAX_ENTRIES_PROP

        public static final java.lang.String CACHE_MAX_ENTRIES_PROP
        See Also:
        Constant Field Values
    • Method Detail

      • 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> java.util.Set<T> getLockedDataSet​(java.lang.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> java.util.Set<T> getLockedDataSet​(java.lang.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> java.util.Set<T> getLockedDataSet​(java.lang.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,
                         java.lang.String context,
                         java.lang.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 java.lang.String getLockInfo​(Data data,
                                            java.util.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 java.lang.String getLockInfo​(Data data,
                                            java.util.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,
                                  java.lang.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
      • 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:
        DBListener.onPostDelete(DBData, PostDeleteEvent, boolean)