Coverage Report - org.kuali.student.datadictionary.RiceDataDictionaryValidatorImplDoesNotWorkButShould
 
Classes in this File Line Coverage Branch Coverage Complexity
RiceDataDictionaryValidatorImplDoesNotWorkButShould
0%
0/15
0%
0/2
1.2
 
 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.student.datadictionary;
 17  
 
 18  
 import java.util.List;
 19  
 import org.kuali.rice.kns.datadictionary.validation.result.DictionaryValidationResult;
 20  
 import org.kuali.rice.kns.service.DictionaryValidationService;
 21  
 import org.kuali.student.datadictionary.DataDictionaryValidatorInfc.ValidationType;
 22  
 import org.kuali.student.r2.common.dto.ContextInfo;
 23  
 import org.kuali.student.r2.common.dto.ValidationResultInfo;
 24  
 import org.kuali.student.r2.common.exceptions.InvalidParameterException;
 25  
 import org.kuali.student.r2.common.exceptions.MissingParameterException;
 26  
 import org.kuali.student.r2.common.exceptions.OperationFailedException;
 27  
 import org.kuali.student.r2.common.exceptions.PermissionDeniedException;
 28  
 
 29  
 
 30  
 /**
 31  
  * This is an adapter that calls rice to do the valication
 32  
  *
 33  
  * TODO: figure why this does not validate anything
 34  
  *
 35  
  * @author nwright
 36  
  */
 37  
 public class RiceDataDictionaryValidatorImplDoesNotWorkButShould implements DataDictionaryValidatorInfc {
 38  
 
 39  
     private DictionaryValidationService riceService;
 40  
 
 41  0
     public RiceDataDictionaryValidatorImplDoesNotWorkButShould() {
 42  0
     }
 43  
 
 44  
 
 45  0
     public RiceDataDictionaryValidatorImplDoesNotWorkButShould(DictionaryValidationService riceService) {
 46  0
         this.riceService = riceService;
 47  0
     }
 48  
 
 49  
     public DictionaryValidationService getRiceService() {
 50  0
         return riceService;
 51  
     }
 52  
 
 53  
     public void setRiceService(DictionaryValidationService riceService) {
 54  0
         this.riceService = riceService;
 55  0
     }
 56  
 
 57  
     @Override
 58  
     public List<ValidationResultInfo> validate(ValidationType validationType, Object info, ContextInfo context)
 59  
             throws OperationFailedException, MissingParameterException, InvalidParameterException, PermissionDeniedException {
 60  0
        boolean doOptionalProcessing = true;
 61  
 //       @param doOptionalProcessing true if the validation should do optional validation
 62  
 //       (e.g. to check if empty values are required or not), false otherwise
 63  0
        if (validationType.equals(DataDictionaryValidatorInfc.ValidationType.SKIP_REQUREDNESS_VALIDATIONS)) {
 64  0
            doOptionalProcessing = false;
 65  
        }
 66  0
         DictionaryValidationResult dvr = riceService.validate(info, doOptionalProcessing);
 67  0
         Rice2ValidationResultConverter converter = new Rice2ValidationResultConverter ();
 68  0
         List<ValidationResultInfo> vrs = converter.convert(dvr);
 69  0
         return vrs;
 70  
     }
 71  
 }