01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: ValidationBuilder.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.site;
09:
10: import java.util.Collection;
11:
12: import com.uwyn.rife.site.exceptions.ValidationBuilderException;
13: import com.uwyn.rife.template.Template;
14:
15: public interface ValidationBuilder extends Cloneable {
16: public static final String PREFIX_ERROR = "ERROR:";
17: public static final String PREFIX_ERRORMESSAGE = "ERRORMESSAGE:";
18: public static final String PREFIX_ERRORS = "ERRORS:";
19: public static final String PREFIX_MARK = "MARK:";
20: public static final String PREFIX_MARK_ERROR = "MARK:ERROR";
21:
22: public static final String ID_ERROR_WILDCARD = "ERROR:*";
23: public static final String ID_ERRORMESSAGE = "ERRORMESSAGE";
24: public static final String ID_ERRORMESSAGE_WILDCARD = "ERRORMESSAGE:*";
25: public static final String ID_ERRORS = "ERRORS";
26: public static final String ID_ERRORS_FALLBACK = "ERRORS:";
27: public static final String ID_ERRORS_WILDCARD = "ERRORS:*";
28:
29: public static final String TAG_ERRORS = "(?=(?<=^" + PREFIX_ERRORS
30: + ")|\\G(?<!^))\\s*(\\w+)\\s*,?(?=[\\w,]+$|$)";
31: public static final String TAG_ERRORMESSAGE = "(?=(?<=^"
32: + PREFIX_ERRORMESSAGE
33: + ")|\\G(?<!^))\\s*(\\w+)\\s*,?(?=[\\w,]+$|$)";
34: public static final String TAG_MARK = "(?:^" + PREFIX_MARK
35: + "(?:(\\w+):)?|\\G(?<!^))\\s*(\\w+)\\s*,?(?=[\\w,]+$|$)";
36:
37: public void setFallbackErrorArea(Template template, String message);
38:
39: public Collection<String> generateValidationErrors(
40: Template template, Collection<ValidationError> errors,
41: Collection<String> onlySubjectsToClear, String prefix);
42:
43: public Collection<String> generateErrorMarkings(Template template,
44: Collection<ValidationError> errors,
45: Collection<String> onlySubjectsToClear, String prefix)
46: throws ValidationBuilderException;
47:
48: public void removeValidationErrors(Template template,
49: Collection<String> subjects, String prefix);
50:
51: public void removeErrorMarkings(Template template,
52: Collection<String> subjects, String prefix);
53:
54: public Object clone();
55: }
|