Coverage Report - org.kuali.rice.kns.datadictionary.validation.processor.PrerequisiteConstraintProcessor
 
Classes in this File Line Coverage Branch Coverage Complexity
PrerequisiteConstraintProcessor
0%
0/8
0%
0/2
1.667
 
 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.processor;
 17  
 
 18  
 import org.kuali.rice.kns.datadictionary.exception.AttributeValidationException;
 19  
 import org.kuali.rice.kns.datadictionary.validation.AttributeValueReader;
 20  
 import org.kuali.rice.kns.datadictionary.validation.ValidationUtils;
 21  
 import org.kuali.rice.kns.datadictionary.validation.constraint.Constraint;
 22  
 import org.kuali.rice.kns.datadictionary.validation.constraint.PrerequisiteConstraint;
 23  
 import org.kuali.rice.kns.datadictionary.validation.result.ConstraintValidationResult;
 24  
 import org.kuali.rice.kns.datadictionary.validation.result.DictionaryValidationResult;
 25  
 import org.kuali.rice.kns.datadictionary.validation.result.ProcessorResult;
 26  
 
 27  
 /**
 28  
  * 
 29  
  * @author Kuali Rice Team (rice.collab@kuali.org) 
 30  
  */
 31  0
 public class PrerequisiteConstraintProcessor extends BasePrerequisiteConstraintProcessor<PrerequisiteConstraint> {
 32  
         
 33  
         private static final String CONSTRAINT_NAME = "prerequisite constraint";
 34  
 
 35  
         
 36  
         /**
 37  
          * @see org.kuali.rice.kns.datadictionary.validation.processor.ConstraintProcessor#process(DictionaryValidationResult, Object, org.kuali.rice.kns.datadictionary.validation.capability.Validatable, org.kuali.rice.kns.datadictionary.validation.AttributeValueReader)
 38  
          */
 39  
         @Override
 40  
         public ProcessorResult process(DictionaryValidationResult result, Object value, PrerequisiteConstraint constraint, AttributeValueReader attributeValueReader) throws AttributeValidationException {
 41  
 
 42  0
                 if (ValidationUtils.isNullOrEmpty(value))
 43  0
                         return new ProcessorResult(result.addSkipped(attributeValueReader, CONSTRAINT_NAME));
 44  
                 
 45  
 
 46  0
                 ConstraintValidationResult constraintValidationResult = processPrerequisiteConstraint(constraint, attributeValueReader);
 47  0
                 result.addConstraintValidationResult(attributeValueReader, constraintValidationResult);
 48  
 
 49  
                 
 50  0
                 return new ProcessorResult(constraintValidationResult);
 51  
         }
 52  
 
 53  
         @Override 
 54  
         public String getName() {
 55  0
                 return CONSTRAINT_NAME;
 56  
         }
 57  
         
 58  
         /**
 59  
          * @see org.kuali.rice.kns.datadictionary.validation.processor.ConstraintProcessor#getConstraintType()
 60  
          */
 61  
         @Override
 62  
         public Class<? extends Constraint> getConstraintType() {
 63  0
                 return PrerequisiteConstraint.class;
 64  
         }
 65  
 
 66  
 }