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

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

public class WcmValidate
extends java.lang.Object

This utility class handles validation of some basic data types


Constructor Summary
WcmValidate()
           
 
Method Summary
static boolean isGUID(java.lang.String strIn)
          Returns true if the value is a valid GUID
static java.lang.String validateDouble(java.lang.String value, java.lang.String min, java.lang.String max, java.util.Locale locale)
          Validates Doubles.
static java.lang.String validateDoubleNoFormat(java.lang.String value, java.lang.String min, java.lang.String max, java.util.Locale locale)
          Validates Doubles.
static java.lang.String validateDoubleUseLocale(java.lang.String value, java.lang.String min, java.lang.String max, java.util.Locale locale)
          Validates Doubles.
static java.lang.String validateDoubleUseLocale(java.lang.String value, java.lang.String min, java.lang.String max, java.util.Locale locale, java.lang.Boolean useGrouping)
          Validates Doubles.
static java.lang.String validateGUID(java.lang.String strIn)
          Deprecated. Use validateGUID(String, String, Locale) instead. Validates GUIDs. Adds brackets at beginning and end if they are not already present. Example: {2868C7DE-F404-4BDE-8EAE-70157CC67AA9}
static java.lang.String validateGUID(java.lang.String strIn, java.util.Locale locale)
          Validates GUIDs.
static boolean validateHostName(java.lang.String hostName)
          Validates HostName
static java.lang.String validateInteger(java.lang.String value, java.lang.String min, java.lang.String max)
          Deprecated. Use validateInteger(String, String, String, Locale) instead. Validates Integers
static java.lang.String validateInteger(java.lang.String value, java.lang.String min, java.lang.String max, java.util.Locale locale)
          Validates Integers
static boolean validateIP(java.lang.String ipAddress)
          Validates a String as a valid IP address.
static java.lang.String validateLong(java.lang.String value, java.lang.String min, java.lang.String max)
          Deprecated. Use validateLong(String, String, String, Locale) instead. Validates Longs
static java.lang.String validateLong(java.lang.String value, java.lang.String min, java.lang.String max, java.util.Locale locale)
          Validates Longs
static boolean validateRouterHost(java.lang.String routerHost)
          Validate the routerHost value.
static java.lang.String validateString(java.lang.String value, java.lang.String max, java.util.Locale locale)
          Validates String
static boolean validateUnsignedByte(java.lang.String value)
          Validates a String as a valid unsigned byte value between 0 and 255.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WcmValidate

public WcmValidate()
Method Detail

validateGUID

public static java.lang.String validateGUID(java.lang.String strIn)
                                     throws java.lang.Exception
Deprecated. Use validateGUID(String, String, Locale) instead. Validates GUIDs. Adds brackets at beginning and end if they are not already present. Example: {2868C7DE-F404-4BDE-8EAE-70157CC67AA9}

Parameters:
strIn - The string to validate
Returns:
valid GUID
Throws:
java.lang.Exception - if the GUID is invalid

validateGUID

public static java.lang.String validateGUID(java.lang.String strIn,
                                            java.util.Locale locale)
                                     throws java.lang.Exception
Validates GUIDs. Adds brackets at beginning and end if they are not already present. Example: {2868C7DE-F404-4BDE-8EAE-70157CC67AA9}

Parameters:
strIn - The string to validate
locale - - the Locale of the calling application
Returns:
valid GUID
Throws:
java.lang.Exception - if the GUID is invalid

validateDouble

public static java.lang.String validateDouble(java.lang.String value,
                                              java.lang.String min,
                                              java.lang.String max,
                                              java.util.Locale locale)
                                       throws java.lang.Exception
Validates Doubles. Pass null for min/max values if min/max checking is not required.

Parameters:
value - The string to validate
min - The minimum value allowed for this Double
max - The maximum value allowed for this Double
locale -
Returns:
String valid double
Throws:
java.lang.Exception - if the Double is invalid

validateDoubleNoFormat

public static java.lang.String validateDoubleNoFormat(java.lang.String value,
                                                      java.lang.String min,
                                                      java.lang.String max,
                                                      java.util.Locale locale)
                                               throws java.lang.Exception
Validates Doubles. Pass null for min/max values if min/max checking is not required.

