Interface LoginHistory

All Known Implementing Classes:
LoginHistoryProvider

public sealed interface LoginHistory permits LoginHistoryProvider
Interface to manage login history.
  • Method Details

    • existsLogin

      boolean existsLogin(UUID loginId)
      Checks if a login record exists with the specified login ID.
      Parameters:
      loginId - The unique identifier of the login record to check.
      Returns:
      true if a login record exists with the specified login ID, false otherwise.
    • deleteUserLogin

      void deleteUserLogin(int userId)
      Deletes all login entries associated with the specified user ID.
      Parameters:
      userId - The unique identifier of the user whose login history should be deleted.
    • getLogins

      List<UUID> getLogins(int userId)
      Retrieves a list of login IDs (UUIDs) associated with a specific user.
      Parameters:
      userId - The unique identifier of the user whose login records are being retrieved
      Returns:
      A list of UUIDs representing the login records for the specified user
    • getSortedLogins

      List<UUID> getSortedLogins(int userId)
      Retrieves a list of login IDs associated with a specific user, sorted in descending order of login time, with a maximum limit.
      Parameters:
      userId - The unique identifier of the user whose sorted login records are to be retrieved
      Returns:
      A list of UUIDs representing the login records, sorted by login time
    • getLastLoginId

      UUID getLastLoginId(int userId)
      Retrieves the most recent login ID for a specified user from their login history.
      Parameters:
      userId - The unique identifier of the user whose last login ID is to be retrieved.
      Returns:
      The UUID representing the most recent login ID for the specified user, or null if no login history exists for the user.
    • getLastQuit

      Timestamp getLastQuit(int userId)
      Retrieves the timestamp of the most recent logout event for the specified user.
      Parameters:
      userId - The unique identifier of the user whose last quit time is to be retrieved.
      Returns:
      A Timestamp object representing the time of the user's last quit, or null if no quit record exists for the specified user.
    • getUserIdsByIP

      List<Integer> getUserIdsByIP(String ipAddress)
      Retrieves a list of user IDs associated with a specified IP address.
      Parameters:
      ipAddress - The IP address for which the associated user IDs are to be retrieved.
      Returns:
      A list of integers representing the user IDs associated with the given IP address.
    • getUserId

      int getUserId(UUID loginId)
      Retrieves the user ID associated with the given login ID.
      Parameters:
      loginId - The unique identifier of the login session
      Returns:
      The user ID linked to the specified login ID, or a negative value if not found
    • getIPAddress

      String getIPAddress(UUID loginId)
      Retrieves the IP address associated with a specific login session.
      Parameters:
      loginId - The unique identifier of the login session
      Returns:
      The IP address as a string, or null if the login session does not exist or has no associated IP address
    • getFirstLoginTimeByUser

      Timestamp getFirstLoginTimeByUser(int userId, String ipAddress)
      Retrieves the earliest login time for a specified user associated with a specific IP address.
      Parameters:
      userId - The ID of the user whose first login time is to be retrieved.
      ipAddress - The IP address associated with the user's login.
      Returns:
      A Timestamp object representing the first login time for the user with the specified IP address, or null if no record is found.
    • getFirstLoginTimeByIP

      Timestamp getFirstLoginTimeByIP(String ipAddress)
      Retrieves the first login timestamp associated with a specific IP address.
      Parameters:
      ipAddress - The IP address for which the first login timestamp is to be retrieved
      Returns:
      The timestamp of the first login associated with the specified IP address, or null if no login records exist for the given IP address
    • getLastLoginTimeByUser

      Timestamp getLastLoginTimeByUser(int userId, String ipAddress)
      Retrieves the most recent login time for a user based on their user ID and IP address.
      Parameters:
      userId - The unique identifier of the user whose last login time is to be retrieved.
      ipAddress - The IP address associated with the user's login.
      Returns:
      A Timestamp object representing the time of the user's last login from the specified IP address, or null if no login information is found.
    • getLastLoginTimeByIP

      Timestamp getLastLoginTimeByIP(String ipAddress)
      Retrieves the last login time associated with the specified IP address.
      Parameters:
      ipAddress - The IP address for which the last login time is to be retrieved.
      Returns:
      A Timestamp representing the last login time for the specified IP address, or null if no such login record exists.
    • getLoginTime

      Timestamp getLoginTime(UUID loginId)
      Retrieves the login time for a specific login ID.
      Parameters:
      loginId - The unique identifier associated with the login.
      Returns:
      The timestamp indicating the login time, or null if no record is found.
    • getLogoutTime

      Timestamp getLogoutTime(UUID loginId)
      Retrieves the logout time associated with a specific login session.
      Parameters:
      loginId - The unique identifier of the login session
      Returns:
      The timestamp when the user logged out, or null if the logout time is not set
    • getLogoutDate

      String getLogoutDate(UUID loginId)
      Retrieves the formatted logout date associated with the given login ID. If no logout time is available, the method will return "never."
      Parameters:
      loginId - The unique identifier of the login session.
      Returns:
      A string representing the logout date in a formatted style, or "never" if the logout time is not available.
    • getClientVersion

      String getClientVersion(UUID loginId)
      Retrieves the client version associated with the given login ID.
      Parameters:
      loginId - The unique identifier of the login session
      Returns:
      The client version string if found, or null if no client version is associated with the given login ID
    • getProtocolVersion

      String getProtocolVersion(UUID loginId)
      Retrieves the protocol version associated with a specific login ID.
      Parameters:
      loginId - The unique identifier of the login session.
      Returns:
      The protocol version as a string, or null if not found.