1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kns.datadictionary.validation.charlevel;
17
18 import org.kuali.rice.krad.datadictionary.exporter.ExportMap;
19 import org.kuali.rice.krad.datadictionary.validation.CharacterLevelValidationPattern;
20 import org.kuali.rice.krad.util.KRADConstants;
21
22
23
24
25
26
27 @Deprecated
28 public class AlphaValidationPattern extends CharacterLevelValidationPattern {
29 protected boolean allowWhitespace = false;
30
31
32
33
34
35 public boolean getAllowWhitespace() {
36 return allowWhitespace;
37 }
38
39
40
41
42 public void setAllowWhitespace(boolean allowWhitespace) {
43 this.allowWhitespace = allowWhitespace;
44 }
45
46
47
48
49
50 protected String getRegexString() {
51 StringBuffer regexString = new StringBuffer("[A-Za-z");
52
53 if (allowWhitespace) {
54 regexString.append("\\s");
55 }
56 regexString.append("]");
57
58 return regexString.toString();
59 }
60
61
62
63
64
65 public void extendExportMap(ExportMap exportMap) {
66 exportMap.set("type", "alpha");
67
68 if (allowWhitespace) {
69 exportMap.set("allowWhitespace", "true");
70 }
71 }
72
73 @Override
74 protected String getValidationErrorMessageKeyOptions() {
75 if (getAllowWhitespace()) {
76 return ".allowWhitespace";
77 }
78 return KRADConstants.EMPTY_STRING;
79 }
80 }