Package com.logicaldoc.core.document.dao
Class HibernateRatingDAO
- java.lang.Object
-
- com.logicaldoc.core.HibernatePersistentObjectDAO<Rating>
-
- com.logicaldoc.core.document.dao.HibernateRatingDAO
-
- All Implemented Interfaces:
RatingDAO,PersistentObjectDAO<Rating>
public class HibernateRatingDAO extends HibernatePersistentObjectDAO<Rating> implements RatingDAO
Hibernate implementation ofRatingDAO- Since:
- 6.1
- Author:
- Matteo Caruso - LogicalDOC
-
-
Constructor Summary
Constructors Constructor Description HibernateRatingDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandelete(long id, int code)This method deletes an entity and you can give a deletion codeList<Rating>findByDocId(long docId)Finds the ratings stored for the given document idRatingfindByDocIdAndUserId(long docId, long userId)Finds the rating for the given user id and the given document idRatingfindVotesByDocId(long docId)Returns a rating that contains count and average of vote on the given documentbooleanstore(Rating rating, DocumentHistory transaction)Stores a rating and saves the document's history-
Methods inherited from class com.logicaldoc.core.HibernatePersistentObjectDAO
bulkUpdate, delete, deleteAll, deleteAll, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDbms, getSessionFactory, initialize, isOracle, jdbcUpdate, jdbcUpdate, query, queryForInt, queryForList, queryForList, queryForLong, queryForObject, queryForRowSet, queryForString, setSessionFactory, store
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.logicaldoc.core.PersistentObjectDAO
bulkUpdate, delete, deleteAll, deleteAll, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDbms, initialize, isOracle, jdbcUpdate, jdbcUpdate, query, queryForInt, queryForList, queryForList, queryForLong, queryForObject, queryForRowSet, queryForString, store
-
-
-
-
Method Detail
-
store
public boolean store(Rating rating, DocumentHistory transaction) throws PersistenceException
Description copied from interface:RatingDAOStores a rating and saves the document's history- Specified by:
storein interfaceRatingDAO- Parameters:
rating- the ratingtransaction- session informations- Returns:
- true id the rating has been correctly stored
- Throws:
PersistenceException- raised in case of database errors
-
findVotesByDocId
public Rating findVotesByDocId(long docId)
Description copied from interface:RatingDAOReturns a rating that contains count and average of vote on the given document- Specified by:
findVotesByDocIdin interfaceRatingDAO- Parameters:
docId- ID of the document- Returns:
- the rating for the document
-
findByDocIdAndUserId
public Rating findByDocIdAndUserId(long docId, long userId)
Description copied from interface:RatingDAOFinds the rating for the given user id and the given document id- Specified by:
findByDocIdAndUserIdin interfaceRatingDAO- Parameters:
docId- ID of the documentuserId- ID of the user- Returns:
- the vote of the given user on the document
-
findByDocId
public List<Rating> findByDocId(long docId)
Description copied from interface:RatingDAOFinds the ratings stored for the given document id- Specified by:
findByDocIdin interfaceRatingDAO- Parameters:
docId- ID of the document- Returns:
- the list of ratings
-
delete
public boolean delete(long id, int code) throws PersistenceExceptionDescription copied from interface:PersistentObjectDAOThis method deletes an entity and you can give a deletion code- Specified by:
deletein interfacePersistentObjectDAO<Rating>- Overrides:
deletein classHibernatePersistentObjectDAO<Rating>- Parameters:
id- ID of the entity which should be deletedcode- Deletion code- Returns:
- if the record has been successfully deleted
- Throws:
PersistenceException- raised in case of errors in the database
-
-