com.ibm.ccd.ui.validator
Class ValidationHelper

java.lang.Object
  extended by com.ibm.ccd.ui.validator.ValidationHelper
All Implemented Interfaces:
IValidatorMessage

public class ValidationHelper
extends java.lang.Object
implements IValidatorMessage


Field Summary
 
Fields inherited from interface com.ibm.ccd.ui.validator.IValidatorMessage
ATTRIBUTE_LIST, ERROR_MESSAGE_LIST, MSG_INVALID_CURRENCY, MSG_INVALID_DATE, MSG_INVALID_FLAG, MSG_INVALID_IMAGE, MSG_INVALID_INTEGER, MSG_INVALID_NUMBER, MSG_INVALID_PERIOD, MSG_INVALID_URL, MSG_MANDATORY_ATTRIBUTE, MSG_MIN_OCCURENCE_ERROR, MSG_MORE_ERRORS, MSG_TOOLTIP
 
Constructor Summary
ValidationHelper()
           
 
Method Summary
static java.lang.String createErrorMessage(java.lang.String msgKey, java.util.Locale locale, java.lang.Object[] values)
          Generate the error message to be stored in the attribute object for display as tooltip
static java.lang.String validateCurrency(java.lang.String attribute, java.lang.String value, int precision, java.util.Locale locale, MessageMap error)
           
static java.lang.String validateDate(java.lang.String attribute, java.lang.String date, java.util.Locale locale, MessageMap error)
           
static java.lang.String validateImage(java.lang.String attribute, java.lang.String image, java.util.Locale locale, MessageMap error)
           
static java.lang.String validateInteger(java.lang.String attribute, java.lang.String value, java.util.Locale locale, MessageMap error)
           
static java.lang.String validateNumber(java.lang.String attribute, java.lang.String value, int precision, java.util.Locale locale, MessageMap error)
           
static java.lang.String validatePeriod(java.lang.String attribute, java.lang.String fromValue, java.lang.String toValue, java.util.Locale locale, MessageMap error)
           
static java.lang.String validateURL(java.lang.String attribute, java.lang.String url, java.util.Locale locale, MessageMap error)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidationHelper

public ValidationHelper()
Method Detail

validateNumber

public static java.lang.String validateNumber(java.lang.String attribute,
                                              java.lang.String value,
                                              int precision,
                                              java.util.Locale locale,
                                              MessageMap error)
Parameters:
attribute - Attribute name with the occurence indicator, if any
value - value to be validated
precision - maximum number of digits allowed in the fraction portion
locale - locale of the user
error - MessageMap in which the error message,if any, is to be added
Returns:
a string containing the error message,if any, or null

validateCurrency

public static java.lang.String validateCurrency(java.lang.String attribute,
                                                java.lang.String value,
                                                int precision,
                                                java.util.Locale locale,
                                                MessageMap error)
Parameters:
attribute - Attribute name with the occurence indicator, if any
value - value to be validated
precision - maximum number of digits allowed in the fraction portion
locale - locale of the user
error - MessageMap in which the error message,if any, is to be added
Returns:
a string containing the error message,if any, or null

validateInteger

public static java.lang.String validateInteger(java.lang.String attribute,
                                               java.lang.String value,
                                               java.util.Locale locale,
                                               MessageMap error)
Parameters:
attribute - Attribute name with the occurence indicator, if any
value - value to be validated
locale - locale of the user
error - MessageMap in which the error message,if any, is to be added
Returns:
a string containing the error message,if any, or null

validateDate

public static java.lang.String validateDate(java.lang.String attribute,
                                            java.lang.String date,
                                            java.util.Locale locale,
                                            MessageMap error)
Parameters:
attribute - Attribute name with the occurence indicator, if any
date - value to be validated
locale - locale of the user
error - MessageMap in which the error message,if any, is to be added
Returns:
a string containing the error message,if any, or null

validatePeriod

public static java.lang.String validatePeriod(java.lang.String attribute,
                                              java.lang.String fromValue,
                                              java.lang.String toValue,
                                              java.util.Locale locale,
                                              MessageMap error)
Parameters:
attribute - Attribute name with the occurence indicator, if any
fromValue - value of From Date
toValue - value of To Date
locale - locale of the user
error - MessageMap in which the error message,if any, is to be added
Returns:
a string containing the error message,if any, or null

validateURL

public static java.lang.String validateURL(java.lang.String attribute,
                                           java.lang.String url,
                                           java.util.Locale locale,
                                           MessageMap error)
Parameters:
attribute - Attribute name with the occurence indicator, if any
url - url to be validated
locale - locale of the user
error - MessageMap in which the error message,if any, is to be added
Returns:
a string containing the error message,if any, or null

validateImage

public static java.lang.String validateImage(java.lang.String attribute,
                                             java.lang.String image,
                                             java.util.Locale locale,
                                             MessageMap error)
Parameters:
attribute - Attribute name with the occurence indicator, if any
image - value to be validated
locale - locale of the user
error - MessageMap in which the error message,if any, is to be added
Returns:
a string containing the error message,if any, or null

createErrorMessage

public static java.lang.String createErrorMessage(java.lang.String msgKey,
                                                  java.util.Locale locale,
                                                  java.lang.Object[] values)
Generate the error message to be stored in the attribute object for display as tooltip

Parameters:
msgKey - Error message key
locale - Locale for which the message is to be generated
values - An array of values to be used to format the message
Returns:
a string containing the error message to be shown as tooltip on the error image