Class UserProfileStringURN
- java.lang.Object
- com.iizix.urn.URN
- com.iizix.urn.user.UserProfileStringURN
 
 
- All Implemented Interfaces:
- java.io.Serializable,- java.lang.Cloneable
 - public class UserProfileStringURN extends URN implements java.lang.Cloneable, java.io.Serializable User Profile String Uniform Resource Naming (URN) instance class, holding various User Profile strings depending on the requested information.- User Profile String URN's are encoded in iizi as: - urn:iz-pstr:id=userID[?+reload]?=queryor- urn:iz-pstr:userName=userName[?+reload]?=query- The - reloadparameter is optional as will force a database request rather than using a potential cached value. The brackets around- ?+reloadindicates that the value is options and the brackets should not be specified. Be careful when using it too much as performance is impacted.- The - userIDis a {code long} value unique to the user ID in question, the- userNameis a UTF-8 encoded string, and the- queryis the queried String, one of the names available in- {@link UserProfileStringURNType}plus an additional one-based index entry when the- {@link UserProfileStringURNType#multiple}flag allows it.- Examples of - queryby direct- String:- "FullName"
- "LastName"
- "FirstName"
- "CompanyName"
- "ZipCode"
- "City"
- "StateProvince"
- "Country"
 - Examples of the same request, but using a - {@link UserProfileStringURNType}:- {@link UserProfileStringURNType#FullName}
- {@link UserProfileStringURNType#LastName}
- {@link UserProfileStringURNType#FirstName}
- {@link UserProfileStringURNType#CompanyName}
- {@link UserProfileStringURNType#ZipCode}
- {@link UserProfileStringURNType#City}
- {@link UserProfileStringURNType#StateProvince}
- {@link UserProfileStringURNType#Country}
 - Examples of - queryin- Stringformat when multiple values can be assigned to the query by appending "- _2" to the second value, "- _3" to the third value, and so on:- "WorkMobile<strong>_2</strong>"
- "WorkMobile<strong>_3</strong>"
- "AdditionalEmail<strong>_2</strong>"
- "AdditionalEmail<strong>_3</strong>"
- "AdditionalEmail<strong>_4</strong>"
 - Instead of a - Stringtype of- query, you can also use three parameters- <i>userID</i>as a- longor- <i>userName</i>as a- String, followed by- {@link UserProfileStringURNType}and an- Integerusing the method- {@link #fromUserID(long, UserProfileStringURNType, int)}when the- userIDis known, otherwise by a- name Stringusing- {@link #fromUserID(String, UserProfileStringURNType, int)}:- <i>long_UserID</i>,{@link UserProfileStringURNType#WorkMobile},2
- <i>long_UserID</i>,{@link UserProfileStringURNType#WorkMobile},3
- <i>long_UserID</i>,{@link UserProfileStringURNType#AdditionalEmail},2
- <i>long_UserID</i>,{@link UserProfileStringURNType#AdditionalEmail},3
- <i>long_UserID</i>,{@link UserProfileStringURNType#AdditionalEmail},4
- <i>"BillyJean"</i>,{@link UserProfileStringURNType#WorkMobile},2
- <i>"BillyJean"</i>,{@link UserProfileStringURNType#WorkMobile},3
- <i>"billy.jean@something.dom"</i>,{@link UserProfileStringURNType#AdditionalEmail},2
- <i>"billy.jean@something.dom"</i>,{@link UserProfileStringURNType#AdditionalEmail},3
- <i>"billy.jean@something.dom"</i>,{@link UserProfileStringURNType#AdditionalEmail},4
 - See Also:
- * @author Christopher Mindus, Serialized Form
 
- Method Summary- All Methods Static Methods Instance Methods Concrete Methods - Modifier and Type - Method - Description - boolean- equals(java.lang.Object obj)Checks if two instances are equal.- static UserProfileStringURN- fromUserID(long id, UserProfileStringURNType query)Creates a User Profile String URN using a possible cached instance of the user information.- static UserProfileStringURN- fromUserID(long id, UserProfileStringURNType query, boolean reload)Creates a User Profile String URN.- static UserProfileStringURN- fromUserID(long id, UserProfileStringURNType query, int oneBasedIndex)Creates a User Profile String URN using a possible cached instance of the user information.- static UserProfileStringURN- fromUserID(long id, UserProfileStringURNType query, int oneBasedIndex, boolean reload)Creates a User Profile String URN.- static UserProfileStringURN- fromUserID(long id, java.lang.String query)Creates a User Profile String URN using a possible cached instance of the user information.- static UserProfileStringURN- fromUserID(long id, java.lang.String query, boolean reload)Creates a User Profile String URN.- static UserProfileStringURN- fromUserID(long id, java.lang.String query, int oneBasedIndex)Creates a User Profile String URN using a possible cached instance of the user information.- static UserProfileStringURN- fromUserID(long id, java.lang.String query, int oneBasedIndex, boolean reload)Creates a User Profile String URN.- static UserProfileStringURN- fromUserName(java.lang.String userName, UserProfileStringURNType query)Creates a User Profile String URN using a possible cached instance of the user information.- static UserProfileStringURN- fromUserName(java.lang.String userName, UserProfileStringURNType query, boolean reload)Creates a User Profile String URN.- static UserProfileStringURN- fromUserName(java.lang.String userName, UserProfileStringURNType query, int oneBasedIndex)Creates a User Profile String URN using a possible cached instance of the user information.- static UserProfileStringURN- fromUserName(java.lang.String userName, UserProfileStringURNType query, int oneBasedIndex, boolean reload)Creates a User Profile String URN.- static UserProfileStringURN- fromUserName(java.lang.String userName, java.lang.String query)Creates a User Profile String URN using a possible cached instance of the user information.- static UserProfileStringURN- fromUserName(java.lang.String userName, java.lang.String query, boolean reload)Creates a User Profile String URN.- static UserProfileStringURN- fromUserName(java.lang.String userName, java.lang.String query, int oneBasedIndex)Creates a User Profile String URN using a possible cached instance of the user information.- static UserProfileStringURN- fromUserName(java.lang.String userName, java.lang.String query, int oneBasedIndex, boolean reload)Creates a User Profile String URN.- java.lang.String- getParamString()Gets the parameter string for the- URN.toString()method.- java.lang.String- getURL()Gets the URL of this as a data URL in UTF-8 encoded data.- java.lang.String- getValue(boolean nullIfNotFound)Gets the String result of this URN.- int- hashCode()Hash code of this instance.- static void- setUserProfileStringURNProvider(IUserProfileStringURNProvider provider)Assigns the User Profile String URN provider.- Methods inherited from class com.iizix.urn.URN- asURNResource, from, getImageTarget, getURNString, isImageTargetSupported, isURNResource, toString
 
 
- Method Detail- setUserProfileStringURNProvider- public static void setUserProfileStringURNProvider(IUserProfileStringURNProvider provider) Assigns the User Profile String URN provider. This is an IIZI internal method. This method cannot only be called from the server and should not be called elsewhere.- Throws:
- java.lang.NullPointerException- If- provideris- null.
- java.lang.IllegalStateException- If called twice or outside the server.
 
 - fromUserID- public static UserProfileStringURN fromUserID(long id, java.lang.String query) Creates a User Profile String URN using a possible cached instance of the user information.- We recommend using the - fromUserID(...)method using a- {@link UserProfileStringURNType}instead of a- Stringbecause it is faster.- Parameters:
- id- The- Longuser ID.
- query- The query String.
- Throws:
- java.lang.IllegalArgumentException- If the- idis zero.
- java.lang.NullPointerException- If- queryis- null.
- NotFoundException- If the- queryString is not a valid query.
 
 - fromUserID- public static UserProfileStringURN fromUserID(long id, java.lang.String query, boolean reload) Creates a User Profile String URN.- We recommend using the - fromUserID(...)method using a- {@link UserProfileStringURNType}instead of a- Stringbecause it is faster.- Parameters:
- id- The- Longuser ID.
- query- The query String.
- reload- The reload flag, false if OK to use a cached value. Be careful when setting this flag to- trueas it impacts performance.
- Throws:
- java.lang.IllegalArgumentException- If the- idis zero.
- java.lang.NullPointerException- If- queryis- null.
- NotFoundException- If the- queryString is not a valid query.
 
 - fromUserID- public static UserProfileStringURN fromUserID(long id, java.lang.String query, int oneBasedIndex) Creates a User Profile String URN using a possible cached instance of the user information.- We recommend using the - fromUserID(...)method using a- {@link UserProfileStringURNType}instead of a- Stringbecause it is faster.- Parameters:
- id- The- Longuser ID.
- query- The query String.
- oneBasedIndex- The one-based index for the query if it supports it, zero otherwise.
- Throws:
- java.lang.IllegalArgumentException- If the- idis zero, or if- oneBasedIndexis non-zero, less than 1 or larger than 99 when the- querysupports multiple values.
- java.lang.NullPointerException- If- queryis- null.
- NotFoundException- If the- queryString is not a valid query.
 
 - fromUserID- public static UserProfileStringURN fromUserID(long id, java.lang.String query, int oneBasedIndex, boolean reload) throws NotFoundException Creates a User Profile String URN.- We recommend using the - fromUserID(...)method using a- {@link UserProfileStringURNType}instead of a- Stringbecause it is faster.- Parameters:
- id- The- Longuser ID.
- query- The query String.
- oneBasedIndex- The one-based index for the query if it supports it, zero otherwise.
- reload- The reload flag,- falseif OK to use a cached value. Be careful when setting this flag to- trueas it impacts performance.
- Throws:
- java.lang.IllegalArgumentException- If the- idis zero, or if- oneBasedIndexis non-zero, less than 1 or larger than 99 when the- querysupports multiple values.
- java.lang.NullPointerException- If- queryis- null.
- NotFoundException- If the- queryString is not a valid query.
 
 - fromUserName- public static UserProfileStringURN fromUserName(java.lang.String userName, java.lang.String query) Creates a User Profile String URN using a possible cached instance of the user information.- We recommend using the - fromUserName(...)method using a- {@link UserProfileStringURNType}instead of a- Stringbecause it is faster.- Parameters:
- userName- The User Name.
- query- The query String.
- Throws:
- java.lang.NullPointerException- If- queryis- null.
- NotFoundException- If the- queryString is not a valid query.
 
 - fromUserName- public static UserProfileStringURN fromUserName(java.lang.String userName, java.lang.String query, boolean reload) Creates a User Profile String URN.- We recommend using the - fromUserName(...)method using a- {@link UserProfileStringURNType}instead of a- Stringbecause it is faster.- Parameters:
- userName- The User Name.
- query- The query String.
- reload- The reload flag,- falseif OK to use a cached value. Be careful when setting this flag to- trueas it impacts performance.
- Throws:
- java.lang.NullPointerException- If- queryis- null.
- NotFoundException- If the- queryString is not a valid query.
 
 - fromUserName- public static UserProfileStringURN fromUserName(java.lang.String userName, java.lang.String query, int oneBasedIndex) Creates a User Profile String URN using a possible cached instance of the user information.- We recommend using the - fromUserName(...)method using a- {@link UserProfileStringURNType}instead of a- Stringbecause it is faster.- Parameters:
- userName- The User Name.
- query- The query String.
- oneBasedIndex- The one-based index for the query if it supports it, zero otherwise.
- Throws:
- java.lang.NullPointerException- If- queryis- null.
- NotFoundException- If the- queryString is not a valid query.
- java.lang.IllegalArgumentException- If the- oneBasedIndexis non-zero, less than 1 or larger than 99 when the- querysupports multiple values.
 
 - fromUserName- public static UserProfileStringURN fromUserName(java.lang.String userName, java.lang.String query, int oneBasedIndex, boolean reload) Creates a User Profile String URN.- We recommend using the - fromUserName(...)method using a- {@link UserProfileStringURNType}instead of a- Stringbecause it is faster.- Parameters:
- userName- The User Name.
- query- The query String.
- oneBasedIndex- The one-based index for the query if it supports it, zero otherwise.
- reload- The reload flag,- falseif OK to use a cached value. Be careful when setting this flag to- trueas it impacts performance.
- Throws:
- java.lang.NullPointerException- If- queryis- null.
- NotFoundException- If the- queryString is not a valid query.
- java.lang.IllegalArgumentException- If the- oneBasedIndexis non-zero, less than 1 or larger than 99 when the- querysupports multiple values.
 
 - fromUserID- public static UserProfileStringURN fromUserID(long id, UserProfileStringURNType query) Creates a User Profile String URN using a possible cached instance of the user information.- Parameters:
- id- The- Longuser ID.
- query- The query.
- Throws:
- java.lang.IllegalArgumentException- If the- idis zero.
- java.lang.NullPointerException- If- queryis- null.
 
 - fromUserID- public static UserProfileStringURN fromUserID(long id, UserProfileStringURNType query, boolean reload) Creates a User Profile String URN.- Parameters:
- id- The- Longuser ID.
- query- The query.
- reload- The reload flag, false if OK to use a cached value. Be careful when setting this flag to- trueas it impacts performance.
- Throws:
- java.lang.IllegalArgumentException- If the- idis zero.
- java.lang.NullPointerException- If- queryis- null.
 
 - fromUserID- public static UserProfileStringURN fromUserID(long id, UserProfileStringURNType query, int oneBasedIndex) Creates a User Profile String URN using a possible cached instance of the user information.- Parameters:
- id- The- Longuser ID.
- query- The query.
- oneBasedIndex- The one-based index for the query if it supports it, zero otherwise.
- Throws:
- java.lang.IllegalArgumentException- If the- idis zero, or if- oneBasedIndexis non-zero, less than 1 or larger than 99 when the- querysupports multiple values.
- java.lang.NullPointerException- If- queryis- null.
 
 - fromUserID- public static UserProfileStringURN fromUserID(long id, UserProfileStringURNType query, int oneBasedIndex, boolean reload) throws NotFoundException Creates a User Profile String URN.- Parameters:
- id- The- Longuser ID.
- query- The query.
- oneBasedIndex- The one-based index for the query if it supports it, zero otherwise.
- reload- The reload flag,- falseif OK to use a cached value. Be careful when setting this flag to- trueas it impacts performance.
- Throws:
- java.lang.IllegalArgumentException- If the- idis zero, or if- oneBasedIndexis non-zero, less than 1 or larger than 99 when the- querysupports multiple values.
- java.lang.NullPointerException- If- queryis- null.
- NotFoundException
 
 - fromUserName- public static UserProfileStringURN fromUserName(java.lang.String userName, UserProfileStringURNType query) Creates a User Profile String URN using a possible cached instance of the user information.- Parameters:
- userName- The User Name.
- query- The query.
- Throws:
- java.lang.NullPointerException- If- queryis- null.
 
 - fromUserName- public static UserProfileStringURN fromUserName(java.lang.String userName, UserProfileStringURNType query, boolean reload) Creates a User Profile String URN.- Parameters:
- userName- The User Name.
- query- The query.
- reload- The reload flag,- falseif OK to use a cached value. Be careful when setting this flag to- trueas it impacts performance.
- Throws:
- java.lang.NullPointerException- If- queryis- null.
 
 - fromUserName- public static UserProfileStringURN fromUserName(java.lang.String userName, UserProfileStringURNType query, int oneBasedIndex) Creates a User Profile String URN using a possible cached instance of the user information.- Parameters:
- userName- The User Name.
- query- The query.
- oneBasedIndex- The one-based index for the query if it supports it, zero otherwise.
- Throws:
- java.lang.NullPointerException- If- queryis- null.
- java.lang.IllegalArgumentException- If the- oneBasedIndexis non-zero, less than 1 or larger than 99 when the- querysupports multiple values.
 
 - fromUserName- public static UserProfileStringURN fromUserName(java.lang.String userName, UserProfileStringURNType query, int oneBasedIndex, boolean reload) Creates a User Profile String URN.- Parameters:
- userName- The User Name.
- query- The query.
- oneBasedIndex- The one-based index for the query if it supports it, zero otherwise.
- reload- The reload flag,- falseif OK to use a cached value. Be careful when setting this flag to- trueas it impacts performance.
- Throws:
- java.lang.NullPointerException- If- queryis- null.
- java.lang.IllegalArgumentException- If the- oneBasedIndexis non-zero, less than 1 or larger than 99 when the- querysupports multiple values.
 
 - getURL- public java.lang.String getURL() Gets the URL of this as a data URL in UTF-8 encoded data.- Specified by:
- getURLin class- URN
- Returns:
- The data URL as data:text/plain;charset=UTF-8;<i>value</i>wherevalueis set to UTF-8 encoded "???" when "User ID" or "User Name" is not found or a database SQL exception is encountered.
- Throws:
- java.lang.IllegalStateException- If the user authentication instance is not initialized.
 
 - getValue- public java.lang.String getValue(boolean nullIfNotFound) throws NotFoundExceptionGets the String result of this URN.- Parameters:
- nullIfNotFound- Flag indicating- nullshould be returned if- trueif the user value is not found, otherwise when- falsean empty string is returned.
- Returns:
- A String, empty or nullif not found, depending on thenullIfNotFoundflag.
- Throws:
- NotFoundException- If the user ID or the User Name is not found in the database, or a database error occurred.
- java.lang.IllegalStateException- If the user authentication instance is not initialized.
 
 - getParamString- public java.lang.String getParamString() Gets the parameter string for the- URN.toString()method.- Specified by:
- getParamStringin class- URN
- Returns:
- The parameter string, always non-null, formatted as"userName=UserName,query=Query"or"userID=ID,query=Query"whereQueryis the queried enum string. If the enum string is indexed with a value between 2 and 99,",oneBasedIndex=Index"is appended. If the request requires a reload of the user information from the database and a cached value is not acceptable, the string",reload=true"is appended.
 
 - hashCode- public int hashCode() Hash code of this instance.