| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
package org.kuali.student.datadictionary; |
| 17 |
|
|
| 18 |
|
import java.util.List; |
| 19 |
|
import org.kuali.rice.kns.datadictionary.DataObjectEntry; |
| 20 |
|
import org.kuali.rice.kns.datadictionary.validation.result.DictionaryValidationResult; |
| 21 |
|
import org.kuali.rice.kns.service.DictionaryValidationService; |
| 22 |
|
import org.kuali.student.common.dto.ContextInfo; |
| 23 |
|
import org.kuali.student.common.dto.ValidationResultInfo; |
| 24 |
|
import org.kuali.student.common.exceptions.InvalidParameterException; |
| 25 |
|
import org.kuali.student.common.exceptions.MissingParameterException; |
| 26 |
|
import org.kuali.student.common.exceptions.OperationFailedException; |
| 27 |
|
import org.kuali.student.common.exceptions.PermissionDeniedException; |
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
|
| 37 |
|
|
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
@author |
| 42 |
|
|
|
|
|
| 0% |
Uncovered Elements: 26 (26) |
Complexity: 8 |
Complexity Density: 0.5 |
|
| 43 |
|
public class RiceDataDictionaryValidatorImpl implements DataDictionaryValidatorInfc { |
| 44 |
|
|
| 45 |
|
private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(RiceDataDictionaryValidatorImpl.class); |
| 46 |
|
private RiceDataDictionaryServiceInfc riceDataDictionaryService; |
| 47 |
|
private DictionaryValidationService riceDictionaryValidationService; |
| 48 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 49 |
0
|
public RiceDataDictionaryValidatorImpl() {... |
| 50 |
|
} |
| 51 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 52 |
0
|
public RiceDataDictionaryServiceInfc getRiceDataDictionaryService() {... |
| 53 |
0
|
return riceDataDictionaryService; |
| 54 |
|
} |
| 55 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 56 |
0
|
public void setRiceDataDictionaryService(RiceDataDictionaryServiceInfc riceDataDictionaryService) {... |
| 57 |
0
|
this.riceDataDictionaryService = riceDataDictionaryService; |
| 58 |
|
} |
| 59 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 60 |
0
|
public DictionaryValidationService getRiceDictionaryValidationService() {... |
| 61 |
0
|
return riceDictionaryValidationService; |
| 62 |
|
} |
| 63 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 64 |
0
|
public void setRiceDictionaryValidationService(DictionaryValidationService riceDictionaryValidationService) {... |
| 65 |
0
|
this.riceDictionaryValidationService = riceDictionaryValidationService; |
| 66 |
|
} |
| 67 |
|
|
| 68 |
|
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 3 |
Complexity Density: 0.25 |
|
| 69 |
0
|
@Override... |
| 70 |
|
public List<ValidationResultInfo> validate(ValidationType validationType, Object info, ContextInfo context) |
| 71 |
|
throws OperationFailedException, MissingParameterException, InvalidParameterException, PermissionDeniedException { |
| 72 |
0
|
boolean doOptionalProcessing = true; |
| 73 |
|
|
| 74 |
|
|
| 75 |
0
|
if (validationType.equals(DataDictionaryValidatorInfc.ValidationType.SKIP_REQUREDNESS_VALIDATIONS)) { |
| 76 |
0
|
doOptionalProcessing = false; |
| 77 |
|
} |
| 78 |
0
|
String entryName = info.getClass().getName(); |
| 79 |
0
|
DataObjectEntry dictEntry; |
| 80 |
0
|
dictEntry = this.riceDataDictionaryService.getDataObjectEntry(entryName); |
| 81 |
0
|
if (dictEntry == null) { |
| 82 |
0
|
throw new OperationFailedException("Dictionary entry for " + entryName + " does not exist"); |
| 83 |
|
} |
| 84 |
0
|
DictionaryValidationResult dvr = this.riceDictionaryValidationService.validate(info, |
| 85 |
|
entryName, |
| 86 |
|
dictEntry, |
| 87 |
|
doOptionalProcessing); |
| 88 |
0
|
Rice2ValidationResultConverter converter = new Rice2ValidationResultConverter(); |
| 89 |
0
|
List<ValidationResultInfo> vrs = converter.convert(dvr); |
| 90 |
0
|
return vrs; |
| 91 |
|
} |
| 92 |
|
} |