Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle WebCenter
11g Release 1 (11.1.1.3.0)
E15995-02


oracle.webcenter.generalsettings.model
Class DateFormatSetting

java.lang.Object
  extended by oracle.webcenter.generalsettings.internal.model.GSPreferences
      extended by oracle.webcenter.generalsettings.model.DateFormatSetting


public class DateFormatSetting
extends oracle.webcenter.generalsettings.internal.model.GSPreferences

Shared Preferences for 'Date Style/Format' and 'Time Style/Format' Settings.


Nested Class Summary
static class DateFormatSetting.DateTimeStyle
          The date and time styles to be used in the application.

 

Field Summary
static DateFormatSetting.DateTimeStyle DEFAULT_DATE_STYLE
          The default date style when no preference exists (DateTypeStyle.SHORT).
static DateFormatSetting.DateTimeStyle DEFAULT_TIME_STYLE
          The default time style when no preference exists (DateTypeStyle.SHORT).
static java.lang.String PREFERRED_DATE_PATTERN_KEY
          Internal preference key used to store the date pattern preference.
static java.lang.String PREFERRED_DATE_STYLE_KEY
          Internal preference key used to store the date style preference.
static java.lang.String PREFERRED_DATETIME_PATTERN_KEY
          Internal preference key used to store the date-time pattern preference.
static java.lang.String PREFERRED_TIME_PATTERN_KEY
          Internal preference key used to store the time pattern preference.
static java.lang.String PREFERRED_TIME_STYLE_KEY
          Internal preference key used to store the time style preference.
static java.lang.String TYPE_BOTH
          Used in getPreferredPatternByType() to indicate to return the preferred time and date pattern.
static java.lang.String TYPE_DATE
          Used in getPreferredPatternByType() to indicate to return the preferred date pattern.
static java.lang.String TYPE_TIME
          Used in getPreferredPatternByType() to indicate to return the preferred time pattern.

 

Fields inherited from class oracle.webcenter.generalsettings.internal.model.GSPreferences
NULL_VALUE

 

Constructor Summary
DateFormatSetting()
           

 

Method Summary
static java.lang.String getDatePattern()
          Returns the user's preferred date format pattern if it has been set, else, returns null.
static DateFormatSetting.DateTimeStyle getDateStyle()
          Returns the user's preferred date style or a default value if no preference exists.
static java.text.DateFormat getDateTimeFormatter()
          Get a DateFormat object with the user's preferred timezone applied, to format a date/time in the user's preferred date and time format.
static java.lang.String getDateTimePattern()
          If both a date and time pattern preference exist then returns a pattern representing datePattern+timePattern, if either or both are null, returns null.
static java.lang.String getFormattedCurrentDate()
          Get the current date, with the user's preferred timezone applied, and formatted in the user's preferred date format.
static java.lang.String getFormattedCurrentDateTime()
          Get the current date and time, with the user's preferred timezone applied, and formatted in the user's preferred date and time format.
static java.lang.String getFormattedCurrentTime()
          Get the current time, with the user's preferred timezone applied, and formatted in the user's preferred time format.
static java.lang.String getFormattedDate(java.util.Date date)
          Get the given date, with the user's preferred timezone applied, and formatted in the user's preferred date format.
static java.lang.String getFormattedDateTime(java.util.Calendar dateTime)
          Get the given date and time, with the user's preferred timezone applied, and formatted in the user's preferred date and time format.
static java.lang.String getFormattedDateTime(java.util.Date dateTime)
          Get the given date and time, with the user's preferred timezone applied, and formatted in the user's preferred date and time format.
static java.lang.String getFormattedTime(java.util.Date time)
          Get the given time, with the user's preferred timezone applied, and formatted in the user's preferred time format.
static java.lang.String getPreferredPatternByType(java.lang.String type)
          Get the preferred pattern based on the given 'type' parameter value.
static java.lang.String getSystemDatePatternPreference()
          Return the system date format pattern preference or null if no preference exists.
static DateFormatSetting.DateTimeStyle getSystemDateStylePreference()
          Return the system date style preference or null if no preference exists.
static java.lang.String getSystemTimePatternPreference()
          Return the system time pattern preference or null if no preference exists.
static DateFormatSetting.DateTimeStyle getSystemTimeStylePreference()
          Return the system time style preference or null if no preference exists.
static java.lang.String getTimePattern()
          Get the user's preferred time pattern if it has been set, otherwise return null.
static DateFormatSetting.DateTimeStyle getTimeStyle()
          Returns the user's preferred time style or a default value if no preference exists.
static java.text.DateFormat getUserDateFormat()
          Returns a DateFormat based on the user's date style preference, locale and TimeZone.
