View Javadoc

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