Coverage Report - org.kuali.rice.kns.datadictionary.validation.result.ProcessorResult
 
Classes in this File Line Coverage Branch Coverage Complexity
ProcessorResult
0%
0/24
0%
0/8
1.083
 
 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.Arrays;
 19  
 import java.util.Collections;
 20  
 import java.util.List;
 21  
 
 22  
 import org.kuali.rice.kns.datadictionary.validation.AttributeValueReader;
 23  
 import org.kuali.rice.kns.datadictionary.validation.capability.Constrainable;
 24  
 import org.kuali.rice.kns.datadictionary.validation.constraint.Constraint;
 25  
 
 26  
 /**
 27  
  * 
 28  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 29  
  */
 30  
 public class ProcessorResult {
 31  
 
 32  
         private final transient List<Constraint> constraints;
 33  
         private final transient Constrainable definition;
 34  
         private final transient AttributeValueReader attributeValueReader;
 35  
         
 36  
         private final List<ConstraintValidationResult> constraintValidationResults;
 37  
         
 38  
         public ProcessorResult(ConstraintValidationResult constraintValidationResult) {
 39  0
                 this(constraintValidationResult, null, null);
 40  0
         }
 41  
         
 42  0
         public ProcessorResult(ConstraintValidationResult constraintValidationResult, Constrainable definition, AttributeValueReader attributeValueReader, Constraint... constraints) {
 43  0
                 this.constraintValidationResults = Collections.singletonList(constraintValidationResult);
 44  0
                 this.definition = definition;
 45  0
                 this.attributeValueReader = attributeValueReader;
 46  0
                 this.constraints = Arrays.asList(constraints);
 47  0
         }
 48  
         
 49  
         public ProcessorResult(List<ConstraintValidationResult> constraintValidationResults) {
 50  0
                 this(constraintValidationResults, null, null);
 51  0
         }
 52  
         
 53  0
         public ProcessorResult(List<ConstraintValidationResult> constraintValidationResults, Constrainable definition, AttributeValueReader attributeValueReader, Constraint... constraints) {
 54  0
                 this.constraintValidationResults = constraintValidationResults;
 55  0
                 this.definition = definition;
 56  0
                 this.attributeValueReader = attributeValueReader;
 57  0
                 this.constraints = Arrays.asList(constraints);
 58  0
         }
 59  
         
 60  
         public boolean isSingleConstraintResult() {
 61  0
                 return this.constraintValidationResults.size() == 1;
 62  
         }
 63  
 
 64  
         public boolean isDefinitionProvided() {
 65  0
                 return definition != null;
 66  
         }
 67  
         
 68  
         public boolean isAttributeValueReaderProvided() {
 69  0
                 return attributeValueReader != null;
 70  
         }
 71  
         
 72  
         public ConstraintValidationResult getFirstConstraintValidationResult() {
 73  0
                 return this.constraintValidationResults.isEmpty() ? null : this.constraintValidationResults.get(0);
 74  
         }
 75  
         
 76  
         /**
 77  
          * @return the constraintValidationResults
 78  
          */
 79  
         public List<ConstraintValidationResult> getConstraintValidationResults() {
 80  0
                 return this.constraintValidationResults;
 81  
         }
 82  
 
 83  
         /**
 84  
          * @return the definition
 85  
          */
 86  
         public Constrainable getDefinition() {
 87  0
                 return this.definition;
 88  
         }
 89  
 
 90  
         /**
 91  
          * @return the attributeValueReader
 92  
          */
 93  
         public AttributeValueReader getAttributeValueReader() {
 94  0
                 return this.attributeValueReader;
 95  
         }
 96  
 
 97  
         /**
 98  
          * @return the constraints
 99  
          */
 100  
         public List<Constraint> getConstraints() {
 101  0
                 return this.constraints;
 102  
         }
 103  
                 
 104  
 }