Validation package
Guidewire provides the following validation-related
classes and interfaces in the gw.validation
package.
Class or Interface |
Description |
|---|---|
|
Interface that all validation classes must implement. |
|
Class that takes a
|
|
Abstract convenience
class that takes a |
|
Class that contains the object methods to use in generating warnings and errors. |
The following object diagram illustrates these relationships.
PCValidation
All Gosu validation
classes must implement the PCValidation
interface. Any Gosu class (or any interface defined in Gosu) that implements
PCValidation can perform
validation logic. This interface contains a single validate method.
Classes that implement this interface can create methods that test for a single issue and call those method from their implementation of the validate method. For an example, see PALineDriversValidator.gs. Through object inheritance, the method doValidate does the validation:
override function doValidate() {
qualifiedGoodDriver()
appliedGoodDriverDiscount()
licenseInfoRequired()
...
}
PCValidationBase
Class PCValidationBase is a convenience
class that implements PCValidation.
Its constructor takes a validation context (PCValidationContext) instance that holds the level
at which to perform validation and the validation results (warnings and
errors).
PCValidationBase provides a number
of getter property methods. Some of the more important
are:
property get Context() : PCValidationContext
property get Level() : ValidationLevel
property get Result() : PCValidationResult
PCValidationContext
Class PCValidationContext takes a ValidationLevel and creates a new PCValidationResult during initialization.
This class has several important methods for use in managing validation. The following list describes each briefly. However, for the most complete information, consult the Gosu API Reference documentation associated with the method.
Method |
Description |
|---|---|
|
Use to track a complete
listing of the checks that PolicyCenter performed during the validation.
The method returns This method only checks against the class name,
not the validation object itself (using |
|
Use to test whether
the given combination of validation class name and method name have been
seen before. If so, the method returns |
|
Use to perform a test
to determine if the level specified by |
|
Use to produce a string
that lists the validation methods that were visited as validation was
performed with the provided |
|
Resets the set of visited validation methods. |
|
Throws an |
|
Throws an |
PCValidationResult
Class PCValidationResult
holds the warnings and errors added by the validation implementation
classes as problems are discovered. Warnings are non-blocking. The user
can clear warnings and continue. In contrast, errors block further progress
until the user resolves the problem.
PCValidationResult
contains a number of object methods that you use in generating warnings
and errors. The following list describes the more important ones briefly.
However, for the most complete information, consult the Gosu API Reference
documentation associated with the method.
Method |
Description |
|---|---|
|
Use to add a general error message. This method takes the following arguments, of which the first three are mandatory and the last optional:
If you supply a |
|
Use to add an error
message specifically associated with a field on the given keyable bean
as defined by the relative
If you supply a |
|
Similar to the addError method, except that it generates a warning rather than an error. |
|
Similar to the addFieldError method except that it generates a warning rather than an error. |
PCValidationResult
inherits several different forms of the reject method from the (platform)
ValidationResult class
(which it subclasses).
Method form |
Description |
|---|---|
|
Indicates a problem and provides an error message, but does not point to a specific field. |
|
Indicates a problem with a particular field, provides an error message, and indicates the correct field to fix. |
