com.jalios.jcms
Class StrongLockManager

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

public class StrongLockManager
extends BasicDBListener

This class manages StrongLock.

Since:
jcms-6.2.0
Version:
$Revision: 77647 $

Nested Class Summary
 class StrongLockManager.CacheEntry
           
 
Field Summary
static String CACHE_ENABLED_PROP
           
static String CACHE_MAX_ENTRIES_PROP
           
static String DATA_ID_FIELD
           
static String REVISION
           
 
Fields inherited from interface com.jalios.jcms.db.DBConstants
ALL_CATEGORIES_SET_FIELD, AUTH_GRP_SET_FIELD, AUTH_MBR_SET_FIELD, AUTHOR_ID_FIELD, CATEGORIES_SET_FIELD, CDATE_FIELD, CHANNEL_JCMSDB_PROP, DBDATA_URID, HAS_NO_READ_RIGHTS, HIBERNATE_MAPPING_ADATE, HIBERNATE_MAPPING_AUTHOR, HIBERNATE_MAPPING_CDATE, HIBERNATE_MAPPING_EDATE, HIBERNATE_MAPPING_MDATE, HIBERNATE_MAPPING_PDATE, HIBERNATE_MAPPING_PSTATUS, HIBERNATE_MAPPING_TITLE, HIBERNATE_MAPPING_WORKFLOW_ID, HIBERNATE_MAPPING_WORKSPACE_ID, MDATE_FIELD, PSTATUS_FIELD, ROW_ID_FIELD, SCROLL_FETCH_SIZE, WORKFLOW_ID_FIELD, WORKSPACE_ID_FIELD
 
Method Summary
 boolean canRequestLock(Data data, Member mbr)
          Returns true if the given member can request the lock (by mail).
 boolean checkLockMember(Data data, Member mbr)
          Returns true if the given member has locked the given data or if the data is not locked.
static StrongLockManager getInstance()
           
<T extends Data>
Set<T>
getLockedDataSet(Class<T> clazz)
          Returns all the locked data for the given class.
<T extends Data>
Set<T>
getLockedDataSet(Class<T> clazz, boolean useCache)
          Returns all the locked data for the given class.
 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)
 StrongLock getStrongLock(Data data)
          Returns the StrongLock bound to given data.
 StrongLock getStrongLock(Data data, boolean useCache)
          Returns the StrongLock bound to given data.
 boolean isLocked(Data data)
          Returns true if the given data is locked.
 void lock(Data data, Member mbr)
          Lock the given data for the given member.
 void onPostDelete(DBData data, org.hibernate.event.PostDeleteEvent event, boolean firstTime)
           
 void onPostInsert(DBData data, org.hibernate.event.PostInsertEvent event, boolean firstTime)
           
 void onPostUpdate(DBData data, org.hibernate.event.PostUpdateEvent event, boolean firstTime)
           
 void refreshCacheEntry(Data data)
          Invalidate the cache entries for the given publication
 void resetCache()
          Reset the cache.
 void unlock(Data data)
          Unlock the given data, without checking the member.
 void unlock(Data data, Member mbr)
          Unlock the given data
 void unlock(Data data, Member mbr, boolean force)
          Unlock the given data
 
Methods inherited from class com.jalios.jcms.db.BasicDBListener
getAdateFromState, getAuthorIdFromState, getCdateFromState, getEdateFromState, getMdateFromState, getPdateFromState, getPrePstatus, getPrePstatus, getPstatusFromState, hasNoChange, hasNoChange, init, onPreUpdate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

CACHE_ENABLED_PROP

public static final String CACHE_ENABLED_PROP
See Also:
Constant Field Values

CACHE_MAX_ENTRIES_PROP

public static final String CACHE_MAX_ENTRIES_PROP
See Also:
Constant Field Values

DATA_ID_FIELD

public static final String DATA_ID_FIELD
See Also:
Constant Field Values
Method Detail

getInstance

public static StrongLockManager getInstance()

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.

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.

Parameters:
clazz - the class
useCache - use the cache if true
Returns:
all the locked data for the given class.
Since:
jcms-6.2.0

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

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

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

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

canRequestLock

public boolean canRequestLock(Data data,
                              Member mbr)
Returns true if the given member can request the lock (by mail).

Parameters:
data - the data
mbr - the member who request the lock
Returns:
true if the given member can request the lock (by mail).
Since:
jcms-6.2.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)
Specified by:
onPostInsert in interface DBListener
Overrides:
onPostInsert in class BasicDBListener
See Also:
DBListener.onPostInsert(DBData, PostInsertEvent, boolean)

onPostUpdate

public void onPostUpdate(DBData data,
                         org.hibernate.event.PostUpdateEvent event,
                         boolean firstTime)
Specified by:
onPostUpdate in interface DBListener
Overrides:
onPostUpdate in class BasicDBListener
See Also:
DBListener.onPostUpdate(DBData, PostUpdateEvent, boolean)

onPostDelete

public void onPostDelete(DBData data,
                         org.hibernate.event.PostDeleteEvent event,
                         boolean firstTime)
Specified by:
onPostDelete in interface DBListener
Overrides:
onPostDelete in class BasicDBListener
See Also:
DBListener.onPostDelete(DBData, PostDeleteEvent, boolean)


Copyright © 2001-2010 Jalios SA. All Rights Reserved.