Static validation checks
Within a validation class, you can define static
methods that define the specific validation checks to perform at a specific
wizard step, reducing the need for full-policy inspections. For example,
the Drivers steps on
the submission wizard for Personal Auto contains the following validation
code (on the beforeSave
property of the LineWizardStepSet.PersonalAuto.pcf):
gw.lob.pa.PALineStepsValidator.validateDriversStep(policyPeriod.PersonalAutoLine)This code invokes the validateDriversStep method in
PALineStepsValidator before
committing the Drivers wizard step.
static function validateDriversStep(paLine : PersonalAutoLine) {
PCValidationContext.doPageLevelValidation(\ context -> {
var validator = new PALineValidation(context, paLine)
validator.CoveragesValidator.validate()
})
}
Notice the following:
- Wrapper method doPageLevelValidation provides
the exception reporting necessary if a validation check fails to pass.
It is the PCValidationContext.doPageLevelValidation
method that calls the raiseExceptionIfProblemsFound
method if any of the
validator.DriversValidatorvalidation checks fail. The raiseExceptionIfProblemsFound(context) method instructs the PolicyCenter rendering framework to display the appropriate warning or error automatically if there is an exception condition. - Validation class PALineDriversValidator provides
the validation checks for
validatDriversStep. This validation class defines a number of validation checks, not all of which the validateDriversStep method invokes. - The actual validation takes
place in the
doValidateoverride located in the CoveragesValidator class.
For a discussion of how to use this validation method to raise exceptions within PolicyCenter, see Example: Invoking validation in a job wizard step.
