Clover Coverage Report - KS Services API 0.0.1-SNAPSHOT
Coverage timestamp: Wed Dec 31 1969 19:00:00 EST
../../../../img/srcFileCovDistChart0.png 0% of files have more coverage
20   67   7   20
2   38   0.35   1
1     7  
1    
 
  Rice2ValidationResultConverter       Line # 33 20 0% 7 23 0% 0.0
 
No Tests
 
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    public class Rice2ValidationResultConverter {
34   
35    private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(Rice2ValidationResultConverter.class);
36   
 
37  0 toggle 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  0 case OK:
45  0 continue;
46  0 case NOCONSTRAINT:
47  0 continue;
48  0 case INAPPLICABLE:
49  0 continue;
50  0 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  0 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    }
65  0 return vrs;
66    }
67    }