Parameters:
value - The string to validate
min - The minimum value allowed for this Double
max - The maximum value allowed for this Double
locale -
Returns:
String valid double
Throws:
java.lang.Exception - if the Double is invalid

validateDoubleUseLocale

public static java.lang.String validateDoubleUseLocale(java.lang.String value,
                                                       java.lang.String min,
                                                       java.lang.String max,
                                                       java.util.Locale locale)
                                                throws java.lang.Exception
Validates Doubles. Pass null for min/max values if min/max checking is not required.

Parameters:
value - The string to validate
locale -
Returns:
String valid double
Throws:
java.lang.Exception - if the Double is invalid

validateDoubleUseLocale

public static java.lang.String validateDoubleUseLocale(java.lang.String value,
                                                       java.lang.String min,
                                                       java.lang.String max,
                                                       java.util.Locale locale,
                                                       java.lang.Boolean useGrouping)
                                                throws java.lang.Exception
Validates Doubles. Pass null for min/max values if min/max checking is not required.

Parameters:
value - The string to validate
locale -
useGrouping - Sets the grouping option when formatting the number (only used in non-english locales)
Returns:
String valid double
Throws:
java.lang.Exception - if the Double is invalid

validateLong

public static java.lang.String validateLong(java.lang.String value,
                                            java.lang.String min,
                                            java.lang.String max)
                                     throws java.lang.Exception
Deprecated. Use validateLong(String, String, String, Locale) instead. Validates Longs

Parameters:
value - The string to validate
min - The minimum value allowed for this Long
max - The maximum value allowed for this Long
Returns:
valid long
Throws:
java.lang.Exception - if the Long is invalid

validateLong

public static java.lang.String validateLong(java.lang.String value,
                                            java.lang.String min,
                                            java.lang.String max,
                                            java.util.Locale locale)
                                     throws java.lang.Exception
Validates Longs

Parameters:
value - The string to validate
min - The minimum value allowed for this Long
max - The maximum value allowed for this Long
locale - The locale of the calling application
Returns:
valid long
Throws:
java.lang.Exception - if the Long is invalid

validateInteger

public static java.lang.String validateInteger(java.lang.String value,
                                               java.lang.String min,
                                               java.lang.String max)
                                        throws java.lang.Exception
Deprecated. Use validateInteger(String, String, String, Locale) instead. Validates Integers

Parameters:
value - The string to validate
min - The minimum value allowed for this Integer
max - The maximum value allowed for this Integer
Returns:
integer, if valid.
Throws:
java.lang.Exception - if the Integer is invalid

validateInteger

public static java.lang.String validateInteger(java.lang.String value,
                                               java.lang.String min,
                                               java.lang.String max,
                                               java.util.Locale locale)
                                        throws java.lang.Exception
Validates Integers

Parameters:
value - The string to validate
min - The minimum value allowed for this Integer
max - The maximum value allowed for this Integer
locale - The locale of the calling application
Returns:
integer, if valid.
Throws:
java.lang.Exception - if the Integer is invalid

validateString

public static java.lang.String validateString(java.lang.String value,
                                              java.lang.String max,
                                              java.util.Locale locale)
                                       throws java.lang.Exception
Validates String

Parameters:
value - The string to validate
max - The maximum value allowed for this Long
locale - The locale of the calling application
Returns:
valid long
Throws:
java.lang.Exception - if the Long is invalid

validateRouterHost

public static boolean validateRouterHost(java.lang.String routerHost)
Validate the routerHost value. Returns false if "localhost" is set as the host name.

Parameters:
routerHost -
Returns:
boolean

validateHostName

public static boolean validateHostName(java.lang.String hostName)
Validates HostName

Parameters:
hostName - The host nema to validate
Returns:
true, if valid.

validateIP

public static boolean validateIP(java.lang.String ipAddress)
Validates a String as a valid IP address. Checks for four parts, and that each part represents a numeric value between 0 and 255.

Parameters:
ipAddress -
Returns:
boolean

validateUnsignedByte

public static boolean validateUnsignedByte(java.lang.String value)
Validates a String as a valid unsigned byte value between 0 and 255.

Parameters:
value -
Returns:
boolean

isGUID

public static boolean isGUID(java.lang.String strIn)
Returns true if the value is a valid GUID

Parameters:
strIn - String value to validate
Returns:
boolean true if the value is a valid GUID.


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