- java.lang.Object
-
- org.tentackle.dbms.AbstractDbObject<DbTokenLock>
-
- org.tentackle.persist.lock.DbTokenLock
-
- All Implemented Interfaces:
Serializable,Comparable<DbTokenLock>,ModificationLoggable,org.tentackle.misc.Identifiable,org.tentackle.misc.Immutable,org.tentackle.misc.SerialNumbered,TokenLock,org.tentackle.session.SessionDependable,org.tentackle.session.SessionProvider
@ClassId(10) @TableName("tokenlock") public class DbTokenLock extends AbstractDbObject<DbTokenLock> implements TokenLockTable holding the token locks.A TokenLock is an add-on to the editedBy/Since/Expiry-token in PDOs.
TokenLocks are maintained by the LockManager.
The ID of the TokenLock is the same as the PDO being locked.
The serial is not related to the PDO, starts at 1 and is incremented whenever lockedBy, lockedSince or lockExpiry changes.
Notice the [NOPKEY] to suppress the generation of the default primary key on id. Instead the index is unique on (id, pdoclassid). Thus, it is still allowed that objects of different classes share the same id.Notice, that this table is only used in servers, never in remote clients or simple 2-tier applications.
- Author:
- harald
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static DbObjectClassVariables<DbTokenLock>CLASSVARIABLESVariables common to all instances ofDbTokenLock.static StringCN_LOCKEDBYdatabase column name for 'lockedBy'.static StringCN_LOCKEDSINCEdatabase column name for 'lockedSince'.static StringCN_LOCKEXPIRYdatabase column name for 'lockExpiry'.static StringCN_PDOCLASSIDdatabase column name for 'pdoClassId'.-
Fields inherited from class org.tentackle.dbms.AbstractDbObject
AN_CLASSID, AN_ID, AN_SERIAL, AN_TABLESERIAL, CN_CLASSID, CN_ID, CN_SERIAL, CN_TABLESERIAL, TX_DELETE_LIST, TX_DELETE_MISSING_IN_LIST, TX_DELETE_OBJECT, TX_DUMMY_UPDATE, TX_INSERT_OBJECT, TX_INSERT_PLAIN, TX_SAVE, TX_SAVE_LIST, TX_SYNC, TX_UPDATE_OBJECT, TX_UPDATE_PLAIN, TX_UPDATE_SERIAL, TX_UPDATE_SERIAL_AND_TABLESERIAL, TX_UPDATE_TABLESERIAL
-
-
Constructor Summary
Constructors Constructor Description DbTokenLock()Creates an empty modification object.DbTokenLock(Db db)Creates an empty modification object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcreateInsertSql()StringcreateUpdateSql()DbObjectClassVariables<DbTokenLock>getClassVariables()voidgetFields(ResultSetWrapper rs)longgetLockedBy()Gets the attribute lockedBy.org.tentackle.common.TimestampgetLockedSince()Gets the attribute lockedSince.org.tentackle.common.TimestampgetLockExpiry()Gets the attribute lockExpiry.intgetPdoClassId()Gets the attribute pdoClassId.longgetPdoId()Gets the object id of locked PDO.intsetFields(PreparedStatementWrapper st)voidsetLockedBy(long lockedBy)Sets the attribute lockedBy.voidsetLockedSince(org.tentackle.common.Timestamp lockedSince)Sets the attribute lockedSince.voidsetLockExpiry(org.tentackle.common.Timestamp lockExpiry)Sets the attribute lockExpiry.voidsetPdoClassId(int pdoClassId)Sets the attribute pdoClassId.-
Methods inherited from class org.tentackle.dbms.AbstractDbObject
acceptPersistenceVisitor, addPropertyListener, addPropertyListener, alignComponents, assertMutable, assertNew, assertNotNew, assertNotOverloaded, assertNotRemote, assertNumberOfRowsAffected, assertPersistable, assertRemote, assertThisRowAffected, attributesModified, clearOnRemoteSave, compareTo, countModification, createAttributesInSnapshot, createDeleteAllSql, createDeleteSql, createDummyUpdateSql, createPreparedStatement, createPreparedStatement, createPropertySupport, createSelectAllByIdInnerSql, createSelectAllIdSerialInnerSql, createSelectAllInnerSql, createSelectExpiredTableSerials1Sql, createSelectExpiredTableSerials2Sql, createSelectIdInnerSql, createSelectMaxIdSql, createSelectMaxTableSerialSql, createSelectObjectsWithExpiredTableSerialsSql, createSelectSerialSql, createSelectSql, createSqlUpdate, createUpdateAndSetSerialSql, createUpdateSerialAndTableSerialSql, createUpdateSerialSql, deleteImpl, deleteObject, deletePlain, deleteReferencedRelations, deleteReferencingRelations, differsPersisted, dummyUpdate, equals, finishModification, finishNotUpdated, firePropertyChange, getBackend, getClassBaseName, getClassId, getColumnCount, getExpirationBacklog, getExpiredTableSerials, getId, getIdSource, getImmutableLoggingLevel, getModificationCount, getModificationLog, getPreparedStatement, getPreparedStatement, getPropertySupport, getRemoteDelegate, getSerial, getSession, getSessionHolder, getTableName, getTableSerial, hashCode, initModification, insertImpl, insertObject, insertPlain, isCopy, isCountingModification, isDeleted, isEntity, isFinallyImmutable, isForcedModified, isFromThisJVM, isIdValid, isImmutable, isLoggingModification, isModified, isNew, isOverloadable, isPersistable, isReferenced, isRemovable, isSessionImmutable, isStatementAlwaysPrepared, isTableSerialProvided, isTracked, isUpdateNecessary, isUpdatingSerialEvenIfNotModified, isVirgin, loadLazyReferences, logModification, markDeleted, newId, newInstance, newInstance, newInstance, persistObject, prepareDelete, prepareSave, prepareSetFields, readFromResultSetWrapper, reloadObject, reloadObjectForUpdate, removeAllPropertyListeners, removePropertyListener, removePropertyListener, reserveId, reserveId, resultAllIdSerial, resultAllObjects, resultObjectsWithExpiredTableSerials, revertAttributesToSnapshot, saveObject, saveReferencedRelations, saveReferencingRelations, selectAllIdSerial, selectAllObjects, selectExpiredTableSerials, selectExpiredTableSerials, selectMaxId, selectMaxTableSerial, selectNextObject, selectObject, selectObjectForUpdate, selectObjectsWithExpiredTableSerials, selectSerial, setClassId, setFinallyImmutable, setId, setImmutable, setImmutableLoggingLevel, setModificationLog, setModified, setOverloadable, setSerial, setSession, setSessionHolder, setSessionImmutable, setStatementAlwaysPrepared, setTableSerial, toGenericString, toIdString, toString, unmarkDeleted, updateImpl, updateObject, updatePlain, updateSerial, updateSerial, updateSerialAndTableSerial
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.tentackle.dbms.ModificationLoggable
createModificationLog
-
-
-
-
Field Detail
-
CLASSVARIABLES
public static final DbObjectClassVariables<DbTokenLock> CLASSVARIABLES
Variables common to all instances ofDbTokenLock.
-
CN_PDOCLASSID
public static final String CN_PDOCLASSID
database column name for 'pdoClassId'.- See Also:
- Constant Field Values
-
CN_LOCKEDBY
public static final String CN_LOCKEDBY
database column name for 'lockedBy'.- See Also:
- Constant Field Values
-
CN_LOCKEDSINCE
public static final String CN_LOCKEDSINCE
database column name for 'lockedSince'.- See Also:
- Constant Field Values
-
CN_LOCKEXPIRY
public static final String CN_LOCKEXPIRY
database column name for 'lockExpiry'.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DbTokenLock
public DbTokenLock(Db db)
Creates an empty modification object.- Parameters:
db- the database connection
-
DbTokenLock
public DbTokenLock()
Creates an empty modification object.
-
-
Method Detail
-
getClassVariables
public DbObjectClassVariables<DbTokenLock> getClassVariables()
- Overrides:
getClassVariablesin classAbstractDbObject<DbTokenLock>
-
getFields
public void getFields(ResultSetWrapper rs)
- Overrides:
getFieldsin classAbstractDbObject<DbTokenLock>
-
setFields
public int setFields(PreparedStatementWrapper st)
- Overrides:
setFieldsin classAbstractDbObject<DbTokenLock>
-
createInsertSql
public String createInsertSql()
- Overrides:
createInsertSqlin classAbstractDbObject<DbTokenLock>
-
createUpdateSql
public String createUpdateSql()
- Overrides:
createUpdateSqlin classAbstractDbObject<DbTokenLock>
-
getPdoClassId
public int getPdoClassId()
Gets the attribute pdoClassId.- Specified by:
getPdoClassIdin interfaceTokenLock- Returns:
- class ID of the PDO
-
setPdoClassId
public void setPdoClassId(int pdoClassId)
Sets the attribute pdoClassId.- Parameters:
pdoClassId- class ID of the PDO
-
getLockedBy
public long getLockedBy()
Gets the attribute lockedBy.- Specified by:
getLockedByin interfaceTokenLock- Returns:
- userId of token lock holder
-
setLockedBy
public void setLockedBy(long lockedBy)
Sets the attribute lockedBy.- Parameters:
lockedBy- userId of token lock holder
-
getLockedSince
public org.tentackle.common.Timestamp getLockedSince()
Gets the attribute lockedSince.- Specified by:
getLockedSincein interfaceTokenLock- Returns:
- time since token lock given to user
-
setLockedSince
public void setLockedSince(org.tentackle.common.Timestamp lockedSince)
Sets the attribute lockedSince.- Parameters:
lockedSince- time since token lock given to user
-
getLockExpiry
public org.tentackle.common.Timestamp getLockExpiry()
Gets the attribute lockExpiry.- Specified by:
getLockExpiryin interfaceTokenLock- Returns:
- time when token lock expires
-
setLockExpiry
public void setLockExpiry(org.tentackle.common.Timestamp lockExpiry)
Sets the attribute lockExpiry.- Parameters:
lockExpiry- time when token lock expires
-
-