Interface RatingDAO

    • Method Detail

      • store

        boolean store​(Rating rating,
                      DocumentHistory transaction)
               throws PersistenceException
        Stores a rating and saves the document's history
        Parameters:
        rating - the rating
        transaction - session informations
        Returns:
        true id the rating has been correctly stored
        Throws:
        PersistenceException - raised in case of database errors
      • findVotesByDocId

        Rating findVotesByDocId​(long docId)
        Returns a rating that contains count and average of vote on the given document
        Parameters:
        docId - ID of the document
        Returns:
        the rating for the document
      • findByDocIdAndUserId

        Rating findByDocIdAndUserId​(long docId,
                                    long userId)
        Finds the rating for the given user id and the given document id
        Parameters:
        docId - ID of the document
        userId - ID of the user
        Returns:
        the vote of the given user on the document
      • findByDocId

        List<Rating> findByDocId​(long docId)
        Finds the ratings stored for the given document id
        Parameters:
        docId - ID of the document
        Returns:
        the list of ratings