1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.datadictionary.validation.constraint;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.krad.datadictionary.parse.BeanTag;
20 import org.kuali.rice.krad.datadictionary.parse.BeanTags;
21 import org.kuali.rice.krad.uif.UifConstants;
22
23
24
25
26
27
28
29
30 @BeanTags({@BeanTag(name = "numericPatternConstraint-bean", parent = "NumericPatternConstraint"),
31 @BeanTag(name = "numericWithOperators-bean", parent = "NumericWithOperators")})
32 public class NumericPatternConstraint extends AllowCharacterConstraint {
33
34
35
36
37 @Override
38 protected String getRegexString() {
39 StringBuilder regexString = new StringBuilder("[0-9");
40 regexString.append(this.getAllowedCharacterRegex());
41 regexString.append("]");
42
43 return regexString.toString();
44 }
45
46
47
48
49 @Override
50 public String getMessageKey() {
51 String messageKey = super.getMessageKey();
52 if (StringUtils.isNotEmpty(messageKey)) {
53 return messageKey;
54 }
55
56 return UifConstants.Messages.VALIDATION_MSG_KEY_PREFIX + "numericPattern";
57 }
58
59 }