KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > dinamica > AbstractValidator


1 package dinamica;
2
3 import java.util.HashMap JavaDoc;
4 import javax.servlet.http.HttpServletRequest JavaDoc;
5
6 /**
7  * Base class to create reusable Validator services.
8  * All Validators must subclass this class.
9  * <br>
10  * Creation date: 29/10/2003<br>
11  * Last Update: 29/10/2003<br>
12  * (c) 2003 Martin Cordova<br>
13  * This code is released under the LGPL license<br>
14  * @author Martin Cordova
15  */

16 public abstract class AbstractValidator extends GenericTransaction
17 {
18
19     /**
20      * Executes business specific validation rule for a request
21      * @param req Servlet Request
22      * @param inputParams Recordset with pre-validated request parameters in its native data types
23      * @param attribs Attributes defined in validator.xml for the custom-validator element - these are validator-specific, so the same
24      * valitador can receive a different set of attributes in different Actions, making it more reusable.
25      * @return TRUE if the validation passed OK.
26      * @throws Throwable
27      */

28     public abstract boolean isValid(HttpServletRequest JavaDoc req, Recordset inputParams, HashMap JavaDoc attribs) throws Throwable JavaDoc;
29     
30     /**
31      *
32      * @return Error Message to be displayed by the
33      * "invalid form" action. If this method returns null then
34      * the Controller will use the on-error-label attribute defined
35      * for the validator in the validator.xml file.
36      */

37     public String JavaDoc getErrorMessage()
38     {
39         return null;
40     }
41
42 }
43
Popular Tags