Validation is implemented in 3 different areas of the application:
- Form Conversion (POJO)
- Validation against the data dictionary
- Business Rules Container
Validation Framework Classes
Map that collects errors throughout a validation session. At each request, a new ErrorMap is added to
GlobalVariables. Any method of the application can pull the ErrorMap out and add errors as needed: At the end of request processing, the ErrorMap is checked, and any errors are translated to ActionMessages for
display in the jsp.
Any exceptions encountered by the validation framework are wrapped in a ValidationException.
- org.kuali.rice.kns.service.(impl.)DictionaryValidationService(Impl) (junit org.kuali.rice.kns.service.DictionaryValidationServiceTest)
Provides entry points to validation against the data dictionary.
Provides display of errors in the UI. The keyMatch attribute is a comma delimited string of error keys to match on. The tag
performs a like on each against error keys in the map. The above would display any errors whose key starts with document.sourceAccountingLines or newSourceLine (e.g.,
document.sourceAccountingLines.account.accountNbr, newSourceLine.projectCode, ...)
Adding Error Messages
- When an error is encountered (e.g., in a Rule, or Business Object validation) add error to ErrorMap
- GlobalVariables provides access to the ErrorMap for the request
- The first parameter to the ErrorMap is the fully qualified path to the field on the action form, less any prefix terms that have been added to the ErrorMap using the addToErrorPath method. For information on other methods available to manipulate the ErrorMap and ErrorPath refer to the ErrorMap javadoc.
- The second parameter to the ErrorMap is the error constant for the error message.
- The third parameter is any parameters for the message. If multiple parameters are needed, construct a string array (String) with the parameters.
The text for errors are maintained as system messages and can be changed or added by changing system messages.
Kuali documentation is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.
Kuali software is licensed for use pursuant to the Educational Community License v.2.0.
Copyright © 2005-2013 The Kuali Foundation. All rights reserved.
Portions of Kuali are copyrighted by other parties as described in the Acknowledgments screen.
Kuali ® is a registered trademark of the Trustees of Indiana University.