Coverage Report - org.kuali.rice.krad.datadictionary.validation.constraint.WhenConstraint
 
Classes in this File Line Coverage Branch Coverage Complexity
WhenConstraint
69%
9/13
N/A
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 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  5
 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  2
                 return values;
 27  
         }
 28  
 
 29  
         public void setValues(List<Object> values) {
 30  0
         this.values = values;
 31  0
     }
 32  
 
 33  
     public void setValue(Object value) {            
 34  5
             values = new ArrayList<Object>();
 35  5
             values.add(value);
 36  5
         }
 37  
 
 38  
         public String getValuePath() {
 39  1
                 return valuePath;
 40  
         }
 41  
 
 42  
         public void setValuePath(String valuePath) {
 43  0
                 this.valuePath = valuePath;
 44  0
         }
 45  
 
 46  
         public Constraint getConstraint() {
 47  2
                 return constraint;
 48  
         }
 49  
 
 50  
         public void setConstraint(Constraint constraint) {
 51  5
                 this.constraint = constraint;
 52  5
         }
 53  
 }