com.plumtree.portaluiinfrastructure.login
Class PTPersonalSettingsHelper

java.lang.Object
  extended by com.plumtree.portaluiinfrastructure.login.PTPersonalSettingsHelper

public class PTPersonalSettingsHelper
extends java.lang.Object

This class handles getting and setting personal settings using the plumtree session info object.


Field Summary
static java.lang.String ACCESS_STYLE_COOKIE_NAME
          Access Style Cookie name
static java.lang.String LOCALE_USE_BROWSER_SETTING
          Use Browser Setting ID (Locale)
static java.lang.String LOCALE_USE_DEFAULT_SETTING
          Use Default Setting ID (Locale)
 
Constructor Summary
PTPersonalSettingsHelper()
           
 
Method Summary
static void CachePersonalSettings(AActivitySpace aSpace, IApplication application, XPResourceManager rm, ApplicationData appData)
          Call this method to cache all personal settings on the session.
static void CachePersonalSettings(ISessionManager sessionManager, IApplication application, IPTSession ptSession, XPResourceManager rm, ApplicationData appData)
          Caches all settings to the IPTSession as well as the HTTPSession.
static boolean DoesPrefsSubSessionExist(AActivitySpace asSpace)
          Call this method to determine if the subsession for caching personal settings exists in the specified ISessionManager.
static java.lang.Object FindPersonalSetting(java.lang.Object[][] oaSettings, java.lang.String sName)
          Call this method to find the value associated with given setting name.
static java.lang.String GetDefaultLocale(IApplication application)
          This helper method determines the fall back default locale, assuming that the locale could not be determined by the browser settings.
static XPDateFormat GetPersonalDateTimeFormat(AActivitySpace _asSpace, boolean _localizedToUsersTimeZone)
          This method returns an XPDateFormat in the user's current locale and timezone.
static XPLocale GetPersonalSettingValue_Locale(AActivitySpace _asSpace)
          This method returns an XPLocale object created from the current user's locale.
static XPTimeZone GetPersonalSettingValue_TimeZone(AActivitySpace _asSpace)
          This method returns an XPTimeZone object created from the current user's time zone.
static java.lang.Object GetPersonalSettingValue(java.lang.String sSettingName, AActivitySpace asSpace)
          Call this method to obtain the value of a personal setting.
static java.lang.Object GetPersonalSettingValue(java.lang.String sSettingName, ISessionManager sessionManager, IApplication application, IPTSession ptSession)
          Only use this version of this function if you do not have an AActivitySpace.
static IPTSession GetPTSession(AActivitySpace asSpace)
          Method GetPTSession.
static XPArrayList GetSettingsToCache(IApplication app)
          Retrieve the individual settings to cache in the lower-level HTTPSession as opposed to the higher-level IPTSessionInfo.
static boolean IsLocaleSupported(java.lang.String strLocale, XPResourceManager rm)
          This method determines whether or not the supplied locale matches one of the languages that this server can actually display.
static void RemovePersonalSetting(java.lang.String sSettingName, AActivitySpace asSpace)
          Call this method to find the remove the specified setting from the DB

static void SetAndCachePersonalSetting(java.lang.String sSettingName, java.lang.Object oSettingVal, AActivitySpace asSpace)
          Call this method to set a personal setting name value pair on the portal server, and update the session cache of personal settings.
static void SetAndCachePersonalSetting(java.lang.String sSettingName, java.lang.Object oSettingVal, IPTSession ptSession, ISessionManager sessionManager, IApplication app, XPResourceManager rm)
          This method stores a personal setting on the HTTP Session and in the DB.
static void SetPersonalSetting(java.lang.String sSettingName, java.lang.Object oSettingVal, IPTSession ptSession, ISessionManager sessionManager, IApplication app, XPResourceManager rm)
          This method stores a personal setting on the HTTP Session, but not in the DB.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACCESS_STYLE_COOKIE_NAME

