org.formproc
Class FormResult

java.lang.Object
  |
  +--org.formproc.FormResult

public class FormResult
extends java.lang.Object

Class representing the results of processing a Form.

Author:
Anthony Eden

Constructor Summary
FormResult()
          Construct a FormResult with no results.
FormResult(ValidationResultMap validationResults, ValidationResultMap groupValidationResults, java.util.Map originalData)
          Construct a FormResult with the given element validation results and group validation results.
 
Method Summary
 java.lang.String getErrorOrMessage(java.lang.String name)
          Return the error message or user message for the given named element.
 java.lang.String getErrorOrMessage(java.lang.String name, java.util.Locale locale)
          Return the error message or user message for the given named element.
 java.lang.String getGroupErrorMessage(java.lang.String name)
          Get the error message for the named FormElementGroup.
 java.lang.String getGroupErrorMessage(java.lang.String name, java.util.Locale locale)
          Get the error message for the named FormElementGroup.
 ValidationResultMap getGroupValidationResults()
          Get the ValidationResultMap for all element group validation results.
 java.lang.Object getOriginalValue(java.lang.String name)
          Get the original value submitted for the given field.
 java.lang.String getOriginalValueAsString(java.lang.String name)
          Get the original value submitted for the given field as a String.
 ValidationResultMap getValidationResults()
          Get the ValidationResultMap for all element validation results.
 boolean isElementGroupValid(java.lang.String name)
          Return true if the given form element group is valid.
 boolean isElementValid(java.lang.String name)
          Return true if the given form element is valid.
 boolean isValid()
          Return true if all validators passed, and thus all of the form data is valid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormResult

public FormResult()
Construct a FormResult with no results. This object can be used in cases where validation has not yet occured yet a result object is needed.


FormResult

public FormResult(ValidationResultMap validationResults,
                  ValidationResultMap groupValidationResults,
                  java.util.Map originalData)
Construct a FormResult with the given element validation results and group validation results.

Parameters:
validationResults - Results of validation of all elements
groupValidationResults - Results of validation of all element groups
originalData - The original data
Method Detail

getValidationResults

public ValidationResultMap getValidationResults()
Get the ValidationResultMap for all element validation results.

Returns:
The ValidationResultMap for element validation results

getGroupValidationResults

public ValidationResultMap getGroupValidationResults()
Get the ValidationResultMap for all element group validation results.

Returns:
The ValidationResultMap for element group validation results

isValid

public boolean isValid()
Return true if all validators passed, and thus all of the form data is valid.

Returns:
True if the the form data is valid

isElementValid

public boolean isElementValid(java.lang.String name)
Return true if the given form element is valid.

Parameters:
name - The form element name
Returns:
True if the element is valid

isElementGroupValid

public boolean isElementGroupValid(java.lang.String name)
Return true if the given form element group is valid.

Parameters:
name - The form element group name
Returns:
True if the group is valid

getOriginalValue

public java.lang.Object getOriginalValue(java.lang.String name)
Get the original value submitted for the given field. This method may return null if the original value was null.

Parameters:
name - The field name
Returns:
The original value Object or null

getOriginalValueAsString

public java.lang.String getOriginalValueAsString(java.lang.String name)
Get the original value submitted for the given field as a String. If the value is null then an empty String will be returned. To get the original value as an Object use getOriginalValue().

Parameters:
name - The field name
Returns:
The value as a String
See Also:
getOriginalValue(String name)

getErrorOrMessage

public java.lang.String getErrorOrMessage(java.lang.String name)
Return the error message or user message for the given named element. The Locale specified at request-time will be used. If there is no error or message then this method will return

Parameters:
name - The field name
Returns:
The message or error message

getErrorOrMessage

public java.lang.String getErrorOrMessage(java.lang.String name,
                                          java.util.Locale locale)
Return the error message or user message for the given named element.

Parameters:
name - The field name
locale - The Locale
Returns:
The message or error message

getGroupErrorMessage

public java.lang.String getGroupErrorMessage(java.lang.String name)
Get the error message for the named FormElementGroup. This method may return null if a.) there is no element group or b.) the form group is valid. This method will use the request-time locale.

Parameters:
name - The group name
Returns:
The error message of null

getGroupErrorMessage

public java.lang.String getGroupErrorMessage(java.lang.String name,
                                             java.util.Locale locale)
Get the error message for the named FormElementGroup. This method may return null if a.) there is no element group or b.) the form group is valid.

Parameters:
name - The group name
locale - The locale
Returns:
The error message of null


Copyright (c) 2001-2003 Anthony Eden. All Rights Reserved.