Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ValidCharactersConstraint |
|
| 1.0;1 |
1 | package org.kuali.rice.kns.datadictionary.validation.constraint; | |
2 | ||
3 | import javax.xml.bind.annotation.XmlAccessType; | |
4 | import javax.xml.bind.annotation.XmlAccessorType; | |
5 | import javax.xml.bind.annotation.XmlElement; | |
6 | ||
7 | /** | |
8 | * This is a constraint that limits attribute values to some subset of valid characters or to match a particular regular expression. | |
9 | * | |
10 | * For example: | |
11 | * - To limit to both upper and lower-case letters, value can be set to "regex:[A-Za-z]*" | |
12 | * - To limit to any character except carriage returns and line feeds, value can be set to "regex:[^\n\r]*" | |
13 | * | |
14 | * Alternative processors can be specified, though the current implementation (1.1) does not handle any processor but regex. | |
15 | * | |
16 | * Note that if jsValue has any value it will always <b>override</b> the following...<b> | |
17 | * If the labelKey matches one of the following values:<br> | |
18 | * email<br> | |
19 | url<br> | |
20 | date<br> | |
21 | number<br> | |
22 | digits<br> | |
23 | creditcard<br> | |
24 | letterswithbasicpunc<br> | |
25 | alphanumeric<br> | |
26 | lettersonly<br> | |
27 | nowhitespace<br> | |
28 | integer<br> | |
29 | phoneUS<br> | |
30 | time<br> | |
31 | * or <b>any</b> other custom method added through the addMethod call on the validator in jQuery | |
32 | * AND if a javascript value is not specified on this constraint, it will use the built in jQuery defined | |
33 | * validation method which matches that name. Note using a validator method here which is not a regex validation does not | |
34 | * make sense within context of this constraint as a server side regex value should be defined. | |
35 | * | |
36 | * @author Kuali Student Team | |
37 | * @since 1.1 | |
38 | */ | |
39 | @XmlAccessorType(XmlAccessType.FIELD) | |
40 | 0 | public class ValidCharactersConstraint extends BaseConstraint { |
41 | ||
42 | @XmlElement | |
43 | protected String value; | |
44 | ||
45 | @XmlElement | |
46 | protected String jsValue; | |
47 | ||
48 | /** | |
49 | * The Java based regex for valid characters | |
50 | * This value should include the ^ and $ symbols after "regex:" if needed | |
51 | * @return the value | |
52 | */ | |
53 | public String getValue() { | |
54 | 0 | return value; |
55 | } | |
56 | ||
57 | /** | |
58 | * @param value the value to set | |
59 | */ | |
60 | public void setValue(String value) { | |
61 | 0 | this.value = value; |
62 | 0 | } |
63 | ||
64 | /** | |
65 | * Javascript version of the regex defined in value. This does not have to be set if this constraint's | |
66 | * key maps to one of the default valid character methods contained in jQuery. | |
67 | * This must be set if there is NO default method that matches the label key and applyClientSide is true. | |
68 | * | |
69 | * This is completely ignored if applyClientSide is set to false.<br> | |
70 | * This value should include /^ and $/ symbols in the regex, there is no prefix used, unlike the java value. | |
71 | * | |
72 | * @return the jsValue | |
73 | */ | |
74 | public String getJsValue() { | |
75 | 0 | return this.jsValue; |
76 | } | |
77 | ||
78 | /** | |
79 | * @param jsValue the jsValue to set | |
80 | */ | |
81 | public void setJsValue(String jsValue) { | |
82 | 0 | this.jsValue = jsValue; |
83 | 0 | } |
84 | ||
85 | ||
86 | ||
87 | } |