Coverage Report - org.kuali.rice.krad.datadictionary.validation.processor.ConstraintProcessor
 
Classes in this File Line Coverage Branch Coverage Complexity
ConstraintProcessor
N/A
N/A
1
 
 1  
 /**
 2  
  * Copyright 2005-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.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/ecl2.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.krad.datadictionary.validation.processor;
 17  
 
 18  
 
 19  
 import org.kuali.rice.krad.datadictionary.exception.AttributeValidationException;
 20  
 import org.kuali.rice.krad.datadictionary.validation.AttributeValueReader;
 21  
 import org.kuali.rice.krad.datadictionary.validation.constraint.Constraint;
 22  
 import org.kuali.rice.krad.datadictionary.validation.result.DictionaryValidationResult;
 23  
 import org.kuali.rice.krad.datadictionary.validation.result.ProcessorResult;
 24  
 
 25  
 /**
 26  
  * This interface must be implemented by constraint processors, which validate individual constraints in the
 27  
  * data dictionary. The idea is that each constraint has its own processor, and that the validation service can be configured
 28  
  * via dependency injection with a list of processors. This gives institutions the ability to easily modify how validation
 29  
  * should be handled and to add arbitrary new constraints and constraint processors. An alternative might have been to put
 30  
  * the process() method into the Constraint marker interface and have each Constraint define its own processing, but that would
 31  
  * have forced business logic into what are naturally API classes (classes that implement Constraint). This strategy separates
 32  
  * the two functions. 
 33  
  * 
 34  
  * @author Kuali Rice Team (rice.collab@kuali.org) 
 35  
  */
 36  
 public interface ConstraintProcessor<T, C extends Constraint> {
 37  
 
 38  
         public ProcessorResult process(DictionaryValidationResult result, T value, C constraint, AttributeValueReader attributeValueReader) throws AttributeValidationException;
 39  
         
 40  
         public String getName();
 41  
         
 42  
         public Class<? extends Constraint> getConstraintType();
 43  
         
 44  
         /**
 45  
          * This method return true if the processing of this constraint is something that can be opted out of by some pieces of code.
 46  
          * The only example of this in the version under development (1.1) is the existence constraint. 
 47  
          * 
 48  
          * @return true if this processor can be turned off by some pieces of code, false otherwise
 49  
          */
 50  
         public boolean isOptional();
 51  
         
 52  
 }