com.filenet.wcm.apps.server.presentation.util
Class FieldUtil

java.lang.Object
  extended bycom.filenet.wcm.apps.server.presentation.util.FieldUtil

public class FieldUtil
extends java.lang.Object

Utility class to support processing Data Field information from the Step/Launch processors.


Constructor Summary
FieldUtil()
           
 
Method Summary
 void clearExceptions()
          Clears all exceptions
static java.util.Date convertDateStringToDate(java.util.Locale locale, java.lang.String str)
          Parses the date string with W3C-formatted date and returns java Date object.
static java.lang.String formatDateDisplay(java.lang.String month, java.lang.String day, java.lang.String year, java.lang.String hour, java.lang.String minute, java.lang.String second, java.lang.String zone)
          Builds a Date string with the following format: "mm/dd/yyyy hh:mm:ss".
static java.lang.String formatDateISO(java.lang.String month, java.lang.String day, java.lang.String year, java.lang.String hour, java.lang.String minute, java.lang.String second, java.lang.String zone)
          Builds a Date string with the following format: "yyyyMMddTHHmmssZ".
static java.lang.String formatDateISONoValidation(java.lang.String month, java.lang.String day, java.lang.String year, java.lang.String hour, java.lang.String minute, java.lang.String second, java.lang.String zone)
          Builds a Date string with the following format: "yyyyMMddTHHmmssZ".
 java.util.ArrayList getExceptions()
          Returns the validation exception array.
static java.lang.String getFormattedDateTime(java.util.Locale locale, java.lang.String isoDateTime)
          Get the formatted date/time corresponding to the specified W3C formatted date/time using the specified locale.
static java.lang.String getFormattedDateTime(java.lang.String locale, java.lang.String isoDateTime)
          Get the formatted date/time corresponding to the specified W3C formatted date/time using the specified locale.
static java.lang.String localISODateTime(java.util.Locale locale, java.lang.String isoDateTime)
          Returns the date in W3C format shifted from GMT to local time.
 java.lang.String validateDate(java.util.Locale locale, java.lang.String fieldName, java.lang.String month, java.lang.String day, java.lang.String year, java.lang.String hour, java.lang.String minute, java.lang.String second, java.lang.String zone)
          Validates a Date string(s) and builds a Date string with the following format: "yyyyMMdd'T'HHmmss'Z'".
 java.lang.String validateDate(java.lang.String fieldName, java.lang.String theDate, java.lang.String pattern, java.util.Locale locale, java.util.TimeZone timeZone)
          Validates a Date string(s) and builds a Date string with the following format: "yyyyMMdd'T'HHmmss'Z'".
 java.lang.String validateDouble(java.lang.String fieldName, java.lang.String value, java.util.Locale locale)
          Validate Doubles.
 java.lang.Integer validateInteger(java.util.Locale locale, java.lang.String fieldName, java.lang.String value)
          Validate Integers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldUtil

public FieldUtil()
Method Detail

getExceptions

public java.util.ArrayList getExceptions()
Returns the validation exception array. This array can be an accumulation of messages from multiple validation calls, for example, from multi-value date fields.

Returns:
The exception message (if any)

clearExceptions

public void clearExceptions()
Clears all exceptions


validateInteger

public java.lang.Integer validateInteger(java.util.Locale locale,
                                         java.lang.String fieldName,
                                         java.lang.String value)
Validate Integers.

Parameters:
fieldName - The name of the data field from the workflow definition
value - The string to validate
Returns:
Integer the validated integer

validateDouble

public java.lang.String validateDouble(java.lang.String fieldName,
                                       java.lang.String value,
                                       java.util.Locale locale)
Validate Doubles.

Parameters:
fieldName - The name of the data field from the workflow definition
value - The string to validate
locale - The locale
Returns:
String the validated double in US format

validateDate

public java.lang.String validateDate(java.util.Locale locale,
                                     java.lang.String fieldName,
                                     java.lang.String month,
                                     java.lang.String day,
                                     java.lang.String year,
                                     java.lang.String hour,
                                     java.lang.String minute,
                                     java.lang.String second,
                                     java.lang.String zone)
Validates a Date string(s) and builds a Date string with the following format: "yyyyMMdd'T'HHmmss'Z'".

Parameters:
fieldName - The name of the data field from the workflow definition
month - Month, 1 - 12
day - Day, 1 - 31 (30 or 28/29 depending on the month)
year - Year
hour - Hour, 0 - 23
minute - Minutes, 0 - 59
second - Seconds, 0 - 59
zone - Time Zone 3 chars
Returns:
The date in specified format unless there was a validation error

