Package com.logicaldoc.core.security
Class HibernateDeviceDAO
java.lang.Object
com.logicaldoc.core.HibernatePersistentObjectDAO<Device>
com.logicaldoc.core.security.HibernateDeviceDAO
- All Implemented Interfaces:
- PersistentObjectDAO<Device>,- DeviceDAO
@Repository("deviceDAO")
public class HibernateDeviceDAO
extends HibernatePersistentObjectDAO<Device>
implements DeviceDAO
An Hibernate based implementation of 
DeviceDAO- Since:
- 8.5.3
- Author:
- Marco Meschieri - LogicalDOC
- 
Field SummaryFields inherited from interface com.logicaldoc.core.PersistentObjectDAOENTITY
- 
Method SummaryModifier and TypeMethodDescriptionvoidcleanOldDevices(int ttl) This method deletes all the devices lastly used before the given days since now.voiddelete(long deviceId, int code) This method deletes an entity and you can give a deletion codefindByDevice(Device device) Finds the device that corresponds to the given onefindByDeviceId(String deviceId) Gets the device by it's alternate key:Device.getDeviceId()findByUserId(long userId) Finds the devices of a specific userfindTrustedDevices(long userId) Retrieves all the devices trusted by a given userbooleanisTrustedDevice(String username, jakarta.servlet.http.HttpServletRequest request) Checks if the current request's device is trusted by the uservoidsetUserDAO(UserDAO userDAO) voidThis method persists the entity objecttrustDevice(User user, Device requestDevice) Trusts a device for a userMethods inherited from class com.logicaldoc.core.HibernatePersistentObjectDAObulkUpdate, delete, deleteAll, deleteAll, evict, evict, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, initialize, isMySQL, isOracle, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForObject, queryForResultSet, queryForString, queryForString, setSessionFactoryMethods inherited from class java.lang.Objectequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.logicaldoc.core.PersistentObjectDAObulkUpdate, delete, deleteAll, deleteAll, evict, evict, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, initialize, isMySQL, isOracle, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForObject, queryForResultSet, queryForString, queryForString
- 
Method Details- 
findByDeviceIdDescription copied from interface:DeviceDAOGets the device by it's alternate key:Device.getDeviceId()- Specified by:
- findByDeviceIdin interface- DeviceDAO
- Parameters:
- deviceId- identifier of the device
- Returns:
- the found device
 
- 
findTrustedDevicesDescription copied from interface:DeviceDAORetrieves all the devices trusted by a given user- Specified by:
- findTrustedDevicesin interface- DeviceDAO
- Parameters:
- userId- the user to consider
- Returns:
- the list of devices ordered by descending last login date
 
- 
findByUserIdDescription copied from interface:DeviceDAOFinds the devices of a specific user- Specified by:
- findByUserIdin interface- DeviceDAO
- Parameters:
- userId- identifier of the user
- Returns:
- the list of devices ordered by descending last login date
 
- 
trustDeviceDescription copied from interface:DeviceDAOTrusts a device for a user- Specified by:
- trustDevicein interface- DeviceDAO
- Parameters:
- user- the current user
- requestDevice- the device to trust
- Returns:
- the trusted device
- Throws:
- PersistenceException- an error happened in the database
 
- 
cleanOldDevicespublic void cleanOldDevices(int ttl) Description copied from interface:DeviceDAOThis method deletes all the devices lastly used before the given days since now. Ifttlis 0 or -1, the cancellation is not made.- Specified by:
- cleanOldDevicesin interface- DeviceDAO
- Parameters:
- ttl- The maximum number of days over which the device is considered old
 
- 
storeDescription copied from interface:PersistentObjectDAOThis method persists the entity object- Specified by:
- storein interface- PersistentObjectDAO<Device>
- Overrides:
- storein class- HibernatePersistentObjectDAO<Device>
- Parameters:
- entity- entity to be stored
- Throws:
- PersistenceException- raised in case of errors in the database
 
- 
isTrustedDevicepublic boolean isTrustedDevice(String username, jakarta.servlet.http.HttpServletRequest request) throws PersistenceException Description copied from interface:DeviceDAOChecks if the current request's device is trusted by the user- Specified by:
- isTrustedDevicein interface- DeviceDAO
- Parameters:
- username- username of the current user
- request- the current request
- Returns:
- true only if the request's device is trusted by the user
- Throws:
- PersistenceException- Error in the data layer
 
- 
findByDeviceDescription copied from interface:DeviceDAOFinds the device that corresponds to the given one- Specified by:
- findByDevicein interface- DeviceDAO
- Parameters:
- device- the device to take as model
- Returns:
- the found device
 
- 
deleteDescription copied from interface:PersistentObjectDAOThis method deletes an entity and you can give a deletion code- Specified by:
- deletein interface- PersistentObjectDAO<Device>
- Overrides:
- deletein class- HibernatePersistentObjectDAO<Device>
- Parameters:
- deviceId- ID of the entity which should be deleted
- code- Deletion code
- Throws:
- PersistenceException- raised in case of errors in the database
 
- 
setUserDAO
 
-