Klasse UserProfile

java.lang.Object
de.uplanet.lucy.server.profile.UserProfile
Alle implementierten Schnittstellen:
de.uplanet.lucy.server.profile.IUserProfile, AutoCloseable

@Scriptable public final class UserProfile extends Object implements de.uplanet.lucy.server.profile.IUserProfile
User profile class.

Used to store properties of a users's profile. The values may be of any Object-derived class such as strings, date values, integer or floating point values, hash maps and so on.

Users MUST call done() when finished using the user profile to ensure that all resources such as SQL statements are properly closed and freed.

Users are encouraged to use URN-like property names, e.g.
    urn:schemas-intrexx-de:profile:my-property,
to make their applications namespace aware.


The class operates on the LCPROFILE table:

CREATE TABLE LCPROFILE
(
    GUIDUSER   VARCHAR(40) NOT NULL,
    STRNAME    VARCHAR(255) NOT NULL,
    INTTYPEID  INTEGER NOT NULL,
    INTVERSION INTEGER NOT NULL,
    TXTVALUE   TEXT
)

ALTER TABLE LCPROFILE WITH NOCHECK ADD CONSTRAINT PK_LCPROFILE
    PRIMARY KEY CLUSTERED (GUIDUSER, STRNAME)

If IUserProfile.USE_CACHE is used, read properties are buffered. So subsequent gets will not result in database read operations. For this reason changes in the database that are made from different instances may not be visible if the own instance read the property before the foreign change occurred.

  • Feldübersicht

    Von Schnittstelle geerbte Felder de.uplanet.lucy.server.profile.IUserProfile

    DEFAULT_USER_ID, ERR_RET_VAL, NO_CACHE, NO_PROP_RET_VAL, USE_CACHE, VERSION
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    void
    This method does nothing.
    createInstance(de.uplanet.jdbc.JdbcConnection p_conn, String p_strUserId, int p_iCacheUsage)
    Factory method to create a user profile.
    static void
    delete(de.uplanet.jdbc.JdbcConnection p_conn, String p_strNamePrefix)
    Delete all profile properties whose names start with the specified prefix.
    static void
    delete(de.uplanet.jdbc.JdbcConnection p_conn, String p_strNamePrefix, String p_strUserGuid)
    Delete all profile properties whose names start with the specified prefix.
    static void
    deleteExceptForDefaultUser(de.uplanet.jdbc.JdbcConnection p_conn, String p_strNamePrefix)
    Delete all profile properties that do not belong to the default user and whose names start with the specified prefix.
    void
     
    get(String p_strName)
    Get a user profile property.
    <T> T
    get(String p_strName, T p_objDefault)
    Get a user profile property.
    getDefault(String p_strName)
    Get a default profile property.
    <T> T
    getDefault(String p_strName, T p_objDefault)
    Get a default profile property.
     
    <T> T
    getUserDefined(String p_strName, T p_objDefault)
     
    void
    put(String p_strName, Object p_objValue)
    Set a user profile property.
    void
    putDefault(String p_strName, Object p_objValue)
    Set a default profile property.
    boolean
    Check if the current user overrides the given property.
    boolean
    userOverridesProperty(String p_strName, String p_strUserId)
    Check if a given user overrides the given property.

    Von Klasse geerbte Methoden java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Methodendetails

    • createInstance

      public static UserProfile createInstance(de.uplanet.jdbc.JdbcConnection p_conn, String p_strUserId, int p_iCacheUsage)
      Factory method to create a user profile.
      Parameter:
      p_conn - An open database connection.
      p_strUserId - The ID of the user for whom the profile should be created.
      p_iCacheUsage - IUserProfile.NO_CACHE or IUserProfile.USE_CACHE.
      Gibt zurück:
      A newly created user profile.
      Löst aus:
      UnsupportedOperationException - If an invalid cache flag is supplied.
    • getUserDefined

      public Object getUserDefined(String p_strName)
      Angegeben von:
      getUserDefined in Schnittstelle de.uplanet.lucy.server.profile.IUserProfile
    • getUserDefined

      public <T> T getUserDefined(String p_strName, T p_objDefault)
      Angegeben von:
      getUserDefined in Schnittstelle de.uplanet.lucy.server.profile.IUserProfile
    • get

      public Object get(String p_strName)
      Get a user profile property.
      Angegeben von:
      get in Schnittstelle de.uplanet.lucy.server.profile.IUserProfile
      Parameter:
      p_strName - The name of the property to be retrieved.
      Gibt zurück:
      The property or IUserProfile.NO_PROP_RET_VAL if the property does not exist or IUserProfile.ERR_RET_VAL if an error occurred.
    • get

      public <T> T get(String p_strName, T p_objDefault)
      Get a user profile property.

      If the specified property does not exist or any error occurs while retrieving the property, the specified fallback object is returned.

      Angegeben von:
      get in Schnittstelle de.uplanet.lucy.server.profile.IUserProfile
      Parameter:
      p_strName - The name of the property to be retrieved.
      p_objDefault - The property to be returned in error conditions.
      Gibt zurück:
      The property or p_objDefault if the property does not exist or if an error occurred.
    • getDefault

      public Object getDefault(String p_strName)
      Get a default profile property.
      Angegeben von:
      getDefault in Schnittstelle de.uplanet.lucy.server.profile.IUserProfile
      Parameter:
      p_strName - The name of the property to be retrieved.
      Gibt zurück:
      The property or IUserProfile.NO_PROP_RET_VAL if the property does not exist or IUserProfile.ERR_RET_VAL if an error occurred.
    • getDefault

      public <T> T getDefault(String p_strName, T p_objDefault)
      Get a default profile property.

      If the specified property does not exist or any error occurs while retrieving the property, the specified fallback object is returned.

      Angegeben von:
      getDefault in Schnittstelle de.uplanet.lucy.server.profile.IUserProfile
      Parameter:
      p_strName - The name of the property to be retrieved.
      p_objDefault - The property to be returned in error conditions.
      Gibt zurück:
      The property or p_objDefault if the property does not exist or if an error occurred.
    • put

      public void put(String p_strName, Object p_objValue)
      Set a user profile property.
      Angegeben von:
      put in Schnittstelle de.uplanet.lucy.server.profile.IUserProfile
      Parameter:
      p_strName - The name of the property.
      p_objValue - The value of the property.
    • putDefault

      public void putDefault(String p_strName, Object p_objValue)
      Set a default profile property.
      Angegeben von:
      putDefault in Schnittstelle de.uplanet.lucy.server.profile.IUserProfile
      Parameter:
      p_strName - The name of the property.
      p_objValue - The value of the property.
    • userOverridesProperty

      public boolean userOverridesProperty(String p_strName)
      Check if the current user overrides the given property.
      Angegeben von:
      userOverridesProperty in Schnittstelle de.uplanet.lucy.server.profile.IUserProfile
      Parameter:
      p_strName - The name of the property.
      Gibt zurück:
      true if the current user overrides the property, or false otherwise.
    • userOverridesProperty

      public boolean userOverridesProperty(String p_strName, String p_strUserId)
      Check if a given user overrides the given property.
      Angegeben von:
      userOverridesProperty in Schnittstelle de.uplanet.lucy.server.profile.IUserProfile
      Parameter:
      p_strName - The name of the property.
      p_strUserId - The ID of a specific user.
      Gibt zurück:
      true if the given user overrides the property, or false otherwise.
    • delete

      public static void delete(de.uplanet.jdbc.JdbcConnection p_conn, String p_strNamePrefix)
      Delete all profile properties whose names start with the specified prefix.
      Parameter:
      p_conn - The database connection to be used.
      p_strNamePrefix - The property name prefix.
    • delete

      public static void delete(de.uplanet.jdbc.JdbcConnection p_conn, String p_strNamePrefix, String p_strUserGuid)
      Delete all profile properties whose names start with the specified prefix.
      Parameter:
      p_conn - The database connection to be used.
      p_strNamePrefix - The property name prefix.
      p_strUserGuid - The guid of the user
    • deleteExceptForDefaultUser

      public static void deleteExceptForDefaultUser(de.uplanet.jdbc.JdbcConnection p_conn, String p_strNamePrefix)
      Delete all profile properties that do not belong to the default user and whose names start with the specified prefix.
      Parameter:
      p_conn - The database connection to be used.
      p_strNamePrefix - The property name prefix.
    • done

      public void done()
      Angegeben von:
      done in Schnittstelle de.uplanet.lucy.server.profile.IUserProfile
    • close

      public void close()
      This method does nothing.
      Angegeben von:
      close in Schnittstelle AutoCloseable
      Angegeben von:
      close in Schnittstelle de.uplanet.lucy.server.profile.IUserProfile