@ThreadSafe public final class ObjectLockManager extends com.helger.commons.scopes.singleton.GlobalSingleton implements ILockManager<String>
ILockManager.| Constructor and Description |
|---|
ObjectLockManager()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
Set<String> |
getAllLockedObjects() |
Set<String> |
getAllLockedObjectsOfCurrentUser() |
Set<String> |
getAllLockedObjectsOfUser(String sUserID) |
Map<String,ILockInfo> |
getAllLockInfos() |
DefaultLockManager<String> |
getDefaultLockMgr() |
static ObjectLockManager |
getInstance() |
static ObjectLockManager |
getInstanceIfInstantiated() |
org.joda.time.DateTime |
getLockDateTime(String sObjID)
Get the date and time when the given object was locked.
|
ILockInfo |
getLockInfo(String sObjID)
Get the lock information of the given object.
|
String |
getLockUserID(String sObjID)
Get the user ID who locked the given object.
|
boolean |
isObjectLockedByAnyUser(String sObjID)
Check if the object with the given ID is locked by any user.
|
boolean |
isObjectLockedByCurrentUser(String sObjID)
Check if the object with the given ID is locked by the current user.
|
boolean |
isObjectLockedByOtherUser(String sObjID)
Check if the object with the given ID is locked by any but the current
user.
|
ELocked |
lockObject(String sObjID)
Lock the object with the given ID.
|
ELocked |
lockObject(String sObjID,
String sUserID)
Lock the object with the given ID.
|
LockResult<String> |
lockObjectAndUnlockAllOthers(String sObjID)
Lock the object with the given ID and unlock all other objects.
|
LockResult<String> |
lockObjectAndUnlockAllOthers(String sObjID,
String sUserID)
Lock the object with the given ID and unlock all other objects.
|
String |
toString() |
List<String> |
unlockAllObjectsOfCurrentUser()
Unlock all objects of the current user.
|
List<String> |
unlockAllObjectsOfCurrentUserExcept(Set<String> aObjectsToKeepLocked)
Unlock all objects of the current user except for the passed objects.
|
List<String> |
unlockAllObjectsOfUser(String sUserID)
Unlock all objects of the passed user.
|
List<String> |
unlockAllObjectsOfUserExcept(String sUserID,
Set<String> aObjectsToKeepLocked)
Unlock all objects of the passed user except for the passed objects.
|
com.helger.commons.state.EChange |
unlockObject(String sObjID)
Unlock the object with the given ID.
|
com.helger.commons.state.EChange |
unlockObject(String sUserID,
String sObjID)
Manually unlock a special object locked by a special user.
|
getAllGlobalSingletons, getGlobalSingleton, getGlobalSingletonIfInstantiated, isGlobalSingletonInstantiatedgetAllSingletons, getSingleton, getSingletonIfInstantiated, getSingletonScopeKey, isDestroyed, isInDestruction, isInInstantiation, isInstantiated, isSingletonInstantiated, isUsableObject, onAfterInstantiation, onDestroy, onScopeDestruction, readAbstractSingletonFields, setDestroyed, setInDestruction, setInInstantiation, setInstantiated, writeAbstractSingletonFields@Deprecated @UsedViaReflection public ObjectLockManager()
@Nonnull public static ObjectLockManager getInstance()
@Nullable public static ObjectLockManager getInstanceIfInstantiated()
@Nonnull public DefaultLockManager<String> getDefaultLockMgr()
@Nullable public ILockInfo getLockInfo(@Nullable String sObjID)
ILockManagergetLockInfo in interface ILockManager<String>sObjID - The object to query for lock owner.null if the object is not locked, the lock information
otherwise@Nullable public String getLockUserID(@Nullable String sObjID)
ILockManagergetLockUserID in interface ILockManager<String>sObjID - The object to query for lock owner.null if the object is not locked, the user ID
otherwise@Nullable public org.joda.time.DateTime getLockDateTime(@Nullable String sObjID)
ILockManagergetLockDateTime in interface ILockManager<String>sObjID - The object to query for lock owner.null if the object is not locked, the locking date
time otherwise@Nonnull public ELocked lockObject(@Nonnull String sObjID)
ILockManagerlockObject in interface ILockManager<String>sObjID - The object ID to lock. May not be null.ELocked.LOCKED if the object is locked by the current user
after the call to this method, ELocked.NOT_LOCKED if the
object was already locked by another user.@Nonnull public ELocked lockObject(@Nonnull String sObjID, @Nullable String sUserID)
ILockManagerlockObject in interface ILockManager<String>sObjID - The object ID to lock. May not be null.sUserID - The id of the user who locked the object. May be null.ELocked.LOCKED if the object is locked by the specified
user after the call to this method, ELocked.NOT_LOCKED if
the object was already locked by another user or no user ID was
provided.@Nonnull public LockResult<String> lockObjectAndUnlockAllOthers(@Nonnull String sObjID)
ILockManagerlockObjectAndUnlockAllOthers in interface ILockManager<String>sObjID - The object ID to lock. May not be null.null. If
ILockedIndicator.isLocked() is true, the
object is locked by the current user after the call to this method.
If ILockedIndicator.isNotLocked() is true the
object was already locked by another user.@Nonnull public LockResult<String> lockObjectAndUnlockAllOthers(@Nonnull String sObjID, @Nullable String sUserID)
ILockManagerlockObjectAndUnlockAllOthers in interface ILockManager<String>sObjID - The object ID to lock. May not be null.sUserID - The id of the user who locked the object. May be null.ELocked.LOCKED if the object is locked by the specified
user after the call to this method, ELocked.NOT_LOCKED if
the object was already locked by another user or no user ID was
provided.@Nonnull public com.helger.commons.state.EChange unlockObject(@Nonnull String sObjID)
ILockManagerunlockObject in interface ILockManager<String>sObjID - The object ID to unlock.true if the object was successfully unlocked,
false if either the object is not locked or the object
is locked by another user than the current session user.@Nonnull public com.helger.commons.state.EChange unlockObject(@Nonnull String sUserID, @Nonnull String sObjID)
ILockManagerunlockObject in interface ILockManager<String>sUserID - The user who locked the object.sObjID - The object to be unlocked.true if unlocking succeeded, false
otherwise.@Nonnull @ReturnsMutableCopy public List<String> unlockAllObjectsOfCurrentUser()
ILockManagerunlockAllObjectsOfCurrentUser in interface ILockManager<String>null.@Nonnull @ReturnsMutableCopy public List<String> unlockAllObjectsOfCurrentUserExcept(@Nullable Set<String> aObjectsToKeepLocked)
ILockManagerunlockAllObjectsOfCurrentUserExcept in interface ILockManager<String>aObjectsToKeepLocked - An optional set of objects which should not be unlocked. May be
null or empty.null.@Nonnull @ReturnsMutableCopy public List<String> unlockAllObjectsOfUser(@Nullable String sUserID)
ILockManagerunlockAllObjectsOfUser in interface ILockManager<String>sUserID - The user ID who's object are to be unlocked. May be
null or empty.null.@Nonnull @ReturnsMutableCopy public List<String> unlockAllObjectsOfUserExcept(@Nullable String sUserID, @Nullable Set<String> aObjectsToKeepLocked)
ILockManagerunlockAllObjectsOfUserExcept in interface ILockManager<String>sUserID - The user ID who's object are to be unlocked. May be
null or empty.aObjectsToKeepLocked - An optional set of objects which should not be unlocked. May be
null or empty.null.public boolean isObjectLockedByCurrentUser(@Nullable String sObjID)
ILockManagerisObjectLockedByCurrentUser in interface ILockManager<String>sObjID - The object ID to check.true if the object is locked by the current user,
false if the object is either not locked or locked by
another user.public boolean isObjectLockedByOtherUser(@Nullable String sObjID)
ILockManagerisObjectLockedByOtherUser in interface ILockManager<String>sObjID - The object ID to check.true if the object is locked by any user that is not
the currently logged in user, false if the object is
either not locked or locked by the current user.public boolean isObjectLockedByAnyUser(@Nullable String sObjID)
ILockManagerisObjectLockedByAnyUser in interface ILockManager<String>sObjID - The object ID to check.true if the object is locked by any user,
false if the object is not locked.@Nonnull @ReturnsMutableCopy public Set<String> getAllLockedObjects()
getAllLockedObjects in interface ILockManager<String>null set of all locked objects of all users.
Never null but maybe empty.@Nonnull @ReturnsMutableCopy public Map<String,ILockInfo> getAllLockInfos()
getAllLockInfos in interface ILockManager<String>null map of all locked objects of all users.
Never null but maybe empty.@Nonnull @ReturnsMutableCopy public Set<String> getAllLockedObjectsOfCurrentUser()
getAllLockedObjectsOfCurrentUser in interface ILockManager<String>null set of all locked objects of the current
user. Never null but maybe empty.@Nonnull @ReturnsMutableCopy public Set<String> getAllLockedObjectsOfUser(@Nullable String sUserID)
getAllLockedObjectsOfUser in interface ILockManager<String>sUserID - The user ID to be queried for all locked objects. May be
null.null set of all locked objects of the passed
user. Never null but maybe empty.public String toString()
toString in class com.helger.commons.scopes.AbstractSingletonCopyright © 2014–2015 Philip Helger. All rights reserved.