01: package dinamica;
02:
03: import java.util.HashMap;
04: import javax.servlet.http.HttpServletRequest;
05:
06: /**
07: * Base class to create reusable Validator services.
08: * All Validators must subclass this class.
09: * <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: * Executes business specific validation rule for a request
20: * @param req Servlet Request
21: * @param inputParams Recordset with pre-validated request parameters in its native data types
22: * @param attribs Attributes defined in validator.xml for the custom-validator element - these are validator-specific, so the same
23: * valitador can receive a different set of attributes in different Actions, making it more reusable.
24: * @return TRUE if the validation passed OK.
25: * @throws Throwable
26: */
27: public abstract boolean isValid(HttpServletRequest req,
28: Recordset inputParams, HashMap<String, String> attribs)
29: throws Throwable;
30:
31: /**
32: *
33: * @return Error Message to be displayed by the
34: * "invalid form" action. If this method returns null then
35: * the Controller will use the on-error-label attribute defined
36: * for the validator in the validator.xml file.
37: */
38: public String getErrorMessage() {
39: return null;
40: }
41:
42: }
|