Class 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 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
    • 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

      • 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