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 java.util.ArrayList;
21 import java.util.List;
22
23 /**
24 * A when constraint is a child of a case constraint. It provides a specific additional constraint that should be processed when
25 * the condition itself is true.
26 *
27 * So a case constraint on country, might have a when constraint with value='USA', and another with value='Canada'. Each of these
28 * when constraints would define a constraint of their own that would only be processed when the country was USA, or when the country
29 * was Canada.
30 *
31 * @author Kuali Rice Team (rice.collab@kuali.org)
32 * @since 1.1
33 */
34 @XmlAccessorType(XmlAccessType.FIELD)
35 public class WhenConstraint implements Constraint {
36 protected List<Object> values;
37 protected String valuePath;
38 protected Constraint constraint;
39
40 public List<Object> getValues() {
41 return values;
42 }
43
44 public void setValues(List<Object> values) {
45 this.values = values;
46 }
47
48 public void setValue(Object value) {
49 values = new ArrayList<Object>();
50 values.add(value);
51 }
52
53 public String getValuePath() {
54 return valuePath;
55 }
56
57 public void setValuePath(String valuePath) {
58 this.valuePath = valuePath;
59 }
60
61 public Constraint getConstraint() {
62 return constraint;
63 }
64
65 public void setConstraint(Constraint constraint) {
66 this.constraint = constraint;
67 }
68 }