Class DbTokenLock

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<DbTokenLock>, org.tentackle.dbms.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 org.tentackle.dbms.AbstractDbObject<DbTokenLock>
    implements TokenLock
    Table 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 org.tentackle.dbms.DbObjectClassVariables<DbTokenLock> CLASSVARIABLES
      Variables common to all instances of DbTokenLock.
      static java.lang.String CN_LOCKEDBY
      database column name for 'lockedBy'.
      static java.lang.String CN_LOCKEDSINCE
      database column name for 'lockedSince'.
      static java.lang.String CN_LOCKEXPIRY
      database column name for 'lockExpiry'.
      static java.lang.String CN_PDOCLASSID
      database 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​(org.tentackle.dbms.Db db)
      Creates an empty modification object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String createInsertSql()  
      java.lang.String createUpdateSql()  
      org.tentackle.dbms.DbObjectClassVariables<DbTokenLock> getClassVariables()  
      void getFields​(org.tentackle.dbms.ResultSetWrapper rs)  
      long getLockedBy()
      Gets the attribute lockedBy.
      org.tentackle.common.Timestamp getLockedSince()
      Gets the attribute lockedSince.
      org.tentackle.common.Timestamp getLockExpiry()
      Gets the attribute lockExpiry.
      int getPdoClassId()
      Gets the attribute pdoClassId.
      long getPdoId()
      Gets the object id of locked PDO.
      int setFields​(org.tentackle.dbms.PreparedStatementWrapper st)  
      void setLockedBy​(long lockedBy)
      Sets the attribute lockedBy.
      void setLockedSince​(org.tentackle.common.Timestamp lockedSince)
      Sets the attribute lockedSince.
      void setLockExpiry​(org.tentackle.common.Timestamp lockExpiry)
      Sets the attribute lockExpiry.
      void setPdoClassId​(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 org.tentackle.dbms.DbObjectClassVariables<DbTokenLock> CLASSVARIABLES
        Variables common to all instances of DbTokenLock.
      • CN_PDOCLASSID

        public static final java.lang.String CN_PDOCLASSID
        database column name for 'pdoClassId'.
        See Also:
        Constant Field Values
      • CN_LOCKEDBY

        public static final java.lang.String CN_LOCKEDBY
        database column name for 'lockedBy'.
        See Also:
        Constant Field Values
      • CN_LOCKEDSINCE

        public static final java.lang.String CN_LOCKEDSINCE
        database column name for 'lockedSince'.
        See Also:
        Constant Field Values
      • CN_LOCKEXPIRY

        public static final java.lang.String CN_LOCKEXPIRY
        database column name for 'lockExpiry'.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DbTokenLock

        public DbTokenLock​(org.tentackle.dbms.Db db)
        Creates an empty modification object.
        Parameters:
        db - the database connection
      • DbTokenLock

        public DbTokenLock()
        Creates an empty modification object.
    • Method Detail

      • getClassVariables

        public org.tentackle.dbms.DbObjectClassVariables<DbTokenLock> getClassVariables()
        Overrides:
        getClassVariables in class org.tentackle.dbms.AbstractDbObject<DbTokenLock>
      • getFields

        public void getFields​(org.tentackle.dbms.ResultSetWrapper rs)
        Overrides:
        getFields in class org.tentackle.dbms.AbstractDbObject<DbTokenLock>
      • setFields

        public int setFields​(org.tentackle.dbms.PreparedStatementWrapper st)
        Overrides:
        setFields in class org.tentackle.dbms.AbstractDbObject<DbTokenLock>
      • createInsertSql

        public java.lang.String createInsertSql()
        Overrides:
        createInsertSql in class org.tentackle.dbms.AbstractDbObject<DbTokenLock>
      • createUpdateSql

        public java.lang.String createUpdateSql()
        Overrides:
        createUpdateSql in class org.tentackle.dbms.AbstractDbObject<DbTokenLock>
      • getPdoClassId

        public int getPdoClassId()
        Gets the attribute pdoClassId.
        Specified by:
        getPdoClassId in interface TokenLock
        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:
        getLockedBy in interface TokenLock
        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:
        getLockedSince in interface TokenLock
        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:
        getLockExpiry in interface TokenLock
        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
      • getPdoId

        public long getPdoId()
        Description copied from interface: TokenLock
        Gets the object id of locked PDO.
        Specified by:
        getPdoId in interface TokenLock
        Returns:
        the object id