public static final java.lang.String ACCESS_STYLE_COOKIE_NAME
Access Style Cookie name

See Also:
Constant Field Values

LOCALE_USE_BROWSER_SETTING

public static final java.lang.String LOCALE_USE_BROWSER_SETTING
Use Browser Setting ID (Locale)

See Also:
Constant Field Values

LOCALE_USE_DEFAULT_SETTING

public static final java.lang.String LOCALE_USE_DEFAULT_SETTING
Use Default Setting ID (Locale)

See Also:
Constant Field Values
Constructor Detail

PTPersonalSettingsHelper

public PTPersonalSettingsHelper()
Method Detail

CachePersonalSettings

public static void CachePersonalSettings(AActivitySpace aSpace,
                                         IApplication application,
                                         XPResourceManager rm,
                                         ApplicationData appData)
Call this method to cache all personal settings on the session.

This method will also set the session language on the Plumtree server.

Parameters:
AActivitySpace -
IApplication -
XPResourceManager -

CachePersonalSettings

public static void CachePersonalSettings(ISessionManager sessionManager,
                                         IApplication application,
                                         IPTSession ptSession,
                                         XPResourceManager rm,
                                         ApplicationData appData)
Caches all settings to the IPTSession as well as the HTTPSession.

This method will also set the session language on the Plumtree server.

Parameters:
ISessionManager -
IApplication -
IPTSession -
XPResourceManager -

DoesPrefsSubSessionExist

public static boolean DoesPrefsSubSessionExist(AActivitySpace asSpace)
Call this method to determine if the subsession for caching personal settings exists in the specified ISessionManager.

Parameters:
ISessionManager -

FindPersonalSetting

public static java.lang.Object FindPersonalSetting(java.lang.Object[][] oaSettings,
                                                   java.lang.String sName)
Call this method to find the value associated with given setting name.

Parameters:
oaSettings - Pass an Object[][] obtained from LookupPersonalSettings
String - name of setting

RemovePersonalSetting

public static void RemovePersonalSetting(java.lang.String sSettingName,
                                         AActivitySpace asSpace)
Call this method to find the remove the specified setting from the DB

Parameters:
oaSettings - Pass an Object[][] obtained from LookupPersonalSettings
String - name of setting

GetPersonalSettingValue

public static java.lang.Object GetPersonalSettingValue(java.lang.String sSettingName,
                                                       AActivitySpace asSpace)
Call this method to obtain the value of a personal setting.

This value will be retrieved from the user's web session if possible, otherwise the portal server will be queried.

Parameters:
sSettingName - String name of personal setting
as - AActivitySpace
Throws:
XPException - This method will throw an XPException if you do not pass an ISessionManager already containing the correct subSession. The ISessionManager obtained from your Activity Space will contain the correct subsession.

GetPersonalSettingValue

public static java.lang.Object GetPersonalSettingValue(java.lang.String sSettingName,
                                                       ISessionManager sessionManager,
                                                       IApplication application,
                                                       IPTSession ptSession)
Only use this version of this function if you do not have an AActivitySpace.

This value will be retrieved from the user's web session if possible, otherwise the portal server will be queried.

Parameters:
sSettingName - String name of personal setting
sessionManager - ISessionManager
ptSession - IPTSession
Throws:
XPException - This method will throw an XPException if you do not pass an ISessionManager already containing the correct subSession. The ISessionManager obtained from your Activity Space will contain the correct subsession.

GetPersonalSettingValue_Locale

public static XPLocale GetPersonalSettingValue_Locale(AActivitySpace _asSpace)
This method returns an XPLocale object created from the current user's locale. If that cannot be done, then it returns an XPLocale made from the default locale.

Parameters:
_asSpace - The current Activity Space.
Returns:
The XPLocale.

GetPersonalSettingValue_TimeZone

