Coverage Report - org.kuali.student.datadictionary.Rice2ValidationResultConverter
 
Classes in this File Line Coverage Branch Coverage Complexity
Rice2ValidationResultConverter
0%
0/18
0%
0/8
7
Rice2ValidationResultConverter$1
0%
0/1
N/A
7
 
 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.ArrayList;
 19  
 import java.util.Iterator;
 20  
 import java.util.List;
 21  
 
 22  
 import org.kuali.student.common.dto.ValidationResultInfo;
 23  
 import org.kuali.student.common.infc.ValidationResult;
 24  
 
 25  
 import org.kuali.rice.kns.datadictionary.validation.ErrorLevel;
 26  
 import org.kuali.rice.kns.datadictionary.validation.result.DictionaryValidationResult;
 27  
 import org.kuali.rice.kns.datadictionary.validation.result.ConstraintValidationResult;
 28  
 
 29  
 /**
 30  
  *
 31  
  * @author nwright
 32  
  */
 33  0
 public class Rice2ValidationResultConverter {
 34  
 
 35  0
     private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(Rice2ValidationResultConverter.class);
 36  
 
 37  
     public List<ValidationResultInfo> convert(DictionaryValidationResult riceResult) {
 38  0
         List<ValidationResultInfo> vrs = new ArrayList<ValidationResultInfo>();
 39  0
         Iterator<ConstraintValidationResult> it = riceResult.iterator();
 40  0
         while (it.hasNext()) {
 41  0
             ValidationResultInfo vr = null;
 42  0
             ConstraintValidationResult cvr = it.next();
 43  0
             switch (cvr.getStatus()) {
 44  
                 case OK:
 45  0
                     continue;
 46  
                 case NOCONSTRAINT:
 47  0
                     continue;
 48  
                 case INAPPLICABLE:
 49  0
                     continue;
 50  
                 case ERROR:
 51  0
                     ValidationResultInfo.Builder vrBuilder = new ValidationResultInfo.Builder();
 52  0
                     vrBuilder.setElement(cvr.getAttributeName());
 53  0
                     vrBuilder.setError(cvr.getErrorKey());
 54  0
                     vrs.add(vrBuilder.build());
 55  
                 case WARN:
 56  0
                     LOG.debug("Skipping warning " + cvr.getEntryName()
 57  
                       + "." + cvr.getAttributeName() + " " +
 58  
                       cvr.getErrorKey() + " " + cvr.getConstraintName());
 59  
 //                    vr = new ValidationResultInfo();
 60  
 //                    vr.setElement(cvr.getAttributeName());
 61  
 //                    vr.setWarning(cvr.getErrorKey());
 62  
 //                    vrs.add(vr);
 63  
             }
 64  0
         }
 65  0
         return vrs;
 66  
     }
 67  
 }