Class UserProfileImageURN

java.lang.Object
com.iizix.urn.URN
com.iizix.urn.user.UserProfileImageURN
All Implemented Interfaces:
Serializable, Cloneable

public class UserProfileImageURN extends URN implements Cloneable, Serializable
User Profile Image Uniform Resource Naming (URN) instance class, holding various User Profile Image of the requested type.

User Profile Image URN's are encoded in IIZI as:

    urn:iz-pimg:type:id=userID or

    urn:iz-pimg:type:name=userName

The type is the image type are the {@link UserProfileImageURNType#name()}, i.e. one of the Strings

  • Uploaded
  • CroppedUploaded
  • Large
  • Thumbnail

The userID is a {code long} value unique to the user ID in question, the userName is a UTF-8 encoded string.

Author:
Christopher Mindus
See Also:
  • Method Details

    • setUserProfileImageURNProvider

      public static void setUserProfileImageURNProvider(IUserProfileImageURNProvider provider)
      Assigns the User Profile Image URN provider. This is an IIZI internal method. This method cannot only be called from the server and should not be called elsewhere.
      Throws:
      NullPointerException - If provider is null.
      IllegalStateException - If called twice or outside the server.
    • createRequest

      public static IUserProfileImageRequest createRequest()
      Creates an uninitialized profile image request.
      Returns:
      The uninitialized request.
      Throws:
      NullPointerException - If the User Profile Image URN provider is not initialized.
    • fromUserID

      public static UserProfileImageURN fromUserID(UserProfileImageURNType type, long id)
      Creates a User Profile String URN using a possible cached instance of the user information.
      Parameters:
      type - The type.
      id - The long user ID.
      Throws:
      NullPointerException - If type is null.
      IllegalArgumentException - If the id is zero.
    • fromUserName

      public static UserProfileImageURN fromUserName(UserProfileImageURNType type, String userName)
      Creates a User Profile String URN using a possible cached instance of the user information.
      Parameters:
      type - The type.
      userName - The User Name.
      Throws:
      NullPointerException - If type or userName is null.
    • getURL

      public String getURL()
      Gets the URL of this as a data URL in UTF-8 encoded data.
      Specified by:
      getURL in class URN
      Returns:
      The data URL as data:text/plain;charset=UTF-8;<i>value</i> where value is set to UTF-8 encoded "???" when "User ID" or "User Name" is not found or a database SQL exception is encountered.
    • getParamString

      public String getParamString()
      Gets the parameter string for the URN.toString() method.
      Specified by:
      getParamString in class URN
      Returns:
      The parameter string, always non-null, formatted as "type:name=UserName" or "type:id=UserID" where Query is the queried enum string.
    • hashCode

      public int hashCode()
      Hash code of this instance.
      Specified by:
      hashCode in class URN
      Returns:
      The hash code.
    • equals

      public boolean equals(Object obj)
      Checks if two instances are equal.
      Specified by:
      equals in class URN
      Parameters:
      obj - The other instance.
      Returns:
      The equals flag.