public static XPTimeZone GetPersonalSettingValue_TimeZone(AActivitySpace _asSpace)
This method returns an XPTimeZone object created from the current user's time zone. If that cannot be done, then it returns an XPTimeZone made from the default time zone.

Parameters:
_asSpace - The current Activity Space.
Returns:
The XPTimeZone.

GetPersonalDateTimeFormat

public static XPDateFormat GetPersonalDateTimeFormat(AActivitySpace _asSpace,
                                                     boolean _localizedToUsersTimeZone)
This method returns an XPDateFormat in the user's current locale and timezone. It's basically a wrapper around GetPersonalSettingValue_Locale and GetPersonalSettingValue_TimeZone.


GetSettingsToCache

public static XPArrayList GetSettingsToCache(IApplication app)
Retrieve the individual settings to cache in the lower-level HTTPSession as opposed to the higher-level IPTSessionInfo. Defined in x_config.xml

Parameters:
app - Application object
Returns:
Hashmap of settings to be cached

SetAndCachePersonalSetting

public static void SetAndCachePersonalSetting(java.lang.String sSettingName,
                                              java.lang.Object oSettingVal,
                                              AActivitySpace asSpace)
Call this method to set a personal setting name value pair on the portal server, and update the session cache of personal settings.

Parameters:
sSettingName - String name of personal setting
oSettingVal - Object value of personal setting
as - AActivitySpace Pass an AActivitySpace implementing IXPActivitySpace.
Throws:
XPException - This method may throw an XPException.

SetPersonalSetting

public static void SetPersonalSetting(java.lang.String sSettingName,
                                      java.lang.Object oSettingVal,
                                      IPTSession ptSession,
                                      ISessionManager sessionManager,
                                      IApplication app,
                                      XPResourceManager rm)
This method stores a personal setting on the HTTP Session, but not in the DB. It also handles setting the runtime settings in the server for language and locale if you try to set the locale. You should always set the Locale, which will automatically set the language, rather than just setting the language, which will allow the language and locale to get out of sync.

Parameters:
sSettingName - String name of personal setting
oSettingVal - Object value of personal setting
as - AActivitySpace Pass an AActivitySpace implementing IXPActivitySpace.
Throws:
XPException - This method may throw an XPException.

SetAndCachePersonalSetting

public static void SetAndCachePersonalSetting(java.lang.String sSettingName,
                                              java.lang.Object oSettingVal,
                                              IPTSession ptSession,
                                              ISessionManager sessionManager,
                                              IApplication app,
                                              XPResourceManager rm)
This method stores a personal setting on the HTTP Session and in the DB. It also handles setting the runtime settings in the server for language and locale if you try to set the locale. You should always set the Locale, which will automatically set the language, rather than just setting the language, which will allow the language and locale to get out of sync. Only call this version of this function if you don't have an AActivitySpace.

Parameters:
sSettingName - String name of personal setting
oSettingVal - Object value of personal setting
as - AActivitySpace Pass an AActivitySpace implementing IXPActivitySpace.
Throws:
XPException - This method may throw an XPException.

GetPTSession

public static IPTSession GetPTSession(AActivitySpace asSpace)
Method GetPTSession. Gets IPTSession from AActivitySpace cleanly.

Parameters:
as -
Returns:
IPTSession

GetDefaultLocale

public static java.lang.String GetDefaultLocale(IApplication application)
This helper method determines the fall back default locale, assuming that the locale could not be determined by the browser settings. This method will not return UseBrowser as a locale.

Parameters:
application -
Returns:
the default locale

IsLocaleSupported

public static boolean IsLocaleSupported(java.lang.String strLocale,
                                        XPResourceManager rm)
This method determines whether or not the supplied locale matches one of the languages that this server can actually display.

Parameters:
strLocale -
rm -
Returns:
true implies the locale is supported



Copyright © 2002,2003,2004,2005 Plumtree Software, Inc., All Rights Reserved.