Coverage Report - org.kuali.rice.kns.datadictionary.validation.constraint.MustOccurConstraint
 
Classes in this File Line Coverage Branch Coverage Complexity
MustOccurConstraint
0%
0/13
N/A
1
 
 1  
 package org.kuali.rice.kns.datadictionary.validation.constraint;
 2  
 
 3  
 import java.util.List;
 4  
 
 5  
 import javax.xml.bind.annotation.XmlAccessType;
 6  
 import javax.xml.bind.annotation.XmlAccessorType;
 7  
 import javax.xml.bind.annotation.XmlElement;
 8  
 
 9  
 /**
 10  
  * Must occur constraints are constraints that indicate some range of acceptable valid results. So a must occur constraint
 11  
  * might indicate that between 1 and 3 prequisite constraints must be valid. For example, on a person object, it might be
 12  
  * that one of three fields must be filled in:
 13  
  * 
 14  
  * 1. username
 15  
  * 2. email
 16  
  * 3. phone number
 17  
  * 
 18  
  * By imposing a must occur constraint on the person object iself, and setting three prequisite constraints below it, with a min of 1 
 19  
  * and a max of 3, this requirement can be enforced. 
 20  
  * 
 21  
  * A more complicated example might be that a US address is only valid if it provides either:
 22  
  * (a) a city and state, or
 23  
  * (b) a postal code
 24  
  * 
 25  
  * To enforce this, a single must occur constraint would have two children: (1) a prequisite constraint on postal code, and (2) a must occur constraint
 26  
  * with two child prequisite constraints, on city and state, respectively. By setting min=1/max=2 at the top must occur constraint, 
 27  
  * and min=2/max=2 at the leaf constraint, this requirement can be enforced.
 28  
  * 
 29  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 30  
  * @since 1.1
 31  
  */
 32  
 @XmlAccessorType(XmlAccessType.FIELD)
 33  0
 public class MustOccurConstraint extends BaseConstraint {
 34  
         
 35  
     @XmlElement
 36  
     private List<PrerequisiteConstraint> prerequisiteConstraints;
 37  
         @XmlElement
 38  
     private List<MustOccurConstraint> mustOccurConstraints;
 39  
         @XmlElement
 40  
         private Integer min;
 41  
         @XmlElement
 42  
         private Integer max;
 43  
 
 44  
         public List<PrerequisiteConstraint> getPrerequisiteConstraints() {
 45  0
                 return prerequisiteConstraints;
 46  
         }
 47  
 
 48  
         public void setPrerequisiteConstraints(List<PrerequisiteConstraint> prerequisiteConstraints) {
 49  0
                 this.prerequisiteConstraints = prerequisiteConstraints;
 50  0
         }
 51  
 
 52  
         public List<MustOccurConstraint> getMustOccurConstraints() {
 53  0
                 return mustOccurConstraints;
 54  
         }
 55  
 
 56  
         public void setMustOccurConstraints(List<MustOccurConstraint> occurs) {
 57  0
                 this.mustOccurConstraints = occurs;
 58  0
         }
 59  
 
 60  
         public Integer getMin() {
 61  0
                 return min;
 62  
         }
 63  
 
 64  
         public void setMin(Integer min) {
 65  0
                 this.min = min;
 66  0
         }
 67  
 
 68  
         public Integer getMax() {
 69  0
                 return max;
 70  
         }
 71  
 
 72  
         public void setMax(Integer max) {
 73  0
                 this.max = max;
 74  0
         }
 75  
 }