Package com.logicaldoc.core.security
Interface DeviceDAO
- All Superinterfaces:
- PersistentObjectDAO<Device>
- All Known Implementing Classes:
- HibernateDeviceDAO
A DAO to handle the devices
- 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.findByDevice(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 usertrustDevice(User user, Device device) Trusts a device for a userMethods inherited from interface com.logicaldoc.core.PersistentObjectDAObulkUpdate, delete, 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, store
- 
Method Details- 
findByDeviceIdGets the device by it's alternate key:Device.getDeviceId()- Parameters:
- deviceId- identifier of the device
- Returns:
- the found device
 
- 
findByDeviceFinds the device that corresponds to the given one- Parameters:
- device- the device to take as model
- Returns:
- the found device
 
- 
findByUserIdFinds the devices of a specific user- Parameters:
- userId- identifier of the user
- Returns:
- the list of devices ordered by descending last login date
 
- 
findTrustedDevicesRetrieves all the devices trusted by a given user- Parameters:
- userId- the user to consider
- Returns:
- the list of devices ordered by descending last login date
 
- 
isTrustedDeviceboolean isTrustedDevice(String username, jakarta.servlet.http.HttpServletRequest request) throws PersistenceException Checks if the current request's device is trusted by the user- 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
 
- 
trustDeviceTrusts a device for a user- Parameters:
- user- the current user
- device- the device to trust
- Returns:
- the trusted device
- Throws:
- PersistenceException- an error happened in the database
 
- 
cleanOldDevicesvoid cleanOldDevices(int ttl) This method deletes all the devices lastly used before the given days since now. Ifttlis 0 or -1, the cancellation is not made.- Parameters:
- ttl- The maximum number of days over which the device is considered old
 
 
-