Package com.logicaldoc.core.security.dao
Interface DeviceDAO
-
- All Superinterfaces:
PersistentObjectDAO<Device>
- All Known Implementing Classes:
HibernateDeviceDAO
public interface DeviceDAO extends PersistentObjectDAO<Device>
A DAO to handle the devices- Since:
- 8.5.3
- Author:
- Marco Meschieri - LogicalDOC
-
-
Field Summary
-
Fields inherited from interface com.logicaldoc.core.PersistentObjectDAO
ENTITY
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
cleanOldDevices(int ttl)
This method deletes all the devices lastly used before the given days since now.Device
findByDevice(Device device)
Finds the device that corresponds to the given oneDevice
findByDeviceId(String deviceId)
Gets the device by it's alternate key:Device.getDeviceId()
List<Device>
findByUserId(long userId)
Finds the devices of a specific userList<Device>
findTrustedDevices(long userId)
Retrieves all the devices trusted by a given userboolean
isTrustedDevice(String username, javax.servlet.http.HttpServletRequest request)
Checks if the current request's device is trusted by the userDevice
trustDevice(User user, Device device)
Trusts a device for a user-
Methods inherited from interface com.logicaldoc.core.PersistentObjectDAO
bulkUpdate, bulkUpdate, delete, delete, deleteAll, deleteAll, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByObjectQuery, findByQuery, findByQuery, findByWhere, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDbms, initialize, isOracle, jdbcUpdate, jdbcUpdate, query, queryForInt, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForRowSet, queryForString, store
-
-
-
-
Method Detail
-
findByDeviceId
Device findByDeviceId(String deviceId)
Gets the device by it's alternate key:Device.getDeviceId()
- Parameters:
deviceId
- identifier of the device- Returns:
- the found device
-
findByDevice
Device findByDevice(Device device)
Finds the device that corresponds to the given one- Parameters:
device
- the device to take as model- Returns:
- the found device
-
findByUserId
List<Device> findByUserId(long userId)
Finds the devices of a specific user- Parameters:
userId
- identifier of the user- Returns:
- the list of devices ordered by descending last login date
-
findTrustedDevices
List<Device> findTrustedDevices(long userId)
Retrieves 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
-
isTrustedDevice
boolean isTrustedDevice(String username, javax.servlet.http.HttpServletRequest request)
Checks if the current request's device is trusted by the user- Parameters:
username
- username of the current userrequest
- the current request- Returns:
- true only if the request's device is trusted by the user
-
trustDevice
Device trustDevice(User user, Device device) throws PersistenceException
Trusts a device for a user- Parameters:
user
- the current userdevice
- the device to trust- Returns:
- the trusted device
- Throws:
PersistenceException
- an error happened in the database
-
cleanOldDevices
void cleanOldDevices(int ttl)
This method deletes all the devices lastly used before the given days since now. Ifttl
is 0 or -1, the cancellation is not made.- Parameters:
ttl
- The maximum number of days over which the device is considered old
-
-