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