Package com.logicaldoc.core.document.dao
Interface RatingDAO
-
- All Superinterfaces:
PersistentObjectDAO<Rating>
- All Known Implementing Classes:
HibernateRatingDAO
public interface RatingDAO extends PersistentObjectDAO<Rating>
DAO service for ratings- Since:
- 6.1
- Author:
- Matteo Caruso - LogicalDOC
-
-
Field Summary
-
Fields inherited from interface com.logicaldoc.core.PersistentObjectDAO
ENTITY
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description List<Rating>
findByDocId(long docId)
Finds the ratings stored for the given document idRating
findByDocIdAndUserId(long docId, long userId)
Finds the rating for the given user id and the given document idRating
findVotesByDocId(long docId)
Returns a rating that contains count and average of vote on the given documentvoid
store(Rating rating, DocumentHistory transaction)
Stores a rating and saves the document's historyint
updateDocumentRating(long docId, DocumentHistory transaction)
Updates the document's rating with the votes average-
Methods inherited from interface com.logicaldoc.core.PersistentObjectDAO
bulkUpdate, bulkUpdate, delete, delete, deleteAll, deleteAll, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByObjectQuery, findByQuery, findByQuery, findByWhere, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDbms, initialize, isOracle, jdbcUpdate, jdbcUpdate, query, queryForInt, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForRowSet, queryForString, store
-
-
-
-
Method Detail
-
store
void store(Rating rating, DocumentHistory transaction) throws PersistenceException
Stores a rating and saves the document's history- Parameters:
rating
- the ratingtransaction
- session informations- Throws:
PersistenceException
- error at data layer
-
updateDocumentRating
int updateDocumentRating(long docId, DocumentHistory transaction) throws PersistenceException
Updates the document's rating with the votes average- Parameters:
docId
- Identifier of the documenttransaction
- session informations- Returns:
- the new rating
- Throws:
PersistenceException
- raised in case of database error
-
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 documentuserId
- ID of the user- Returns:
- the vote of the given user on the document
-
-