com.filenet.wcm.toolkit.server.util
Class ClientTimeZoneUtil

java.lang.Object
  extended bycom.filenet.wcm.toolkit.server.util.ClientTimeZoneUtil

public class ClientTimeZoneUtil
extends java.lang.Object


Field Summary
static java.lang.String BROWSER_OFFSET1_KEY
           
static java.lang.String BROWSER_OFFSET2_KEY
           
static java.lang.String BROWSER_TIME1_KEY
           
static java.lang.String BROWSER_TIME2_KEY
           
static java.lang.String CLIENT_TIME_ZONE_ID
           
protected static java.lang.String TZ_QUERY_FORM_NAME
           
 
Constructor Summary
ClientTimeZoneUtil()
           
 
Method Summary
static void configureBrowserTimeZone(javax.servlet.http.HttpServletRequest req, java.util.Map parameters, java.util.Locale clientLocale, WcmDataStore dataStore)
          Configures the browser TimeZone object based on information passed back from the client browser (either applet or a JavaScript form, and stores it in the datastore.
static void configureClientTimeZone(javax.servlet.http.HttpServletRequest req, java.util.Map parameters, java.util.Locale clientLocale, WcmDataStore dataStore)
          Configures the client TimeZone object based on information passed back from the client browser, and stores it in the datastore.
static void configureClientTimeZone(javax.servlet.http.HttpServletRequest req, java.util.Map parameters, java.util.Locale clientLocale, WcmDataStore dataStore, boolean forceRefresh)
          Configures the client TimeZone object based on information passed back from the client browser, and stores it in the datastore.
static java.util.TimeZone getBrowserTimeZone(WcmDataStore ds)
          Gets the browser TimeZone from the datastore.
static java.util.TimeZone getClientTimeZone(WcmDataStore ds, java.util.TimeZone defaultTimeZone)
          Gets the client TimeZone from the datastore.
static java.util.TimeZone getTimeZone(java.lang.String timeZoneID)
           
static java.lang.String getTimeZoneHiddenFields(java.lang.String formName, java.lang.String extraScript)
          Return a set of hidden fields that can be included in an HTML form, to support retrieval of the browser machine's timezone information when needed.
static java.lang.String getTimeZoneParameter(javax.servlet.http.HttpServletRequest request, java.util.Map parameters, java.lang.String key)
           
static boolean isClientTimeZoneDefined(WcmDataStore ds)
          Indicates whether or not the client TimeZone object exists in the datastore.
static boolean isTimeZoneExplicit(WcmDataStore ds)
          Returns true if the client timezone explicit flag is set.
static boolean queryBrowserTimeZone(WcmDataStore dataStore, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String windowId, java.lang.String eventTarget, java.lang.String eventName)
          Retrieve the browser timezone by writing a hidden form to the browser and submitting it.
static void setBrowserTimeZone(WcmDataStore ds, java.util.TimeZone clientTimeZone)
          Set the browser TimeZone object in the datastore.
static void setClientTimeZone(WcmDataStore ds, java.util.TimeZone clientTimeZone)
          Set the client TimeZone object in the datastore.
static void setClientTimeZone(WcmDataStore ds, java.util.TimeZone clientTimeZone, boolean isExplicit)
          Set the client TimeZone object in the datastore.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BROWSER_TIME1_KEY

public static java.lang.String BROWSER_TIME1_KEY

BROWSER_TIME2_KEY

public static java.lang.String BROWSER_TIME2_KEY

BROWSER_OFFSET1_KEY

public static java.lang.String BROWSER_OFFSET1_KEY

BROWSER_OFFSET2_KEY

public static java.lang.String BROWSER_OFFSET2_KEY

CLIENT_TIME_ZONE_ID

public static java.lang.String CLIENT_TIME_ZONE_ID

TZ_QUERY_FORM_NAME

protected static final java.lang.String TZ_QUERY_FORM_NAME
See Also:
Constant Field Values
Constructor Detail

ClientTimeZoneUtil

public ClientTimeZoneUtil()
Method Detail

queryBrowserTimeZone

public static boolean queryBrowserTimeZone(WcmDataStore dataStore,
                                           javax.servlet.http.HttpServletRequest request,
                                           javax.servlet.http.HttpServletResponse response,
                                           java.lang.String windowId,
                                           java.lang.String eventTarget,
                                           java.lang.String eventName)
                                    throws java.lang.Exception
Retrieve the browser timezone by writing a hidden form to the browser and submitting it. The page as identified in the request object is reloaded with the browser timezone parameters included. The caller can optionally define a targeted or global event to fire with the data if desired. Return true if the form was written to query for browser timezone. The query is done only if the client timezone has not already been captured, and if the current request does not contain the browser timezone parameters.

Parameters:
dataStore - - The dataStore object for this session.
request - - The request object. The URL of this request object is used as the form action URL.
response - - The response object.
windowId - - The windowId to encode on the form action (optional).
eventTarget - - The target UI module name for a targeted event (optional).
eventName - - The event name for a targeted or global event (optional).
Returns:
True if the form was written, false if not.
Throws:
java.lang.Exception

getTimeZoneHiddenFields

public static java.lang.String getTimeZoneHiddenFields(java.lang.String formName,
                                                       java.lang.String extraScript)
Return a set of hidden fields that can be included in an HTML form, to support retrieval of the browser machine's timezone information when needed. These hidden fields are populated by the JavaScript returned from getTimeZoneQueryJavaScript So that when the form is submitted, the information is sent back to the server.

Returns:
A String of HTML.

isClientTimeZoneDefined

public static boolean isClientTimeZoneDefined(WcmDataStore ds)
Indicates whether or not the client TimeZone object exists in the datastore.

Parameters:
ds - The datastore
Returns:
True if the TimeZone object exists.

getTimeZone

public static java.util.TimeZone getTimeZone(java.lang.String timeZoneID)

getClientTimeZone

public static java.util.TimeZone getClientTimeZone(WcmDataStore ds,
                                                   java.util.TimeZone defaultTimeZone)
                                            throws java.lang.Exception
Gets the client TimeZone from the datastore. If the client timezone has not been configured and no default timezone is specified, this method will throw an exception.

Parameters:
ds - The datastore
defaultTimeZone - The default timezone to use if the client timezone is not defined.
Returns:
The TimeZone object if defined, otherwise null.
Throws:
java.lang.Exception

getBrowserTimeZone

public static java.util.TimeZone getBrowserTimeZone(WcmDataStore ds)
                                             throws java.lang.Exception
Gets the browser TimeZone from the datastore. If the client timezone has not been configured , this method will throw an exception.

Parameters:
ds - The datastore
Returns:
The TimeZone object.
Throws:
java.lang.Exception

isTimeZoneExplicit

public static boolean isTimeZoneExplicit(WcmDataStore ds)
Returns true if the client timezone explicit flag is set.

Parameters:
ds -
Returns:

getTimeZoneParameter

public static java.lang.String getTimeZoneParameter(javax.servlet.http.HttpServletRequest request,
                                                    java.util.Map parameters,
                                                    java.lang.String key)

configureClientTimeZone

public static void configureClientTimeZone(javax.servlet.http.HttpServletRequest req,
                                           java.util.Map parameters,
                                           java.util.Locale clientLocale,
                                           WcmDataStore dataStore)
                                    throws WcmException
Configures the client TimeZone object based on information passed back from the client browser, and stores it in the datastore.

Parameters:
req - The request containing the browser timezone info key/values (optional). If set to null, parameters must be specified.
parameters - The map containing the browser timezone info key/values (optional). If set to null, req must be specified.
dataStore -
Throws:
WcmException

configureClientTimeZone

public static void configureClientTimeZone(javax.servlet.http.HttpServletRequest req,
                                           java.util.Map parameters,
                                           java.util.Locale clientLocale,
                                           WcmDataStore dataStore,
                                           boolean forceRefresh)
                                    throws WcmException
Configures the client TimeZone object based on information passed back from the client browser, and stores it in the datastore.

Parameters:
req - The request containing the browser timezone info key/values (optional). If set to null, parameters must be specified.
parameters - The map containing the browser timezone info key/values (optional). If set to null, req must be specified.
dataStore -
forceRefresh - Store new timezone information even if it is already set in the session.
Throws:
WcmException

configureBrowserTimeZone

public static void configureBrowserTimeZone(javax.servlet.http.HttpServletRequest req,
                                            java.util.Map parameters,
                                            java.util.Locale clientLocale,
                                            WcmDataStore dataStore)
                                     throws WcmException
Configures the browser TimeZone object based on information passed back from the client browser (either applet or a JavaScript form, and stores it in the datastore.

Parameters:
req - The request containing the browser timezone info key/values (optional). If set to null, parameters must be specified.
parameters - The map containing the browser timezone info key/values (optional). If set to null, req must be specified.
dataStore -
Throws:
WcmException

setClientTimeZone

public static void setClientTimeZone(WcmDataStore ds,
                                     java.util.TimeZone clientTimeZone)
                              throws WcmException
Set the client TimeZone object in the datastore.

Parameters:
clientTimeZone -
Throws:
WcmException

setBrowserTimeZone

public static void setBrowserTimeZone(WcmDataStore ds,
                                      java.util.TimeZone clientTimeZone)
                               throws WcmException
Set the browser TimeZone object in the datastore. This setting is always independent from user selection.

Parameters:
clientTimeZone -
Throws:
WcmException

setClientTimeZone

public static void setClientTimeZone(WcmDataStore ds,
                                     java.util.TimeZone clientTimeZone,
                                     boolean isExplicit)
                              throws WcmException
Set the client TimeZone object in the datastore.

Parameters:
clientTimeZone -
isExplicit - - Sets the explicit flag for the specified timezone.
Throws:
WcmException


© Copyright IBM Corp. 2002, 2007. All Rights Reserved.