Interface SequenceDAO

All Superinterfaces:
PersistentObjectDAO<Sequence>
All Known Implementing Classes:
HibernateSequenceDAO

public interface SequenceDAO extends PersistentObjectDAO<Sequence>
Utility DAO that can manage sequences persisted in the DB

Important: Implementations of this interface must grant synchronization.

Since:
4.0
Author:
Matteo Caruso - LogicalDOC
  • Method Details

    • next

      long next(String name, long objectId, long tenantId)
      Returns the next value of the sequence
      Parameters:
      name - name of the sequence
      objectId - The sequence object ID
      tenantId - ID of the owning tenant
      Returns:
      The next value
    • next

      long next(String name, long objectId, long tenantId, long increment)
      Returns the next value of the sequence by incrementing by the given increment
      Parameters:
      name - name of the sequence
      objectId - The sequence object ID
      tenantId - ID of the owning tenant
      increment - ID of the owning tenant
      Returns:
      The next value
    • reset

      void reset(String name, long objectId, long tenantId, long value)
      Initializes the sequence value
      Parameters:
      name - name of the sequence
      objectId - The sequence object ID
      tenantId - ID of the owning tenant
      value - The initial value
    • delete

      void delete(String name, long objectId, long tenantId) throws PersistenceException
      Deletes the sequence
      Parameters:
      name - name of the sequence
      objectId - value for the objectId field
      tenantId - identifier of the tenant
      Throws:
      PersistenceException - if a database error occurs
    • findByName

      List<Sequence> findByName(String name, long tenantId)
      Finds all sequences whose name starts with the passed name
      Parameters:
      name - name of the sequence
      tenantId - identifier of the tenant
      Returns:
      collection of sequences
    • findByAlternateKey

      Sequence findByAlternateKey(String name, long objectId, long tenantId)
      Finds the sequence by the given alternate key
      Parameters:
      name - name of the sequence
      objectId - value for the objectId field
      tenantId - identifier of the tenant
      Returns:
      the sequence object
    • getCurrentValue

      long getCurrentValue(String name, long objectId, long tenantId)
      Gets the current value
      Parameters:
      name - name of the sequence
      objectId - value for the objectId field
      tenantId - identifier of the tenant
      Returns:
      current value of the sequence