Package com.logicaldoc.core.security.dao
Class HibernateUserHistoryDAO
- java.lang.Object
-
- com.logicaldoc.core.HibernatePersistentObjectDAO<UserHistory>
-
- com.logicaldoc.core.security.dao.HibernateUserHistoryDAO
-
- All Implemented Interfaces:
PersistentObjectDAO<UserHistory>
,UserHistoryDAO
public class HibernateUserHistoryDAO extends HibernatePersistentObjectDAO<UserHistory> implements UserHistoryDAO
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanOldHistories(int ttl)
This method deletes all the user history entries oldest than the given days from now.UserHistory
createUserHistory(User user, String eventType, String comment, String sessionId, Client client)
Creates an user history entryList<UserHistory>
findByUserId(long userId)
This method selects all histories of a given user.List<UserHistory>
findByUserIdAndEvent(long userId, String event)
This method selects all histories of a given user and a given type.boolean
store(UserHistory 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
-
findByUserId
public List<UserHistory> findByUserId(long userId)
Description copied from interface:UserHistoryDAO
This method selects all histories of a given user.- Specified by:
findByUserId
in interfaceUserHistoryDAO
- Parameters:
userId
- identifier of the suer- Returns:
- list of histories ordered by date asc
-
findByUserIdAndEvent
public List<UserHistory> findByUserIdAndEvent(long userId, String event)
Description copied from interface:UserHistoryDAO
This method selects all histories of a given user and a given type.- Specified by:
findByUserIdAndEvent
in interfaceUserHistoryDAO
- Parameters:
userId
- identifier of the suerevent
- The event specification to restrict the search (optional)- Returns:
- list of histories ordered by date asc
-
createUserHistory
public UserHistory createUserHistory(User user, String eventType, String comment, String sessionId, Client client)
Description copied from interface:UserHistoryDAO
Creates an user history entry- Specified by:
createUserHistory
in interfaceUserHistoryDAO
- Parameters:
user
- The user that made the operationeventType
- The event specificationcomment
- The comment provided by the usersessionId
- The user session idclient
- The client connected to LogicalDOC- Returns:
- the created history
-
cleanOldHistories
public void cleanOldHistories(int ttl)
Description copied from interface:UserHistoryDAO
This method deletes all the user history entries oldest than the given days from now. Ifttl
is 0 or -1, the cancellation is not made.- Specified by:
cleanOldHistories
in interfaceUserHistoryDAO
- Parameters:
ttl
- The maximum number of days over which the history is considered old- See Also:
UserHistoryDAO.cleanOldHistories(int)
-
store
public boolean store(UserHistory history) throws PersistenceException
Description copied from interface:PersistentObjectDAO
This method persists the entity object- Specified by:
store
in interfacePersistentObjectDAO<UserHistory>
- Overrides:
store
in classHibernatePersistentObjectDAO<UserHistory>
- Parameters:
history
- entity to be stored- Returns:
- True if successfully stored in a database
- Throws:
PersistenceException
- raised in case of errors in the database
-
-