Interface PasswordHistoryDAO

    • Method Detail

      • findByUserIdAndPassword

        PasswordHistory findByUserIdAndPassword​(long userId,
                                                String password,
                                                int max)
                                         throws PersistenceException
        Gets the password used by the user in last max times
        Parameters:
        userId - Identifier of the user
        password - The password to check
        max - number of most recent records to evaluate
        Returns:
        the found history record, if any
        Throws:
        PersistenceException - Error in the database
      • findByUserId

        List<PasswordHistory> findByUserId​(long userId,
                                           Integer max)
                                    throws PersistenceException
        Gets all the histories related to a given user ordered by date desc
        Parameters:
        userId - Identifier of the user
        max - maximum number of returned records
        Returns:
        orderer list of histories
        Throws:
        PersistenceException - Error in the database
      • cleanOldHistories

        void cleanOldHistories​(long userId,
                               int retain)
        This method deletes all the histories maintaining the most recent ones. If retain is 0 or -1, the cancellation is not made.
        Parameters:
        userId - identifier of the user
        retain - the number of most recent histories to maintain