Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
SimpleConstraint |
|
| 1.0;1 |
1 | /** | |
2 | * Copyright 2005-2011 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.opensource.org/licenses/ecl2.php | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | package org.kuali.rice.krad.datadictionary.validation.constraint; | |
17 | ||
18 | import javax.xml.bind.annotation.XmlAccessType; | |
19 | import javax.xml.bind.annotation.XmlAccessorType; | |
20 | import javax.xml.bind.annotation.XmlElement; | |
21 | ||
22 | /** | |
23 | * A simple constraint stores 'basic' constraints for a field. This constraint is meant to be used as a | |
24 | * constraint for WhenConstraints in CaseConstraint, and is also used internally in InputField. | |
25 | * | |
26 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
27 | */ | |
28 | @XmlAccessorType(XmlAccessType.FIELD) | |
29 | 2 | public class SimpleConstraint extends BaseConstraint implements ExistenceConstraint{ |
30 | ||
31 | @XmlElement | |
32 | private Boolean required; | |
33 | ||
34 | @XmlElement | |
35 | private Integer maxLength; | |
36 | ||
37 | @XmlElement | |
38 | private Integer minLength; | |
39 | ||
40 | @XmlElement | |
41 | protected String exclusiveMin; | |
42 | ||
43 | @XmlElement | |
44 | protected String inclusiveMax; | |
45 | ||
46 | //Don't know if we will support min/max occurs at this time | |
47 | @XmlElement | |
48 | private Integer minOccurs; | |
49 | ||
50 | @XmlElement | |
51 | private Integer maxOccurs; | |
52 | ||
53 | /** | |
54 | * If true the field is required | |
55 | * @return the required | |
56 | */ | |
57 | public Boolean getRequired() { | |
58 | 0 | return this.required; |
59 | } | |
60 | ||
61 | /** | |
62 | * @param required the required to set | |
63 | */ | |
64 | public void setRequired(Boolean required) { | |
65 | 0 | this.required = required; |
66 | 0 | } |
67 | ||
68 | /** | |
69 | * The maximum amount of characters this field's value can be | |
70 | * @return the maxLength | |
71 | */ | |
72 | public Integer getMaxLength() { | |
73 | 0 | return this.maxLength; |
74 | } | |
75 | ||
76 | /** | |
77 | * @param maxLength the maxLength to set | |
78 | */ | |
79 | public void setMaxLength(Integer maxLength) { | |
80 | 0 | this.maxLength = maxLength; |
81 | 0 | } |
82 | ||
83 | /** | |
84 | * The minimum amount of characters this field's value has to be | |
85 | * @return the minLength | |
86 | */ | |
87 | public Integer getMinLength() { | |
88 | 0 | return this.minLength; |
89 | } | |
90 | ||
91 | /** | |
92 | * @param minLength the minLength to set | |
93 | */ | |
94 | public void setMinLength(Integer minLength) { | |
95 | 0 | this.minLength = minLength; |
96 | 0 | } |
97 | ||
98 | /** | |
99 | * Exclusive minimum value for this field | |
100 | * @return the exclusiveMin | |
101 | */ | |
102 | public String getExclusiveMin() { | |
103 | 0 | return this.exclusiveMin; |
104 | } | |
105 | ||
106 | /** | |
107 | * @param exclusiveMin the exclusiveMin to set | |
108 | */ | |
109 | public void setExclusiveMin(String exclusiveMin) { | |
110 | 0 | this.exclusiveMin = exclusiveMin; |
111 | 0 | } |
112 | ||
113 | /** | |
114 | * Inclusive max value for this field | |
115 | * @return the inclusiveMax | |
116 | */ | |
117 | public String getInclusiveMax() { | |
118 | 0 | return this.inclusiveMax; |
119 | } | |
120 | ||
121 | /** | |
122 | * @param inclusiveMax the inclusiveMax to set | |
123 | */ | |
124 | public void setInclusiveMax(String inclusiveMax) { | |
125 | 0 | this.inclusiveMax = inclusiveMax; |
126 | 0 | } |
127 | ||
128 | /** | |
129 | * The minimum amount of items in this fields list of values - not yet used/do not use | |
130 | * @return the minOccurs | |
131 | */ | |
132 | public Integer getMinOccurs() { | |
133 | 0 | return this.minOccurs; |
134 | } | |
135 | ||
136 | /** | |
137 | * @param minOccurs the minOccurs to set | |
138 | */ | |
139 | public void setMinOccurs(Integer minOccurs) { | |
140 | 0 | this.minOccurs = minOccurs; |
141 | 0 | } |
142 | ||
143 | /** | |
144 | * The maximum amount of items in this field's list of values - not yet used/do not use | |
145 | * @return the maxOccurs | |
146 | */ | |
147 | public Integer getMaxOccurs() { | |
148 | 0 | return this.maxOccurs; |
149 | } | |
150 | ||
151 | /** | |
152 | * @param maxOccurs the maxOccurs to set | |
153 | */ | |
154 | public void setMaxOccurs(Integer maxOccurs) { | |
155 | 0 | this.maxOccurs = maxOccurs; |
156 | 0 | } |
157 | ||
158 | ||
159 | /** | |
160 | * @see org.kuali.rice.krad.datadictionary.validation.constraint.ExistenceConstraint#isRequired() | |
161 | */ | |
162 | @Override | |
163 | public Boolean isRequired() { | |
164 | 0 | return getRequired(); |
165 | } | |
166 | ||
167 | } | |
168 |