Class UserProfileStringURNProvider

java.lang.Object
com.iizix.server.user.UserProfileStringURNProvider
All Implemented Interfaces:
IUserProfileStringURNProvider

public class UserProfileStringURNProvider extends Object implements IUserProfileStringURNProvider
The URN User Profile String Provider singleton class.

Who may resolve a profile (CC-FIX-URN-LOCKDOWN, ruling UR-1 of order 515): the caller's own profile only. The caller is the user the server's sign-in recorded for the application session of the calling thread (IAppSessionGyro.getAuthenticatedUser()), never a user the client named in its entry URL; a thread outside a session, or a session nobody has signed in to, resolves nothing. Another user's profile, an unknown user ID or user name, a missing session and a database failure all answer the ONE text of NOT_AVAILABLE, so that a URN cannot tell "no such user" from "not allowed" (U515-23). Until this order the two overloads resolved any user's 36 details - PIN code and recovery answer included - for any caller, with no check of the session, the user or the application (U515-20, U515-21), and the "current user" branch read the client-named user label and dereferenced a missing session (U515-22).

Author:
Christopher Mindus
  • Field Details

    • NOT_AVAILABLE

      public static final String NOT_AVAILABLE
      The one text for "no such user", "not signed in", "not allowed" and "database failure": "User profile is not available: " followed by what was requested (a user ID or a user name).
      See Also:
  • Constructor Details

    • UserProfileStringURNProvider

      public UserProfileStringURNProvider()
  • Method Details

    • getInstance

      public static IUserProfileStringURNProvider getInstance()
      Gets the singleton instance.
      Returns:
      The IURNUserProfileProvider instance.
    • getDetails

      public Map<String,String> getDetails(long uid, boolean reload) throws NotFoundException
      Gets the (cached and current) user details. Details are e.g. fax number, profile picture.
      Specified by:
      getDetails in interface IUserProfileStringURNProvider
      Parameters:
      uid - The User ID (non-zero), or -1L for the signed-in user of the current session.
      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:
      NotFoundException - NOT_AVAILABLE and the user ID: no session or nobody signed in, the user ID not found, not the signed-in user's, or a database error occurred.
    • getDetails

      public Map<String,String> getDetails(String userName, boolean reload) throws NotFoundException
      Gets the (cached and current) user details. Details are e.g. fax number, profile picture.
      Specified by:
      getDetails in interface IUserProfileStringURNProvider
      Parameters:
      userName - The user name, or null for the signed-in user of the current session.
      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:
      NotFoundException - NOT_AVAILABLE and the user name: no session or nobody signed in, the user name not found, not the signed-in user's, or a database error occurred.