public class DBLogicalLock extends DBObject
+--------------------------------+
| SDBDataEntryScreen |
+--------------------------------+
| lockType -> DBLogicalLockType |
| lockReasonId -> DBMessage |
+--------------------------------+
DBObject.DenormalizeAction| Modifier and Type | Field and Description |
|---|---|
static GlobalId |
DBCLASS_GID
Provides a mechanism of for allowing a record or set of records to be
"locked" when a user begins to work on them.
|
static java.lang.String |
DBCLASS_NAME
Provides a mechanism of for allowing a record or set of records to be
"locked" when a user begins to work on them.
|
static java.lang.String |
PARAM_IGNORE_TIMEOUT
Should the isValid field/method ignore the timeout
|
ATTRIBUTE_MARVIN, dbClass, ds, NO_LOOP_PARAMS| Constructor and Description |
|---|
DBLogicalLock(DBClass def,
DataSource dataSource)
Std.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canReleaseLock(Login login)
Determines if the current user has the rights to release this lock
|
static DBLogicalLock |
create(MutableDataSource mds)
Make a new instance of this class.
|
void |
eventFieldUpdated(DBField field,
java.lang.Object previous,
GlobalKey previousKey,
FldParams params)
Additional business logic when a field is updated.
|
protected void |
extFixUp()
The extended fix up routine for known problems.
|
protected java.lang.Object |
extGetDerivedValue(DBField field,
FldParams params)
Calculate the derived value for this field.
|
protected void |
extPreValidate()
clear the locks
|
static DBLogicalLock |
findKey(DataSource ds,
int key)
Find the target for this class by the primary key
|
DBLogicalLockGroup |
findLockGroup(java.lang.String... args)
Group that this lock is part of.
|
Person |
findPerson(java.lang.String... args)
The person that has the lock.
|
DBMessage |
findReasonId(java.lang.String... args)
The reason that the lock was taken.
|
Session |
findSession(java.lang.String... args)
The session for which this lock was taken/valid for.
|
Person |
findStolenBy(java.lang.String... args)
The lock was stolen by this person.
|
DBLogicalLockType |
findType(java.lang.String... args)
A "stealable" lock will allow other users to steal the lock from another
user, a "non_stealable" lock will produce an error if another user tries
to lock the same record.
|
static DBLogicalLock |
getCurrentLock(java.lang.String key,
DataSource ds)
Retrieves the current lock for the supplied key
|
int |
getDepth(java.lang.String... args) |
java.lang.String |
getDisplayKey(java.lang.String... args) |
int |
getID(java.lang.String... args) |
java.lang.String |
getIdleDuration(java.lang.String... args) |
java.lang.String |
getLockedKey(java.lang.String... args) |
long |
getLockedTransactionNr(java.lang.String... args) |
DBLogicalLockGroup |
getLockGroup(java.lang.String... args) |
java.util.Date |
getOriginalTimeTaken(java.lang.String... args) |
Person |
getPerson(java.lang.String... args) |
DBMessage |
getReasonId(java.lang.String... args) |
java.lang.String |
getReleasedKey(java.lang.String... args) |
Session |
getSession(java.lang.String... args) |
Person |
getStolenBy(java.lang.String... args) |
java.util.Date |
getTimeout(java.lang.String... args) |
java.util.Date |
getTimeTaken(java.lang.String... args) |
DBLogicalLockType |
getType(java.lang.String... args) |
boolean |
hasTimedOut()
has the lock timed out ?
|
static boolean |
isLockedByAnother(java.lang.String key,
Login login)
Determines if there is already a lock but someone else has it
|
boolean |
isReleased(java.lang.String... args) |
protected boolean |
isValid(FldParams params)
is valid
|
static DBQuery<DBLogicalLock> |
makeQuery(DataSource ds)
Make a new QUERY for this class.
|
static DBLogicalLock[] |
obtain(java.lang.String[] key,
Session session,
GlobalKey currentLockKey,
MutableDataSource mds)
Creates a lock for a specified key
If a valid lock already exists then a DBLogicalLockException is thrown.
|
static DBLogicalLock |
obtain(java.lang.String key,
Login login,
GlobalKey currentLockKey,
java.lang.String duration,
Session session,
java.lang.String lockType,
MutableDataSource ds,
DBLogicalLockGroup grp)
Creates a lock for a specified key
If a valid lock already exists then a DBLogicalLockException is thrown.
|
static DBLogicalLock |
obtain(java.lang.String key,
Login login,
GlobalKey currentLockKey,
java.lang.String duration,
Session session,
java.lang.String lockType,
MutableDataSource ds,
DBLogicalLockGroup grp,
int depth)
Creates a lock for a specified key
If a valid lock already exists then a DBLogicalLockException is thrown.
|
static DBLogicalLock |
obtain(java.lang.String key,
Session session,
GlobalKey currentLockKey,
MutableDataSource mds,
DBLogicalLockGroup grp)
Obtains a lock for a session so that it is only valid for this session
The lock will default to being valid the default timeout duration
|
static void |
release(java.lang.String key,
Login login,
MutableDataSource ds)
Releases an existing lock.
|
DBLogicalLock |
setDepth(int value,
java.lang.String... args) |
DBLogicalLock |
setID(int value,
java.lang.String... args) |
DBLogicalLock |
setLockedKey(java.lang.String value,
java.lang.String... args) |
DBLogicalLock |
setLockedTransactionNr(long value,
java.lang.String... args) |
DBLogicalLock |
setLockGroup(com.aspc.dal.locks.DBLogicalLockGroup value,
java.lang.String... args) |
DBLogicalLock |
setOriginalTimeTaken(java.util.Date value,
java.lang.String... args) |
DBLogicalLock |
setPerson(com.aspc.dal.dbobj.contact.Person value,
java.lang.String... args) |
DBLogicalLock |
setReasonId(com.aspc.dal.message.DBMessage value,
java.lang.String... args) |
DBLogicalLock |
setReleased(boolean value,
java.lang.String... args) |
DBLogicalLock |
setReleasedKey(java.lang.String value,
java.lang.String... args) |
DBLogicalLock |
setSession(com.aspc.dal.dbobj.contact.Session value,
java.lang.String... args) |
DBLogicalLock |
setStolenBy(com.aspc.dal.dbobj.contact.Person value,
java.lang.String... args) |
DBLogicalLock |
setTimeout(java.util.Date value,
java.lang.String... args) |
DBLogicalLock |
setTimeTaken(java.util.Date value,
java.lang.String... args) |
DBLogicalLock |
setType(com.aspc.dal.locks.DBLogicalLockType value,
java.lang.String... args) |
static DBLogicalLock |
takeLock(java.lang.String key,
Login login,
GlobalKey currentLockKey,
java.lang.String duration,
Session session,
java.lang.String lockType,
DBLogicalLockGroup grp)
Creates a lock for a specified key
If a valid lock already exists then a DBLogicalLockException is thrown.
|
static DBLogicalLock |
takeLock(java.lang.String key,
Login login,
GlobalKey currentLockKey,
java.lang.String duration,
Session session,
java.lang.String lockType,
DBLogicalLockGroup grp,
int depth)
Creates a lock for a specified key
If a valid lock already exists then a DBLogicalLockException is thrown.
|
static DBLogicalLock[] |
takeLocks(java.lang.String[] key,
Session session,
GlobalKey currentLockKey)
Creates a lock for a specified key
If a valid lock already exists then a DBLogicalLockException is thrown.
|
static void |
update(java.lang.String key,
Session session,
GlobalKey currentLockKey,
long transId,
MutableDataSource ds)
Update the details of a lock.
|
addReloadEventListener, archiveCheck, autoEnterCreate, calculateValue, calculateValue, calculateValue, callingRestoreByJournal, changeThreadMode, checkCreateAccess, checkDelete, checkDeleteAccess, checkModifyAccess, checkModifyAccess, checkReadAccess, clearCache, copy, copyFields, copyIncludeField, copyInwardLinks, delete, denormalizedResult, displayLogName, displayName, displayValue, doSearch, dump, equals, eventDataLoaded, extAutoEnterCreate, extCanDeleteDependantObject, extCheckCreateAccess, extCheckDeleteAccess, extCheckModifyAccess, extCheckModifyAccess, extCheckReadAccess, extCopy, extDelete, extDeleteRecord, extGetDerivedGlobalKey, extGetValue, extIsMandatory, extIsOnChange, extMarkSavePoint, extPostDeleteRecord, extPostSaveRecord, extPreDeleteRecord, extPreSaveRecord, extPreValidateDelete, extRaiseEvents, extRollbackTo, extSaveRecord, extSetValue, extUndelete, extValidateDelete, extValidateField, extValidateRecord, fetchLinkHolder, findGlobalKey, findGlobalKey, findGlobalKey, findGlobalKey, findLinkedObject, findLinkedObject, findLinkedObject, findRawData, fireEventDataLoaded, fixUp, forceLockedTransaction, getBoolean, getBoolean, getBoolean, getBoolean, getBoolean, getBoolean, getChangedFieldInfo, getChangedFields, getDate, getDate, getDate, getDate, getDate, getDefaultValue, getDisableOnChangeEvent, getDouble, getDouble, getDouble, getDouble, getDouble, getFieldDouble, getFieldInt, getFieldLong, getFieldString, getFormattedString, getFormattedString, getGlobalKey, getGlobalKey, getGlobalKey, getGlobalKey, getGlobalKey, getInt, getInt, getInt, getInt, getInt, getInt, getInwardLinkage, getKeyString, getKeyValue, getLinkedObject, getLinkedObject, getLinkedObject, getLinkedObjectByKey, getLinkedRowId, getLinkedRowId, getLinkedRowIdByData, getLinkHolder, getLockedTransaction, getLong, getLong, getLong, getLong, getLong, getLong, getMutableArrayValue, getMutableArrayValue, getOriginalKey, getOriginalValue, getOriginalValue, getProcessedValue, getPureValue, getRawData, getRawValue, getRawValue, getRowId, getRowKey, getSecondaryCacheGroupKey, getSrcLayerID, getString, getString, getString, getString, getString, getString, getValue, getValue, getValue, getValue, hasAutoChanged, hasAutoChanged, hasChanged, hasChangedByUser, hasChangedByUserField, hasChangedByUserField, hasFieldChanged, hasFieldChanged, hashCode, hasStoredResult, iCheckDeleteAccess, iCheckModifyAccess, iCheckReadAccess, iGetDenormalizedMap, iGetRawValue, iPlaceDenormalizedResult, iPostSaveOrDeleteRecord, iPreSaveOrDeleteRecord, iPreValidate, iRaiseEvents, iSaveOrDeleteRecord, isBrokenLink, isBrokenLink, isChanged, isDataCacheKnownToBeDirty, isDeleted, isEmpty, iSetValue, isForceReindex, isKeyWordField, isMandatory, isNew, isNull, isNull, isOnChange, isReindex, iValidateRecord, lastTouched, makeArchiveDataLoader, makeClone, makeDataLoader, makeDenormalizedDoc, makeLinkedArray, makeModifyAccessException, makeSearchPlan, makeWriteProvider, manualDenormalizeOnSave, markSavePoint, optLockedTransaction, registerWatchedObject, reindex, releaseDenormalized, removeReloadEventListener, restoreByJournal, rollbackTo, setBoolean, setBoolean, setBoolean, setBoolean, setDisableOnChangeEvent, setDouble, setDouble, setInt, setInt, setLong, setLong, setRawData, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, toString, touch, undelete, validateField, validateRecord, validateSubTypepublic static final java.lang.String DBCLASS_NAME
public static final GlobalId DBCLASS_GID
public static final java.lang.String PARAM_IGNORE_TIMEOUT
public DBLogicalLock(DBClass def, DataSource dataSource) throws java.lang.Exception
def - The class of this objectdataSource - The datasource for this objectjava.lang.Exception - A serious problem occurred@CheckReturnValue public int getID(java.lang.String... args)
@Nonnull public DBLogicalLock setID(int value, java.lang.String... args) throws java.lang.Exception
java.lang.Exception@CheckReturnValue public int getDepth(java.lang.String... args)
@Nonnull public DBLogicalLock setDepth(int value, java.lang.String... args) throws java.lang.Exception
java.lang.Exception@CheckReturnValue @Nonnull public java.lang.String getDisplayKey(java.lang.String... args)
@CheckReturnValue @Nonnull public java.lang.String getIdleDuration(java.lang.String... args)
@CheckReturnValue @Nullable public DBLogicalLockGroup getLockGroup(java.lang.String... args)
@CheckReturnValue @Nonnull public final DBLogicalLockGroup findLockGroup(java.lang.String... args) throws NotFoundException
DBLogicalLockGroup
(Integer, Searchable)args - the optional argumentsNotFoundException - DBLogicalLockGroup was not found@Nonnull public DBLogicalLock setLockGroup(com.aspc.dal.locks.DBLogicalLockGroup value, java.lang.String... args) throws java.lang.Exception
java.lang.Exception@CheckReturnValue @Nonnull public java.lang.String getLockedKey(java.lang.String... args)
@Nonnull public DBLogicalLock setLockedKey(java.lang.String value, java.lang.String... args) throws java.lang.Exception
java.lang.Exception@CheckReturnValue public long getLockedTransactionNr(java.lang.String... args)
@Nonnull public DBLogicalLock setLockedTransactionNr(long value, java.lang.String... args) throws java.lang.Exception
java.lang.Exception@CheckReturnValue @Nullable public java.util.Date getOriginalTimeTaken(java.lang.String... args)
@Nonnull public DBLogicalLock setOriginalTimeTaken(java.util.Date value, java.lang.String... args) throws java.lang.Exception
java.lang.Exception@CheckReturnValue @Nullable public Person getPerson(java.lang.String... args)
@CheckReturnValue @Nonnull public final Person findPerson(java.lang.String... args) throws NotFoundException
Person (Integer,
Mandatory, Searchable)args - the optional argumentsNotFoundException - Person was not found@Nonnull public DBLogicalLock setPerson(com.aspc.dal.dbobj.contact.Person value, java.lang.String... args) throws java.lang.Exception
java.lang.Exception@CheckReturnValue @Nullable public DBMessage getReasonId(java.lang.String... args)
@CheckReturnValue @Nonnull public final DBMessage findReasonId(java.lang.String... args) throws NotFoundException
DBMessage (String,
Searchable)args - the optional argumentsNotFoundException - DBMessage was not found@Nonnull public DBLogicalLock setReasonId(com.aspc.dal.message.DBMessage value, java.lang.String... args) throws java.lang.Exception
java.lang.Exception@CheckReturnValue public boolean isReleased(java.lang.String... args)
@Nonnull public DBLogicalLock setReleased(boolean value, java.lang.String... args) throws java.lang.Exception
java.lang.Exception@CheckReturnValue @Nonnull public java.lang.String getReleasedKey(java.lang.String... args)
@Nonnull public DBLogicalLock setReleasedKey(java.lang.String value, java.lang.String... args) throws java.lang.Exception
java.lang.Exception@CheckReturnValue @Nullable public Session getSession(java.lang.String... args)
@CheckReturnValue @Nonnull public final Session findSession(java.lang.String... args) throws NotFoundException
Session (Integer,
Searchable)args - the optional argumentsNotFoundException - Session was not found@Nonnull public DBLogicalLock setSession(com.aspc.dal.dbobj.contact.Session value, java.lang.String... args) throws java.lang.Exception
java.lang.Exception@CheckReturnValue @Nullable public Person getStolenBy(java.lang.String... args)
@CheckReturnValue @Nonnull public final Person findStolenBy(java.lang.String... args) throws NotFoundException
Person (Integer,
Searchable)args - the optional argumentsNotFoundException - Person was not found@Nonnull public DBLogicalLock setStolenBy(com.aspc.dal.dbobj.contact.Person value, java.lang.String... args) throws java.lang.Exception
java.lang.Exception@CheckReturnValue @Nullable public java.util.Date getTimeTaken(java.lang.String... args)
@Nonnull public DBLogicalLock setTimeTaken(java.util.Date value, java.lang.String... args) throws java.lang.Exception
java.lang.Exception@CheckReturnValue @Nullable public java.util.Date getTimeout(java.lang.String... args)
@Nonnull public DBLogicalLock setTimeout(java.util.Date value, java.lang.String... args) throws java.lang.Exception
java.lang.Exception@CheckReturnValue @Nullable public DBLogicalLockType getType(java.lang.String... args)
@CheckReturnValue @Nonnull public final DBLogicalLockType findType(java.lang.String... args) throws NotFoundException
DBLogicalLockType
(String, Mandatory, Searchable)args - the optional argumentsNotFoundException - DBLogicalLockType was not found@Nonnull public DBLogicalLock setType(com.aspc.dal.locks.DBLogicalLockType value, java.lang.String... args) throws java.lang.Exception
java.lang.Exception@Nonnull @CheckReturnValue public static DBLogicalLock create(@Nonnull MutableDataSource mds) throws java.lang.Exception
mds - the datasourcejava.lang.Exception - an object of this class could not be created@Nonnull @CheckReturnValue public static DBQuery<DBLogicalLock> makeQuery(@Nonnull DataSource ds) throws NotFoundException
ds - the datasourceNotFoundException - if class could not be found@Nonnull @CheckReturnValue public static DBLogicalLock findKey(@Nonnull DataSource ds, int key) throws NotFoundException, java.lang.Exception
ds - the datasourcekey - the valueNotFoundException - if target could not be foundjava.lang.Exception - a serious problem@OverridingMethodsMustInvokeSuper
public void eventFieldUpdated(@Nonnull
DBField field,
@Nullable
java.lang.Object previous,
@Nullable
GlobalKey previousKey,
@Nullable
FldParams params)
throws java.lang.Exception
eventFieldUpdated in class DBObjectfield - The field updated.previous - The previous value for this field.previousKey - The previous keyparams - The parameters usedjava.lang.Exception - A serious problemDBObject.eventFieldUpdated( DBField, Object, GlobalKey, FldParams)public static DBLogicalLock getCurrentLock(java.lang.String key, DataSource ds) throws java.lang.Exception
key - - key of the object that lock is onds - - Datasource used to search for lock onjava.lang.Exception - - a serious errorpublic static boolean isLockedByAnother(java.lang.String key,
@Nonnull
Login login)
key - - key of the object that lock is onlogin - - login of userpublic static DBLogicalLock obtain(java.lang.String key, Session session, GlobalKey currentLockKey, MutableDataSource mds, DBLogicalLockGroup grp) throws DBLogicalLockException
mds - the data sourcegrp - the groupkey - - key of the object that lock is onsession - - session to apply lock tocurrentLockKey - - Existing key. This indicates that the user thinks that they already have the lockDBLogicalLockException - - the lock could not be obtainedpublic static DBLogicalLock takeLock(java.lang.String key, Login login, GlobalKey currentLockKey, java.lang.String duration, Session session, java.lang.String lockType, DBLogicalLockGroup grp) throws java.lang.Exception
grp - the groupsession - - session that user is logged intokey - - key of the object that lock is onlogin - - login of usercurrentLockKey - - Existing key. This indicates that the user thinks that they already have the lockduration - - duration that the lock is valid forlockType - - type of lock, i.e stealable or non-stealablejava.lang.Exception - a serious problempublic static DBLogicalLock takeLock(java.lang.String key, Login login, GlobalKey currentLockKey, java.lang.String duration, Session session, java.lang.String lockType, DBLogicalLockGroup grp, int depth) throws java.lang.Exception
grp - the groupsession - - session that user is logged intokey - - key of the object that lock is onlogin - - login of usercurrentLockKey - - Existing key. This indicates that the user thinks that they already have the lockduration - - duration that the lock is valid forlockType - - type of lock, i.e stealable or non-stealabledepth - - depth of lockjava.lang.Exception - a serious problempublic static DBLogicalLock obtain(java.lang.String key, Login login, GlobalKey currentLockKey, java.lang.String duration, Session session, java.lang.String lockType, MutableDataSource ds, DBLogicalLockGroup grp) throws DBLogicalLockException
ds - the data sourcegrp - the groupsession - - session that user is logged intokey - - key of the object that lock is onlogin - - login of usercurrentLockKey - - Existing key. This indicates that the user thinks that they already have the lockduration - - duration that the lock is valid forlockType - - type of lock, i.e stealable or non-stealableDBLogicalLockException - - the lock could not be obtainedpublic static DBLogicalLock obtain(java.lang.String key, Login login, GlobalKey currentLockKey, java.lang.String duration, Session session, java.lang.String lockType, MutableDataSource ds, DBLogicalLockGroup grp, int depth) throws DBLogicalLockException
ds - the data sourcegrp - the groupsession - - session that user is logged intokey - - key of the object that lock is onlogin - - login of usercurrentLockKey - - Existing key. This indicates that the user thinks that they already have the lockduration - - duration that the lock is valid forlockType - - type of lock, i.e stealable or non-stealabledepth - - depth of lockDBLogicalLockException - - the lock could not be obtainedpublic static DBLogicalLock[] takeLocks(java.lang.String[] key, Session session, GlobalKey currentLockKey) throws java.lang.Exception
key - - a set of keys of the object that locks are onsession - - session that user is logged intocurrentLockKey - - Existing key. This indicates that the user thinks that they already have the lockjava.lang.Exception - a serious problempublic static DBLogicalLock[] obtain(java.lang.String[] key, Session session, GlobalKey currentLockKey, MutableDataSource mds) throws DBLogicalLockException
key - - a set of keys of the object that locks are onsession - - session that user is logged intocurrentLockKey - - Existing key. This indicates that the user thinks that they already have the lockmds - - mutable datasourceDBLogicalLockException - - the lock could not be obtainedpublic static void release(java.lang.String key,
Login login,
MutableDataSource ds)
throws java.lang.Exception
ds - the datasourcekey - - key of the object that lock is onlogin - - login of userjava.lang.Exception - - a serious errorpublic boolean canReleaseLock(Login login)
login - Current login of userpublic static void update(java.lang.String key,
Session session,
GlobalKey currentLockKey,
long transId,
MutableDataSource ds)
throws DBLogicalLockException
ds - the datasourcesession - - session that user it currently logged intokey - - key of the object that lock is oncurrentLockKey - - Existing key. This indicates that the user thinks that they already have the locktransId - - current transaction id on last changes for base objectDBLogicalLockException - - a serious error@CheckReturnValue
protected java.lang.Object extGetDerivedValue(@Nonnull
DBField field,
@Nullable
FldParams params)
throws java.lang.Exception
extGetDerivedValue in class DBObjectfield - The field to getparams - The parameters for this field eg. language= or default=java.lang.Exception - A serious problemprotected boolean isValid(FldParams params) throws java.lang.Exception
params - the field parametersjava.lang.Exception - A serious problempublic boolean hasTimedOut()
@OverridingMethodsMustInvokeSuper
protected void extFixUp()
throws java.lang.Exception
@OverridingMethodsMustInvokeSuper
protected void extPreValidate()
throws java.lang.Exception
extPreValidate in class DBObjectjava.lang.Exception - a serious problem.stSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.