Package com.logicaldoc.core.document
Class HibernateRatingDAO
java.lang.Object
com.logicaldoc.core.HibernatePersistentObjectDAO<Rating>
com.logicaldoc.core.document.HibernateRatingDAO
- All Implemented Interfaces:
- RatingDAO,- PersistentObjectDAO<Rating>
@Repository("ratingDAO")
public class HibernateRatingDAO
extends HibernatePersistentObjectDAO<Rating>
implements RatingDAO
Hibernate implementation of 
RatingDAO- Since:
- 6.1
- Author:
- Matteo Caruso - LogicalDOC
- 
Field SummaryFields inherited from interface com.logicaldoc.core.PersistentObjectDAOENTITY
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoiddelete(long id, int code) This method deletes an entity and you can give a deletion codefindByDocId(long docId) Finds the ratings stored for the given document idfindByDocIdAndUserId(long docId, long userId) Finds the rating for the given user id and the given document idfindVotesByDocId(long docId) Returns a rating that contains count and average of vote on the given documentvoidstore(Rating rating, DocumentHistory transaction) Stores a rating and saves the document's historyintupdateDocumentRating(long docId, DocumentHistory transaction) Updates the document's rating with the votes averageMethods inherited from class com.logicaldoc.core.HibernatePersistentObjectDAObulkUpdate, delete, deleteAll, deleteAll, evict, evict, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, initialize, isMySQL, isOracle, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForObject, queryForResultSet, queryForString, queryForString, setSessionFactory, storeMethods inherited from class java.lang.Objectequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.logicaldoc.core.PersistentObjectDAObulkUpdate, delete, deleteAll, deleteAll, evict, evict, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, initialize, isMySQL, isOracle, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForObject, queryForResultSet, queryForString, queryForString, store
- 
Constructor Details- 
HibernateRatingDAOpublic HibernateRatingDAO()
 
- 
- 
Method Details- 
storeDescription copied from interface:RatingDAOStores a rating and saves the document's history- Specified by:
- storein interface- RatingDAO
- Parameters:
- rating- the rating
- transaction- session informations
- Throws:
- PersistenceException- error at data layer
 
- 
updateDocumentRatingpublic int updateDocumentRating(long docId, DocumentHistory transaction) throws PersistenceException Description copied from interface:RatingDAOUpdates the document's rating with the votes average- Specified by:
- updateDocumentRatingin interface- RatingDAO
- Parameters:
- docId- Identifier of the document
- transaction- session informations
- Returns:
- the new rating
- Throws:
- PersistenceException- raised in case of database error
 
- 
findVotesByDocIdDescription copied from interface:RatingDAOReturns a rating that contains count and average of vote on the given document- Specified by:
- findVotesByDocIdin interface- RatingDAO
- Parameters:
- docId- ID of the document
- Returns:
- the rating for the document
- Throws:
- PersistenceException- Error in the database
 
- 
findByDocIdAndUserIdDescription copied from interface:RatingDAOFinds the rating for the given user id and the given document id- Specified by:
- findByDocIdAndUserIdin interface- RatingDAO
- Parameters:
- docId- ID of the document
- userId- ID of the user
- Returns:
- the vote of the given user on the document
- Throws:
- PersistenceException- Error in the database
 
- 
findByDocIdDescription copied from interface:RatingDAOFinds the ratings stored for the given document id- Specified by:
- findByDocIdin interface- RatingDAO
- Parameters:
- docId- ID of the document
- Returns:
- the list of ratings
- Throws:
- PersistenceException- Error in the database
 
- 
deleteDescription copied from interface:PersistentObjectDAOThis method deletes an entity and you can give a deletion code- Specified by:
- deletein interface- PersistentObjectDAO<Rating>
- Overrides:
- deletein class- HibernatePersistentObjectDAO<Rating>
- Parameters:
- id- ID of the entity which should be deleted
- code- Deletion code
- Throws:
- PersistenceException- raised in case of errors in the database
 
 
-