static java.lang.String getUserDatePatternPreference()
          Returns the user's date format pattern preference or null if no preference exists.
static DateFormatSetting.DateTimeStyle getUserDateStylePreference()
          Return the user's date style preference or null if no preference exists for the the user.
static java.text.DateFormat getUserDateTimeFormat()
          Returns a DateFormat based on the user's date and time style preference, locale and TimeZone.
static java.lang.String getUserDateTimePatternPreference()
          Gets the user's combined date-time format pattern preference, or null if it is not set.
static java.text.DateFormat getUserTimeFormat()
          Returns a DateFormat based on the user's time style preference, locale and TimeZone.
static java.lang.String getUserTimePatternPreference()
          Return the user's time format pattern preference or null if no preference exists for the the user.
static DateFormatSetting.DateTimeStyle getUserTimeStylePreference()
          Return the user's time style preference or null if no preference exists for the the user.
static void setSystemDatePatternPreference(java.lang.String pattern)
          Set the default date format pattern for the application.
static void setSystemDateStylePreference(DateFormatSetting.DateTimeStyle dateStyle)
          Set the default date style for the application.
static void setSystemTimePatternPreference(java.lang.String pattern)
          Set the default time format pattern for the application.
static void setSystemTimeStylePreference(DateFormatSetting.DateTimeStyle timeStyle)
          Set the default time style for the application.
static void setUserDatePatternPreference(java.lang.String pattern)
          Set the preferred date format pattern for the current user.
static void setUserDateStylePreference(DateFormatSetting.DateTimeStyle dateStyle)
          Set the preferred date style for the current user.
static void setUserDateTimePatternPreference(java.lang.String pattern)
          Sets the user's combined date-time format pattern preference.
static void setUserTimePatternPreference(java.lang.String pattern)
          Sets the user's preferred time pattern preference to the given pattern.
static void setUserTimeStylePreference(DateFormatSetting.DateTimeStyle timeStyle)
          Set the preferred time style preference for the current user.

 

Methods inherited from class oracle.webcenter.generalsettings.internal.model.GSPreferences
getPreferred, getProvider, getSystemPref, getUserPref, setSystemPref, setUserPref

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

PREFERRED_TIME_STYLE_KEY

public static final java.lang.String PREFERRED_TIME_STYLE_KEY
Internal preference key used to store the time style preference.
See Also:
Constant Field Values

PREFERRED_DATE_STYLE_KEY

public static final java.lang.String PREFERRED_DATE_STYLE_KEY
Internal preference key used to store the date style preference.
See Also:
Constant Field Values

PREFERRED_TIME_PATTERN_KEY

public static final java.lang.String PREFERRED_TIME_PATTERN_KEY
Internal preference key used to store the time pattern preference.
See Also:
Constant Field Values

PREFERRED_DATE_PATTERN_KEY

public static final java.lang.String PREFERRED_DATE_PATTERN_KEY
Internal preference key used to store the date pattern preference.
See Also:
Constant Field Values

PREFERRED_DATETIME_PATTERN_KEY

public static final java.lang.String PREFERRED_DATETIME_PATTERN_KEY
Internal preference key used to store the date-time pattern preference.
See Also:
Constant Field Values

TYPE_DATE

public static final java.lang.String TYPE_DATE
Used in getPreferredPatternByType() to indicate to return the preferred date pattern.
See Also:
getPreferredPatternByType(String), Constant Field Values

TYPE_TIME

public static final java.lang.String TYPE_TIME
Used in getPreferredPatternByType() to indicate to return the preferred time pattern.
See Also:
getPreferredPatternByType(String), Constant Field Values

TYPE_BOTH

public static final java.lang.String TYPE_BOTH
Used in getPreferredPatternByType() to indicate to return the preferred time and date pattern.
See Also:
getPreferredPatternByType(String), Constant Field Values

DEFAULT_DATE_STYLE

public static final DateFormatSetting.DateTimeStyle DEFAULT_DATE_STYLE
The default date style when no preference exists (DateTypeStyle.SHORT).

DEFAULT_TIME_STYLE

public static final DateFormatSetting.DateTimeStyle DEFAULT_TIME_STYLE
The default time style when no preference exists (DateTypeStyle.SHORT).

Constructor Detail

DateFormatSetting

public DateFormatSetting()

Method Detail

getTimeStyle

public static DateFormatSetting.DateTimeStyle getTimeStyle()
Returns the user's preferred time style or a default value if no preference exists. This method will never return a null. It will return :- This API should be used to get the user's preferred DateTimeStyle enum object for the Time component from which can be obtained the 'short', 'medium', 'long', 'full' setting. The value returned by the getValue() method of DateTimeStyle can be used directly in the timeStyle attribute of af:convertDateTime or f:convertDateTime tags. This value, along with an appropriate value for the locale attribute, will format/parse your date output/input in accordance with the current Locale.
Returns:
The time style preference if one exists, or a default value.

