org.dbforms.validation
Class DbFormsValidatorUtil

java.lang.Object
  extended by org.dbforms.validation.DbFormsValidatorUtil

public class DbFormsValidatorUtil
extends Object

This class generate error string from ResourceBundle if enable, else generate error in DbForms-Error.xml standard.

Author:
Eric Beaumier

Constructor Summary
DbFormsValidatorUtil()
           
 
Method Summary
static String[] getArgs(String actionName, Locale locale, Field field)
          Retrieve parameter from validation.xml.
static StringBuffer getJavascript(List formNames, Locale locale, Hashtable fieldsName, ValidatorResources resources, String javascriptValidationSrcFile, DbFormsErrors errors)
          J A V S C R I P T G E N E R A T I O N.
static String getMessage(String type, ValidatorAction va, Locale locale, Field field, DbFormsErrors errors)
          Get the error message from ResourceBundle if present, else generate a DbForms-Error.xml standard.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbFormsValidatorUtil

public DbFormsValidatorUtil()
Method Detail

getArgs

public static String[] getArgs(String actionName,
                               Locale locale,
                               Field field)
Retrieve parameter from validation.xml.

Parameters:
String - : Type of validation (required, range, email,...).
Locale - : Locale object to map with the good ResourceBundle
Field - : Field validator information. (retrieve tag from validation.xml).
Returns:
String : Message resolve.

getJavascript

public static StringBuffer getJavascript(List formNames,
                                         Locale locale,
                                         Hashtable fieldsName,
                                         ValidatorResources resources,
                                         String javascriptValidationSrcFile,
                                         DbFormsErrors errors)
J A V S C R I P T G E N E R A T I O N.

Parameters:
formName - : Name to match with
in validation.xml.
Locale - : Locale object to map with the ResourceBundle
Hashtable - : Hashtable of field name in table and generated name from DbForms (ex: "field1" : "f_4_3@root_4").
ValidatorResources - : ValidatorResources use by DbForms
javascriptValidationSrcFile - : Validation file name to include in src of script.
DbFormsErrors - : Class to resolve DbForms-Error format (DbForms-Errors.xml).
Returns:
StringBuffer : The complete javascript validation section to include in response.

getMessage

public static String getMessage(String type,
                                ValidatorAction va,
                                Locale locale,
                                Field field,
                                DbFormsErrors errors)
Get the error message from ResourceBundle if present, else generate a DbForms-Error.xml standard.

Parameters:
String - : Type of validation (required, range, email,...).
ValidatorAction - : ValidatorAction to retrieve validation definition.
Locale - : Locale object to map with the good ResourceBundle
Field - : Field validator information. (retrieve tag from validation.xml).
DbFormsErrors - : DbForms Error class to retrieve error message in DbForm-Errors.xml format.
Returns:
String : Message resolve.


Copyright © 2002-2006 DbForms. All Rights Reserved.