validateDate

public java.lang.String validateDate(java.lang.String fieldName,
                                     java.lang.String theDate,
                                     java.lang.String pattern,
                                     java.util.Locale locale,
                                     java.util.TimeZone timeZone)
                              throws java.text.ParseException
Validates a Date string(s) and builds a Date string with the following format: "yyyyMMdd'T'HHmmss'Z'".

Parameters:
fieldName - String holding the name of the data field from the workflow definition
theDate - String holding the current date value
pattern - String holding the current date pattern (for rendering)
timeZone - TimeZone object
Returns:
String The date in specified format unless there was a validation error
Throws:
java.text.ParseException

formatDateDisplay

public static java.lang.String formatDateDisplay(java.lang.String month,
                                                 java.lang.String day,
                                                 java.lang.String year,
                                                 java.lang.String hour,
                                                 java.lang.String minute,
                                                 java.lang.String second,
                                                 java.lang.String zone)
Builds a Date string with the following format: "mm/dd/yyyy hh:mm:ss". No validation is performed.

Parameters:
month - Month, 2 chars or less
day - Day, 2 chars or less
year - Year, 4 chars or less
hour - Hour, 2 chars or less
minute - Minutes, 2 chars or less
second - Seconds, 2 chars or less
zone - Time Zone 3 chars
Returns:
The date in specified format

formatDateISONoValidation

public static java.lang.String formatDateISONoValidation(java.lang.String month,
                                                         java.lang.String day,
                                                         java.lang.String year,
                                                         java.lang.String hour,
                                                         java.lang.String minute,
                                                         java.lang.String second,
                                                         java.lang.String zone)
Builds a Date string with the following format: "yyyyMMddTHHmmssZ". No validation is performed.

Parameters:
month - Month, 2 chars or less
day - Day, 2 chars or less
year - Year, 4 chars or less
hour - Hour, 2 chars or less
minute - Minutes, 2 chars or less
second - Seconds, 2 chars or less
zone - Time Zone 3 chars
Returns:
The date in specified format

formatDateISO

public static java.lang.String formatDateISO(java.lang.String month,
                                             java.lang.String day,
                                             java.lang.String year,
                                             java.lang.String hour,
                                             java.lang.String minute,
                                             java.lang.String second,
                                             java.lang.String zone)
                                      throws java.lang.Exception
Builds a Date string with the following format: "yyyyMMddTHHmmssZ". No validation is performed.

Parameters:
month - Month, 2 chars or less
day - Day, 2 chars or less
year - Year, 4 chars or less
hour - Hour, 2 chars or less
minute - Minutes, 2 chars or less
second - Seconds, 2 chars or less
zone - Time Zone 3 chars
Returns:
The date in specified format
Throws:
java.lang.Exception - if there were errors formating the date

getFormattedDateTime

public static java.lang.String getFormattedDateTime(java.util.Locale locale,
                                                    java.lang.String isoDateTime)
                                             throws java.lang.Exception
Get the formatted date/time corresponding to the specified W3C formatted date/time using the specified locale.

Parameters:
locale - The Locale object specifying the locale
isoDateTime - The W3C date/time value in GMT time zone
Returns:
The formatted date/time as a String in LOCAL time zone
Throws:
java.lang.Exception

getFormattedDateTime

public static java.lang.String getFormattedDateTime(java.lang.String locale,
                                                    java.lang.String isoDateTime)
                                             throws java.lang.Exception
Get the formatted date/time corresponding to the specified W3C formatted date/time using the specified locale.

Parameters:
locale - The String locale value as specified by WcmUi.encodeLocale
isoDateTime - The W3C date/time value in GMT time zone
Returns:
The formatted date/time as a String in LOCAL time zone
Throws:
java.lang.Exception - if there were errors retrieving the Date

localISODateTime

public static java.lang.String localISODateTime(java.util.Locale locale,
                                                java.lang.String isoDateTime)
                                         throws java.lang.Exception
Returns the date in W3C format shifted from GMT to local time.

Parameters:
isoDateTime - The W3C date/time value in GMT time zone
Returns:
The W3C date/time value in LOCAL time zone
Throws:
java.lang.Exception

convertDateStringToDate

public static java.util.Date convertDateStringToDate(java.util.Locale locale,
                                                     java.lang.String str)
                                              throws com.filenet.wcm.toolkit.util.WcmException
Parses the date string with W3C-formatted date and returns java Date object.

Parameters:
str - a String object containing an W3C-date-formatted string.
Returns:
Date object
Throws:
com.filenet.wcm.toolkit.util.WcmException - if the input is not in the right format.


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