getTimePattern

public static java.lang.String getTimePattern()
Get the user's preferred time pattern if it has been set, otherwise return null.
Returns:
time pattern if it has been set, else null

getUserTimeStylePreference

public static DateFormatSetting.DateTimeStyle getUserTimeStylePreference()
Return the user's time style preference or null if no preference exists for the the user. This API is designed for use in a user preference setting UI, for other uses, the getTimeStyle() API should be used.
Returns:
The user's time style preference or null if no preference exists for the user.

getUserTimePatternPreference

public static java.lang.String getUserTimePatternPreference()
Return the user's time format pattern preference or null if no preference exists for the the user. This API is designed for use in a user preference setting UI, for other uses, the getTimePattern() API should be used.
Returns:
The user's time pattern preference or null if no preference exists for the user.

setUserTimeStylePreference

public static void setUserTimeStylePreference(DateFormatSetting.DateTimeStyle timeStyle)
Set the preferred time style preference for the current user.
Parameters:
timeStyle - the time style string chosen by the user

setUserTimePatternPreference

public static void setUserTimePatternPreference(java.lang.String pattern)
Sets the user's preferred time pattern preference to the given pattern.
Parameters:
pattern - the time pattern to set

getSystemTimeStylePreference

public static DateFormatSetting.DateTimeStyle getSystemTimeStylePreference()
Return the system time style preference or null if no preference exists.
Returns:
The system time style preference or null if no preference exists

getSystemTimePatternPreference

public static java.lang.String getSystemTimePatternPreference()
Return the system time pattern preference or null if no preference exists.
Returns:
The system time pattern preference or null if no preference exists

setSystemTimeStylePreference

public static void setSystemTimeStylePreference(DateFormatSetting.DateTimeStyle timeStyle)
Set the default time style for the application.
Parameters:
timeStyle - the system time format preference for the application

setSystemTimePatternPreference

public static void setSystemTimePatternPreference(java.lang.String pattern)
Set the default time format pattern for the application.
Parameters:
pattern - the system time format pattern preference for the application

getDateStyle

public static DateFormatSetting.DateTimeStyle getDateStyle()
Returns the user's preferred date style or a default value if no preference exists. This method will never return a null. It will return :- This API should be used to get the user's preferred DateTimeStyle enum object for the Date component from which can be obtained the 'short', 'medium', 'long', 'full' setting. The value returned by the getValue() method of DateTimeStyle can be used directly in the timeStyle attribute of af:convertDateTime or f:convertDateTime tags. This value, along with an appropriate value for the locale attribute, will format/parse your date output/input in accordance with the current Locale.
Returns:
The date style preference if one exists, or a default value.

getDatePattern

public static java.lang.String getDatePattern()
Returns the user's preferred date format pattern if it has been set, else, returns null.
Returns:
preferred date format pattern if set, else returns null

getUserDateStylePreference

public static DateFormatSetting.DateTimeStyle getUserDateStylePreference()
Return the user's date style preference or null if no preference exists for the the user. This API is designed for use in a user preference setting UI, for other uses, the getDateStyle() API should be used.
Returns:
The user's date style preference or null if no preference exists for the user.

getUserDatePatternPreference

public static java.lang.String getUserDatePatternPreference()
Returns the user's date format pattern preference or null if no preference exists. This API is designed for use in a user preference setting UI, for other uses, the getDatePattern() API should be used.
Returns:
The user's date pattern preference or null if no preference exists for the user.

setUserDateStylePreference

public static void setUserDateStylePreference(DateFormatSetting.DateTimeStyle dateStyle)
Set the preferred date style for the current user.
Parameters:
dateStyle - the time style string chosen by the user

setUserDatePatternPreference

public static void setUserDatePatternPreference(java.lang.String pattern)
Set the preferred date format pattern for the current user.
Parameters:
pattern - the time pattern string chosen by the user

getSystemDateStylePreference

public static DateFormatSetting.DateTimeStyle getSystemDateStylePreference()
Return the system date style preference or null if no preference exists.
Returns:
The system date style preference or null if no preference exists.

getSystemDatePatternPreference

public static java.lang.String getSystemDatePatternPreference()
Return the system date format pattern preference or null if no preference exists.
Returns:
The system date pattern preference or null if no preference exists.

setSystemDateStylePreference

