| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 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 | |
|
| 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 | |
|
| 58 | |
|
| 59 | |
|
| 60 | |
|
| 61 | |
} |
| 62 | 0 | } |
| 63 | 0 | return vrs; |
| 64 | |
} |
| 65 | |
} |