Coverage Report - org.kuali.rice.kns.datadictionary.validation.result.ConstraintValidationResult
 
Classes in this File Line Coverage Branch Coverage Complexity
ConstraintValidationResult
0%
0/45
N/A
1
 
 1  
 /*
 2  
  * Copyright 2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 1.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/ecl1.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.kns.datadictionary.validation.result;
 17  
 
 18  
 import java.util.LinkedList;
 19  
 import java.util.List;
 20  
 
 21  
 import org.kuali.rice.kns.datadictionary.validation.ErrorLevel;
 22  
 import org.kuali.rice.kns.datadictionary.validation.constraint.Constraint;
 23  
 import org.kuali.rice.kns.datadictionary.validation.processor.ConstraintProcessor;
 24  
 
 25  
 /**
 26  
  * This is a composite class for all the different members that need to be returned when a {@link ConstraintProcessor}
 27  
  * processes a {@link Constraint}. 
 28  
  * 
 29  
  * @author Kuali Rice Team (rice.collab@kuali.org) 
 30  
  */
 31  
 public class ConstraintValidationResult {
 32  
         
 33  
         private String entryName;
 34  
         private String attributeName;
 35  
         private String attributePath;
 36  
         private String constraintName;
 37  
         private ErrorLevel level;
 38  
         
 39  
         private String errorKey;
 40  
         private String[] errorParameters;
 41  
         private String constraintLabelKey;
 42  
         
 43  
         private List<ConstraintValidationResult> children;
 44  
         
 45  
         
 46  0
         public ConstraintValidationResult(String constraintName) {
 47  0
                 this.constraintName = constraintName;
 48  0
                 this.children = new LinkedList<ConstraintValidationResult>();
 49  0
                 this.level = ErrorLevel.OK;
 50  0
         }
 51  
         
 52  0
         public ConstraintValidationResult(String constraintName, ErrorLevel level) {
 53  0
                 this.constraintName = constraintName;
 54  0
                 this.children = new LinkedList<ConstraintValidationResult>();
 55  0
                 this.level = level;
 56  0
         }
 57  
         
 58  
         public void addChild(ConstraintValidationResult child) {
 59  0
                 this.children.add(child);
 60  0
         }
 61  
         
 62  
         public void setError(String errorKey, String... errorParameters) {
 63  0
                 this.level = ErrorLevel.ERROR;
 64  0
                 this.errorKey = errorKey;
 65  0
                 this.errorParameters = errorParameters;
 66  0
         }
 67  
         
 68  
         public void setWarning(String errorKey, String... errorParameters) {
 69  0
                 this.level = ErrorLevel.WARN;
 70  0
                 this.errorKey = errorKey;
 71  0
                 this.errorParameters = errorParameters;
 72  0
         }
 73  
 
 74  
         /**
 75  
          * @return the level
 76  
          */
 77  
         public ErrorLevel getStatus() {
 78  0
                 return this.level;
 79  
         }
 80  
 
 81  
         /**
 82  
          * @param level the level to set
 83  
          */
 84  
         public void setStatus(ErrorLevel level) {
 85  0
                 this.level = level;
 86  0
         }
 87  
 
 88  
         /**
 89  
          * @return the errorKey
 90  
          */
 91  
         public String getErrorKey() {
 92  0
                 return this.errorKey;
 93  
         }
 94  
 
 95  
         /**
 96  
          * @param errorKey the errorKey to set
 97  
          */
 98  
         public void setErrorKey(String errorKey) {
 99  0
                 this.errorKey = errorKey;
 100  0
         }
 101  
 
 102  
         /**
 103  
          * @return the errorParameters
 104  
          */
 105  
         public String[] getErrorParameters() {
 106  0
                 return this.errorParameters;
 107  
         }
 108  
 
 109  
         /**
 110  
          * @param errorParameters the errorParameters to set
 111  
          */
 112  
         public void setErrorParameters(String[] errorParameters) {
 113  0
                 this.errorParameters = errorParameters;
 114  0
         }
 115  
 
 116  
         /**
 117  
          * @return the entryName
 118  
          */
 119  
         public String getEntryName() {
 120  0
                 return this.entryName;
 121  
         }
 122  
 
 123  
         /**
 124  
          * @param entryName the entryName to set
 125  
          */
 126  
         public void setEntryName(String entryName) {
 127  0
                 this.entryName = entryName;
 128  0
         }
 129  
 
 130  
         /**
 131  
          * @return the attributeName
 132  
          */
 133  
         public String getAttributeName() {
 134  0
                 return this.attributeName;
 135  
         }
 136  
 
 137  
         /**
 138  
          * @param attributeName the attributeName to set
 139  
          */
 140  
         public void setAttributeName(String attributeName) {
 141  0
                 this.attributeName = attributeName;
 142  0
         }
 143  
 
 144  
         /**
 145  
          * @return the constraintName
 146  
          */
 147  
         public String getConstraintName() {
 148  0
                 return this.constraintName;
 149  
         }
 150  
 
 151  
         /**
 152  
          * @param constraintName the constraintName to set
 153  
          */
 154  
         public void setConstraintName(String constraintName) {
 155  0
                 this.constraintName = constraintName;
 156  0
         }
 157  
 
 158  
         /**
 159  
          * @return the children
 160  
          */
 161  
         public List<ConstraintValidationResult> getChildren() {
 162  0
                 return this.children;
 163  
         }
 164  
 
 165  
         /**
 166  
          * @return the constraintLabelKey
 167  
          */
 168  
         public String getConstraintLabelKey() {
 169  0
                 return this.constraintLabelKey;
 170  
         }
 171  
 
 172  
         /**
 173  
          * @param constraintLabelKey the constraintLabelKey to set
 174  
          */
 175  
         public void setConstraintLabelKey(String constraintLabelKey) {
 176  0
                 this.constraintLabelKey = constraintLabelKey;
 177  0
         }
 178  
 
 179  
         /**
 180  
          * @return the attributePath
 181  
          */
 182  
         public String getAttributePath() {
 183  0
                 return this.attributePath;
 184  
         }
 185  
 
 186  
         /**
 187  
          * @param attributePath the attributePath to set
 188  
          */
 189  
         public void setAttributePath(String attributePath) {
 190  0
                 this.attributePath = attributePath;
 191  0
         }
 192  
         
 193  
 }