public static void setSystemDateStylePreference(DateFormatSetting.DateTimeStyle dateStyle)
Set the default date style for the application.
Parameters:
dateStyle - the system date style preference for the application

setSystemDatePatternPreference

public static void setSystemDatePatternPreference(java.lang.String pattern)
Set the default date format pattern for the application.
Parameters:
pattern - the system date format pattern preference for the application

getDateTimePattern

public static java.lang.String getDateTimePattern()
If both a date and time pattern preference exist then returns a pattern representing datePattern+timePattern, if either or both are null, returns null.
Returns:
if datePattern and timePattern exist, then return datePattern+timePattern, else null

setUserDateTimePatternPreference

public static void setUserDateTimePatternPreference(java.lang.String pattern)
Sets the user's combined date-time format pattern preference.
Parameters:
pattern - the combined date-time format pattern to set

getUserDateTimePatternPreference

public static java.lang.String getUserDateTimePatternPreference()
Gets the user's combined date-time format pattern preference, or null if it is not set.
Returns:
the user's combined date-time format pattern preference value, or null if it is not set

getUserDateFormat

public static java.text.DateFormat getUserDateFormat()
Returns a DateFormat based on the user's date style preference, locale and TimeZone. If there is no preference, the DateFormat is based on the DEFAULT_DATE_STYLE.
Returns:
DateFormat based on the user's date style preference or the DEFAULT_DATE_STYLE if there is no preference.

getUserTimeFormat

public static java.text.DateFormat getUserTimeFormat()
Returns a DateFormat based on the user's time style preference, locale and TimeZone. If there is no preference, the DateFormat is based on the DEFAULT_TIME_STYLE.
Returns:
DateFormat based on the user's time style preference or the DEFAULT_TIME_STYLE if there is no preference.

getUserDateTimeFormat

public static java.text.DateFormat getUserDateTimeFormat()
Returns a DateFormat based on the user's date and time style preference, locale and TimeZone. If there is no preference, the DateFormat is based on the DEFAULT_DATE_STYLE and DEFAULT_TIME_STYLE.
Returns:
DateFormat based on the user's date and time style preference or the DEFAULT_DATE_STYLE and DEFAULT_TIME_STYLE if there is no preference.

getFormattedDate

public static java.lang.String getFormattedDate(java.util.Date date)
Get the given date, with the user's preferred timezone applied, and formatted in the user's preferred date format.
Returns:
A String representation of the given date.

getFormattedTime

public static java.lang.String getFormattedTime(java.util.Date time)
Get the given time, with the user's preferred timezone applied, and formatted in the user's preferred time format.
Returns:
A String representation of the given time.

getFormattedCurrentDate

public static java.lang.String getFormattedCurrentDate()
Get the current date, with the user's preferred timezone applied, and formatted in the user's preferred date format.
Returns:
A String representation of the current date.

getFormattedCurrentTime

public static java.lang.String getFormattedCurrentTime()
Get the current time, with the user's preferred timezone applied, and formatted in the user's preferred time format.
Returns:
A String representation of the current time.

getDateTimeFormatter

public static java.text.DateFormat getDateTimeFormatter()
Get a DateFormat object with the user's preferred timezone applied, to format a date/time in the user's preferred date and time format. This API can be used in preference to getFormattedDateTime() with the dateformatter used to format a set of date/times without having to look up the preference values each time.
Returns:
A DateFormatter to form date/times for the current user

getFormattedDateTime

public static java.lang.String getFormattedDateTime(java.util.Date dateTime)
Get the given date and time, with the user's preferred timezone applied, and formatted in the user's preferred date and time format.
Returns:
A String representation of the given date and time.

getFormattedDateTime

public static java.lang.String getFormattedDateTime(java.util.Calendar dateTime)
Get the given date and time, with the user's preferred timezone applied, and formatted in the user's preferred date and time format.
Returns:
A String representation of the given date and time.

getFormattedCurrentDateTime

public static java.lang.String getFormattedCurrentDateTime()
Get the current date and time, with the user's preferred timezone applied, and formatted in the user's preferred date and time format.
Returns:
A String representation of the current date and time.

getPreferredPatternByType

public static java.lang.String getPreferredPatternByType(java.lang.String type)
Get the preferred pattern based on the given 'type' parameter value. Valid values for 'type' are: date, time, and both.
Parameters:
type - one of 'date', 'time', or 'both' (see TYPE_ constants)
Returns:
the user's preferred pattern, else null if not set or the type is not recognized
See Also:
TYPE_DATE, TYPE_TIME, If not found, this API will return null.

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle WebCenter
11g Release 1 (11.1.1.3.0)
E15995-02


Copyright © 2009, 2010, Oracle. All rights reserved.