Package com.logicaldoc.core.security.user

# Class HibernatePasswordHistoryDAO

java.lang.Object
com.logicaldoc.core.HibernatePersistentObjectDAO<PasswordHistory>
com.logicaldoc.core.security.user.HibernatePasswordHistoryDAO

All Implemented Interfaces:
  `PersistentObjectDAO<PasswordHistory>`, `PasswordHistoryDAO`

@Repository("passwordHistoryDAO") public class HibernatePasswordHistoryDAO extends HibernatePersistentObjectDAO<PasswordHistory> implements PasswordHistoryDAO
Hibernate implementation of `PasswordHistoryDAO`

Since:
  8.6.1
Author:
  Marco Meschieri - LogicalDOC

## Field Summary

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

`ENTITY`

## Method Summary

Modifier and Type
Method
Description
`void`
`cleanOldHistories(long userId, int retain)`
This method deletes all the histories maintaining the most recent ones.
`List<PasswordHistory>`
`findByUserId(long userId, Integer max)`
Gets all the histories related to a given user ordered by date desc
`PasswordHistory`
`findByUserIdAndPassword(long userId, String password, int max)`
Gets the password used by the user in last max times

### Methods inherited from class com.logicaldoc.core.HibernatePersistentObjectDAO

`bulkUpdate, count, delete, deleteAll, evict, evict, findById, findByObjectQuery, findByQuery, findByQuery, findByWhere, findIdsByWhere, getDatabaseMetadata, initialize, jdbcUpdate, jdbcUpdate, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForObject, queryForResultSet, queryForString, 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, 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

### findByUserId

public List<PasswordHistory> findByUserId(long userId, Integer max) throws PersistenceException
Description copied from interface: `PasswordHistoryDAO`
Gets all the histories related to a given user ordered by date desc

Specified by:
  `findByUserId` in interface `PasswordHistoryDAO`
Parameters:
  `userId` - Identifier of the user
  `max` - maximum number of returned records
Returns:
  orderer list of histories
Throws:
  `PersistenceException` - Error in the database

### cleanOldHistories

public void cleanOldHistories(long userId, int retain)
Description copied from interface: `PasswordHistoryDAO`
This method deletes all the histories maintaining the most recent ones. If `retain` is 0 or -1, the cancellation is not made.

Specified by:
  `cleanOldHistories` in interface `PasswordHistoryDAO`
Parameters:
  `userId` - identifier of the user
  `retain` - the number of most recent histories to maintain

### findByUserIdAndPassword

public PasswordHistory findByUserIdAndPassword(long userId, String password, int max) throws PersistenceException
Description copied from interface: `PasswordHistoryDAO`
Gets the password used by the user in last max times

Specified by:
  `findByUserIdAndPassword` in interface `PasswordHistoryDAO`
Parameters:
  `userId` - Identifier of the user
  `password` - The password to check
  `max` - number of most recent records to evaluate
Returns:
  the found history gridRecord, if any
Throws:
  `PersistenceException` - Error in the database