Package com.logicaldoc.core.security.user

# Interface UserHistoryDAO

All Superinterfaces:
  `PersistentObjectDAO<UserHistory>`

All Known Implementing Classes:
  `HibernateUserHistoryDAO`

public interface UserHistoryDAO extends PersistentObjectDAO<UserHistory>
DAO for `UserHistory` handling.

Since:
  5.0
Author:
  Matteo Caruso - LogicalDOC

## Field Summary

### Fields inherited from interface com.logicaldoc.core.PersistentObjectDAO

`ENTITY`

## Method Summary

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, UserEvent event, String comment, String sessionId, Client client)`
Creates an user history entry
`List<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.
`static UserHistoryDAO`
`get()`
Gets the object available in the application context

### Methods inherited from interface com.logicaldoc.core.PersistentObjectDAO

`bulkUpdate, count, count, count, delete, delete, deleteAll, deleteAll, evict, evict, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, initialize, initialize, isMariaDB, isMySQL, isOracle, isPostgreSQL, isSQLServer, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForObject, queryForResultSet, queryForString, queryForString, store`

## Method Details

### get

static UserHistoryDAO get()
Gets the object available in the application context

Returns:
  the instance of this object in the application context

### findByUserId

List<UserHistory> findByUserId(long userId)
This method selects all histories of a given user.

Parameters:
  `userId` - identifier of the suer
Returns:
  list of histories ordered by date asc

### findByUserIdAndEvent

List<UserHistory> findByUserIdAndEvent(long userId, String event)
This method selects all histories of a given user and a given type.

Parameters:
  `userId` - identifier of the suer
  `event` - The event specification to restrict the search (optional)
Returns:
  list of histories ordered by date asc

### createUserHistory

UserHistory createUserHistory(User user, UserEvent event, String comment, String sessionId, Client client)
Creates an user history entry

Parameters:
  `user` - The user that made the operation
  `event` - The event specification
  `comment` - The comment provided by the user
  `sessionId` - The user session id
  `client` - The client connected to LogicalDOC
Returns:
  the created history

### cleanOldHistories

void cleanOldHistories(int ttl)
This method deletes all the user history entries oldest than the given days from now. If `ttl` is 0 or -1, the cancellation is not made.

Parameters:
  `ttl` - The maximum number of days over which the history is considered old