Class HibernateDeviceDAO

    • Method Detail

      • findTrustedDevices

        public List<Device> findTrustedDevices​(long userId)
        Description copied from interface: DeviceDAO
        Retrieves all the devices trusted by a given user
        Specified by:
        findTrustedDevices in interface DeviceDAO
        Parameters:
        userId - the user to consider
        Returns:
        the list of devices ordered by descending last login date
      • findByUserId

        public List<Device> findByUserId​(long userId)
        Description copied from interface: DeviceDAO
        Finds the devices of a specific user
        Specified by:
        findByUserId in interface DeviceDAO
        Parameters:
        userId - identifier of the user
        Returns:
        the list of devices ordered by descending last login date
      • cleanOldDevices

        public void cleanOldDevices​(int ttl)
        Description copied from interface: DeviceDAO
        This method deletes all the devices lastly used before the given days since now. If ttl is 0 or -1, the cancellation is not made.
        Specified by:
        cleanOldDevices in interface DeviceDAO
        Parameters:
        ttl - The maximum number of days over which the device is considered old
      • isTrustedDevice

        public boolean isTrustedDevice​(String username,
                                       javax.servlet.http.HttpServletRequest request)
        Description copied from interface: DeviceDAO
        Checks if the current request's device is trusted by the user
        Specified by:
        isTrustedDevice in 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
      • findByDevice

        public Device findByDevice​(Device device)
        Description copied from interface: DeviceDAO
        Finds the device that corresponds to the given one
        Specified by:
        findByDevice in interface DeviceDAO
        Parameters:
        device - the device to take as model
        Returns:
        the found device
      • setUserDAO

        public void setUserDAO​(UserDAO userDAO)