| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ValidCharactersConstraint |
|
| 1.0;1 |
| 1 | package org.kuali.rice.krad.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 "[A-Za-z]*" | |
| 12 | * - To limit to any character except carriage returns and line feeds, value can be set to "[^\n\r]*" | |
| 13 | * | |
| 14 | * Alternative processors can be specified, though the current implementation (1.1) does not handle any processor but regex. | |
| 15 | * TODO delyea: remove jsValue from docs here | |
| 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 | /** | |
| 46 | * The Java based regex for valid characters | |
| 47 | * This value should include the ^ and $ symbols after "regex:" if needed | |
| 48 | * @return the value | |
| 49 | */ | |
| 50 | public String getValue() { | |
| 51 | 0 | return value; |
| 52 | } | |
| 53 | ||
| 54 | /** | |
| 55 | * @param value the value to set | |
| 56 | */ | |
| 57 | public void setValue(String value) { | |
| 58 | 0 | this.value = value; |
| 59 | 0 | } |
| 60 | ||
| 61 | } |