Package com.logicaldoc.core.document.dao
Class HibernateDocumentHistoryDAO
- java.lang.Object
-
- com.logicaldoc.core.HibernatePersistentObjectDAO<DocumentHistory>
-
- com.logicaldoc.core.document.dao.HibernateDocumentHistoryDAO
-
- All Implemented Interfaces:
DocumentHistoryDAO,PersistentObjectDAO<DocumentHistory>
public class HibernateDocumentHistoryDAO extends HibernatePersistentObjectDAO<DocumentHistory> implements DocumentHistoryDAO
Hibernate implementation ofHistoryDAO- Since:
- 3.0
- Author:
- Alessandro Gasparini - LogicalDOC
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanOldHistories(int ttl)This method deletes all the document history entries oldest than the given days from now.List<DocumentHistory>findByDocId(long docId)This method selects all histories of a given document.List<DocumentHistory>findByDocIdAndEvent(long docId, String event)This method selects all histories of a given document.List<DocumentHistory>findByFolderId(long folderId)This method selects all histories of a given folder.List<DocumentHistory>findByPath(String pathExpression, Date olderDate, Collection<String> events, Integer max)This method finds all histories about a path (you can use expression)List<DocumentHistory>findByUserId(long userId)This method selects all histories of a given user.List<DocumentHistory>findByUserIdAndEvent(long userId, String event, String sessionId)This method selects all histories of a given user and related to the given event.List<DocumentHistory>findNotNotified(Integer max)This method selects all histories not notified yet.voidmarkHistoriesAsRead(String event, long userId)Marks all the histories of a specific event as read by the specified user.booleanstore(DocumentHistory history)This method persists the entity object-
Methods inherited from class com.logicaldoc.core.HibernatePersistentObjectDAO
bulkUpdate, delete, 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
-
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, 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
-
-
-
-
Method Detail
-
findByDocId
public List<DocumentHistory> findByDocId(long docId)
Description copied from interface:DocumentHistoryDAOThis method selects all histories of a given document.- Specified by:
findByDocIdin interfaceDocumentHistoryDAO- Parameters:
docId- - ID of the document.- Returns:
- list of histories ordered by date
- See Also:
DocumentHistoryDAO.findByDocId(long)
-
findByDocIdAndEvent
public List<DocumentHistory> findByDocIdAndEvent(long docId, String event)
Description copied from interface:DocumentHistoryDAOThis method selects all histories of a given document.- Specified by:
findByDocIdAndEventin interfaceDocumentHistoryDAO- Parameters:
docId- - ID of the document.event- - Optional event code- Returns:
- list of histories ordered by date
-
findByUserId
public List<DocumentHistory> findByUserId(long userId)
Description copied from interface:DocumentHistoryDAOThis method selects all histories of a given user.- Specified by:
findByUserIdin interfaceDocumentHistoryDAO- Parameters:
userId- identifier of the user- Returns:
- list of histories ordered by date
- See Also:
DocumentHistoryDAO.findByUserId(long)
-
findByFolderId
public List<DocumentHistory> findByFolderId(long folderId)
Description copied from interface:DocumentHistoryDAOThis method selects all histories of a given folder.- Specified by:
findByFolderIdin interfaceDocumentHistoryDAO- Parameters:
folderId- - ID of the document.- Returns:
- list of histories ordered by date
- See Also:
DocumentHistoryDAO.findByFolderId(long)
-
findNotNotified
public List<DocumentHistory> findNotNotified(Integer max)
Description copied from interface:DocumentHistoryDAOThis method selects all histories not notified yet.- Specified by:
findNotNotifiedin interfaceDocumentHistoryDAO- Parameters:
max- Optional maximum number of records- Returns:
- list of histories ordered by date
-
cleanOldHistories
public void cleanOldHistories(int ttl)
Description copied from interface:DocumentHistoryDAOThis method deletes all the document history entries oldest than the given days from now. Ifttlis 0 or -1, the deletion is not made.- Specified by:
cleanOldHistoriesin interfaceDocumentHistoryDAO- Parameters:
ttl- The maximum number of days over which the history is considered old
-
findByUserIdAndEvent
public List<DocumentHistory> findByUserIdAndEvent(long userId, String event, String sessionId)
Description copied from interface:DocumentHistoryDAOThis method selects all histories of a given user and related to the given event.- Specified by:
findByUserIdAndEventin interfaceDocumentHistoryDAO- Parameters:
userId- The user identifierevent- Code of the event (optional)sessionId- The session identifier (optional)- Returns:
- list of histories ordered by date
-
markHistoriesAsRead
public void markHistoriesAsRead(String event, long userId)
Description copied from interface:DocumentHistoryDAOMarks all the histories of a specific event as read by the specified user.- Specified by:
markHistoriesAsReadin interfaceDocumentHistoryDAO- Parameters:
event- the event nameuserId- identifier of the user
-
store
public boolean store(DocumentHistory history) throws PersistenceException
Description copied from interface:PersistentObjectDAOThis method persists the entity object- Specified by:
storein interfacePersistentObjectDAO<DocumentHistory>- Overrides:
storein classHibernatePersistentObjectDAO<DocumentHistory>- Parameters:
history- entity to be stored- Returns:
- True if successfully stored in a database
- Throws:
PersistenceException- raised in case of errors in the database
-
findByPath
public List<DocumentHistory> findByPath(String pathExpression, Date olderDate, Collection<String> events, Integer max)
Description copied from interface:DocumentHistoryDAOThis method finds all histories about a path (you can use expression)- Specified by:
findByPathin interfaceDocumentHistoryDAO- Parameters:
pathExpression- The path expression (like /Default/acme%)olderDate- The older date for the retrieved historiesevents- events Optional list of event codes to be used as filtermax- Optional maximum number of records- Returns:
- list of histories
-
-