Interface ReadingRequestDAO

All Superinterfaces:
com.logicaldoc.core.PersistentObjectDAO<ReadingRequest>
All Known Implementing Classes:
HibernateReadingRequestDAO

public interface ReadingRequestDAO extends com.logicaldoc.core.PersistentObjectDAO<ReadingRequest>
DAO service for the readings
Since:
8.8.6
Author:
Matteo Caruso - LogicalDOC
  • Field Summary

    Fields inherited from interface com.logicaldoc.core.PersistentObjectDAO

    ENTITY
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    This method deletes all the reading requests older than the given days from now.
    confirmReading(long readingId, String version, com.logicaldoc.core.document.DocumentHistory transaction)
    Updates the document's rating with the votes average
    long
    Counts the number of unconfirmed readings
    findByAlternateKey(long docId, long userId, long requestorId, String fileVersion)
    Finds the readings for the alternate key: docId + userId + requestorId + fileVersion
    findByDocId(long docId)
    Finds the readings stored for the given document id
    findByDocIdAndFileVersion(long docId, String fileVersion)
    Finds the readings for the given fileVersion and the given document id
    findByDocIdAndUserId(long docId, long userId)
    Finds the readings for the given user id and the given document id
    findLastUnconfirmed(long docId, long userId)
    Finds the last unconfirmed reading for the given user id and the given document id
    Finds all the unconfirmed readings of a user document id
    void
    notifyReadingRequests(Collection<ReadingRequest> readings, com.logicaldoc.core.document.DocumentHistory transaction)
    Notifies the reading confirmation requests.
    void
    store(ReadingRequest reading, com.logicaldoc.core.document.DocumentHistory transaction)
    Stores a reading and saves the document's history

    Methods inherited from interface com.logicaldoc.core.PersistentObjectDAO

    bulkUpdate, delete, delete, deleteAll, deleteAll, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, initialize, isOracle, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForRowSet, queryForRowSet, queryForString, store
  • Method Details

    • store

      void store(ReadingRequest reading, com.logicaldoc.core.document.DocumentHistory transaction) throws com.logicaldoc.core.PersistenceException
      Stores a reading and saves the document's history
      Parameters:
      reading - the rating
      transaction - session informations
      Throws:
      com.logicaldoc.core.PersistenceException - error at data layer
    • notifyReadingRequests

      void notifyReadingRequests(Collection<ReadingRequest> readings, com.logicaldoc.core.document.DocumentHistory transaction) throws com.logicaldoc.core.PersistenceException, javax.mail.MessagingException
      Notifies the reading confirmation requests. Important: the requestor must be the same for all and is specified in the transaction.
      Parameters:
      readings - the reading requests to notify
      transaction - current session
      Throws:
      com.logicaldoc.core.PersistenceException - error at data layer
      javax.mail.MessagingException - Error in the sending of email
    • confirmReading

      ReadingRequest confirmReading(long readingId, String version, com.logicaldoc.core.document.DocumentHistory transaction) throws com.logicaldoc.core.PersistenceException
      Updates the document's rating with the votes average
      Parameters:
      readingId - Identifier of the reading to confirm
      version - The version to confirm the reading
      transaction - session informations
      Returns:
      the new / existing reading
      Throws:
      com.logicaldoc.core.PersistenceException - raised in case of database error
    • findByDocIdAndUserId

      List<ReadingRequest> findByDocIdAndUserId(long docId, long userId) throws com.logicaldoc.core.PersistenceException
      Finds the readings for the given user id and the given document id
      Parameters:
      docId - ID of the document
      userId - ID of the user
      Returns:
      the readings of the given user on the document ordered by creation date desc
      Throws:
      com.logicaldoc.core.PersistenceException - raised in case of database error
    • findLastUnconfirmed

      ReadingRequest findLastUnconfirmed(long docId, long userId) throws com.logicaldoc.core.PersistenceException
      Finds the last unconfirmed reading for the given user id and the given document id
      Parameters:
      docId - ID of the document
      userId - ID of the user
      Returns:
      the last unconfirmed reading
      Throws:
      com.logicaldoc.core.PersistenceException - raised in case of database error
    • findUnconfirmedByUserId

      List<ReadingRequest> findUnconfirmedByUserId(long userId) throws com.logicaldoc.core.PersistenceException
      Finds all the unconfirmed readings of a user document id
      Parameters:
      userId - ID of the user
      Returns:
      the list of unconfirmed readings orderd by creation asc
      Throws:
      com.logicaldoc.core.PersistenceException - raised in case of database error
    • findByDocIdAndFileVersion

      List<ReadingRequest> findByDocIdAndFileVersion(long docId, String fileVersion) throws com.logicaldoc.core.PersistenceException
      Finds the readings for the given fileVersion and the given document id
      Parameters:
      docId - ID of the document
      fileVersion - version of the file
      Returns:
      the vote of the given user on the document
      Throws:
      com.logicaldoc.core.PersistenceException - raised in case of database error
    • findByAlternateKey

      ReadingRequest findByAlternateKey(long docId, long userId, long requestorId, String fileVersion) throws com.logicaldoc.core.PersistenceException
      Finds the readings for the alternate key: docId + userId + requestorId + fileVersion
      Parameters:
      docId - ID of the document
      userId - identifier of the recipient user
      requestorId - identifier of the requestor user
      fileVersion - version of the file
      Returns:
      the readings of the user on the specified version
      Throws:
      com.logicaldoc.core.PersistenceException - raised in case of database error
    • findByDocId

      List<ReadingRequest> findByDocId(long docId) throws com.logicaldoc.core.PersistenceException
      Finds the readings stored for the given document id
      Parameters:
      docId - ID of the document
      Returns:
      the list of ratings
      Throws:
      com.logicaldoc.core.PersistenceException - raised in case of database error
    • countUnconfirmedReadings

      long countUnconfirmedReadings(long userId) throws com.logicaldoc.core.PersistenceException
      Counts the number of unconfirmed readings
      Parameters:
      userId - Identifier of the document
      Returns:
      the total unconfirmed readings
      Throws:
      com.logicaldoc.core.PersistenceException - raised in case of database error
    • cleanOldRequests

      void cleanOldRequests(int ttl) throws com.logicaldoc.core.PersistenceException
      This method deletes all the reading requests older than the given days from now. If ttl is 0 or -1, the deletion is not made.
      Parameters:
      ttl - The maximum number of days over which the history is considered old
      Throws:
      com.logicaldoc.core.PersistenceException - raised in case of database error