Class UserInfoBase

java.lang.Object
com.iizix.user.UserInfoBase
Direct Known Subclasses:
BasicUserInfo

public abstract class UserInfoBase extends Object
The base of user information in the database. The implementing subclass in the server extends from this class.
Author:
Christopher Mindus
  • Field Details Link icon

    • MAXIMUM_USER_NAME_LENGTH Link icon

      public static final int MAXIMUM_USER_NAME_LENGTH
      The maximum length of the user name.
      See Also:
    • id Link icon

      public final long id
      The unique ID.
    • userName Link icon

      public final String userName
      The 'user_name', never null (max 254 chars).
    • userNameLower Link icon

      public final String userNameLower
      The 'user_name_lower', lower case using Locale.ENGLISH of 'user_name', never null (max 254 chars).
    • email Link icon

      public final String email
      The 'email', never null (max 254 chars).
    • langCodes Link icon

      public final List<String> langCodes
      The unpacked 'lang_codes' as language codes the user wishes to use. The value is null if there are no language codes. The list is unmodifiable.
    • created Link icon

      public final long created
      The 'created' time in milliseconds since the epoch.
  • Constructor Details Link icon

    • UserInfoBase Link icon

      protected UserInfoBase(long id, String userName, String userNameLower, String email, String langCode, long created)
      Constructor for the user info base.
      Parameters:
      id - The unique user ID.
      userName - The user name, never null.
      userNameLower - The user name in lower case, never null.
      email - The email, never null.
      langCode - The language codes, comma separated, null for none.
      created - The creation date (milliseconds since the epoch).
  • Method Details Link icon

    • equals Link icon

      public final boolean equals(Object o)
      Checks for equality. Checks only if two user ID's are equal.
      Overrides:
      equals in class Object
      Parameters:
      o - The object to compare with.
      Returns:
      When user ID equals, false otherwise.
    • mustChangePassword Link icon

      public abstract boolean mustChangePassword()
      Returns if the password must be changed upon next login.
      Returns:
      Flag to change the password.
    • canChangePassword Link icon

      public abstract UserLocaleString canChangePassword()
      Checks if the user is allowed to change his password. Note that this does not check if the user id disabled: please do so using getDisabledReason().
      Returns:
      null if allowed and user can change his password, otherwise a UserLocaleString instance for the reason of the password being fixed and that it can never be changed.
    • getLastLogin Link icon

      public abstract long getLastLogin()
      Gets the 'last_login' time in milliseconds since the epoch, 0 for never.
    • getLastFail Link icon

      public abstract long getLastFail()
      Gets the 'last_fail' time in milliseconds since the epoch, 0 for never.
    • getFailCount Link icon

      public abstract int getFailCount()
      Gets the 'fail_count' value, zero for never.
    • getDisabledReason Link icon

      public abstract UserLocaleString getDisabledReason()
      Gets the 'disabled' reason, null for user not disabled.
      Returns:
      The user 'disabled' reason, or null for user not disabled.
    • getDetails Link icon

      public abstract Map<String,String> getDetails()
      Gets the cached and current user details. Details are e.g. fax number, profile picture.
      Returns:
      A new read-only copy of the details with name as key and the value for it.
    • getDetails Link icon

      public abstract Map<String,String> getDetails(boolean reload) throws SQLException
      Gets the (cached and current) user details. Details are e.g. fax number, profile picture.

      Note: If you have a JDBC connection, use getDetails(Connection, boolean) instead for efficiency.

      Parameters:
      reload - Reload flag from database.
      Returns:
      If reload is false, a cached read-only map with the details name as key and the value for it, otherwise a fresh copy of the details from the database.
      Throws:
      SQLException - For SQL errors.
    • getDetails Link icon

      public abstract Map<String,String> getDetails(Connection conn, boolean reload) throws SQLException
      Gets the user details. Details are e.g. fax number, profile picture. If not previously loaded, the "reload" flag is ignored and the details are loaded.
      Parameters:
      conn - The connection, null for cached values only.
      reload - Reload flag, i.e. instructs a full reload of all details from the database.
      Returns:
      A cached read-only map with the details name as key and the value for it.
      Throws:
      SQLException - For SQL errors.