| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.student.enrollment.lpr.mock; |
| 17 | |
|
| 18 | |
import org.kuali.student.enrollment.lpr.service.LuiPersonRelationService; |
| 19 | |
import org.kuali.student.common.exceptions.*; |
| 20 | |
import org.kuali.student.enrollment.lpr.dto.LuiPersonRelationInfo; |
| 21 | |
|
| 22 | |
import java.util.*; |
| 23 | |
|
| 24 | |
import org.kuali.student.common.dto.ContextInfo; |
| 25 | |
import org.kuali.student.common.dto.ValidationResultInfo; |
| 26 | |
import org.kuali.student.common.infc.HoldsValidator; |
| 27 | |
import org.kuali.student.datadictionary.DataDictionaryValidatorInfc; |
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | 0 | public class LuiPersonRelationServiceValidationImpl extends LuiPersonRelationServiceAdapter |
| 33 | |
implements LuiPersonRelationService, HoldsValidator { |
| 34 | |
|
| 35 | |
private DataDictionaryValidatorInfc validator; |
| 36 | |
|
| 37 | |
@Override |
| 38 | |
public DataDictionaryValidatorInfc getValidator() { |
| 39 | 0 | return validator; |
| 40 | |
} |
| 41 | |
|
| 42 | |
@Override |
| 43 | |
public void setValidator(DataDictionaryValidatorInfc validator) { |
| 44 | 0 | this.validator = validator; |
| 45 | 0 | } |
| 46 | |
|
| 47 | |
@Override |
| 48 | |
public List<ValidationResultInfo> validateLuiPersonRelation(String validationType, |
| 49 | |
LuiPersonRelationInfo luiPersonRelationInfo, |
| 50 | |
ContextInfo context) |
| 51 | |
throws DoesNotExistException, |
| 52 | |
InvalidParameterException, |
| 53 | |
MissingParameterException, |
| 54 | |
OperationFailedException, |
| 55 | |
PermissionDeniedException { |
| 56 | 0 | return this.validator.validate(DataDictionaryValidatorInfc.ValidationType.fromString(validationType), luiPersonRelationInfo, context); |
| 57 | |
} |
| 58 | |
|
| 59 | |
@Override |
| 60 | |
public String createLuiPersonRelation(String personId, String luiId, |
| 61 | |
String luiPersonRelationType, |
| 62 | |
LuiPersonRelationInfo luiPersonRelationInfo, |
| 63 | |
ContextInfo context) throws |
| 64 | |
AlreadyExistsException, |
| 65 | |
DoesNotExistException, |
| 66 | |
DisabledIdentifierException, |
| 67 | |
InvalidParameterException, |
| 68 | |
MissingParameterException, |
| 69 | |
OperationFailedException, |
| 70 | |
DataValidationErrorException, |
| 71 | |
ReadOnlyException, |
| 72 | |
PermissionDeniedException { |
| 73 | 0 | List<ValidationResultInfo> vris = this.validateLuiPersonRelation(DataDictionaryValidatorInfc.ValidationType.FULL_VALIDATION.name(), |
| 74 | |
luiPersonRelationInfo, context); |
| 75 | 0 | if (!vris.isEmpty()) { |
| 76 | 0 | throw new DataValidationErrorException("Failed validation", vris); |
| 77 | |
} |
| 78 | 0 | return this.getLprService().createLuiPersonRelation(personId, luiId, luiPersonRelationType, luiPersonRelationInfo, context); |
| 79 | |
} |
| 80 | |
|
| 81 | |
@Override |
| 82 | |
public LuiPersonRelationInfo updateLuiPersonRelation(String luiPersonRelationId, |
| 83 | |
LuiPersonRelationInfo luiPersonRelationInfo, |
| 84 | |
ContextInfo context) |
| 85 | |
throws DataValidationErrorException, |
| 86 | |
DoesNotExistException, |
| 87 | |
InvalidParameterException, |
| 88 | |
MissingParameterException, |
| 89 | |
ReadOnlyException, |
| 90 | |
OperationFailedException, |
| 91 | |
PermissionDeniedException, |
| 92 | |
VersionMismatchException { |
| 93 | 0 | List<ValidationResultInfo> vris = this.validateLuiPersonRelation(DataDictionaryValidatorInfc.ValidationType.FULL_VALIDATION.name(), |
| 94 | |
luiPersonRelationInfo, context); |
| 95 | 0 | if (!vris.isEmpty()) { |
| 96 | 0 | throw new DataValidationErrorException("Failed validation", vris); |
| 97 | |
} |
| 98 | 0 | return this.getLprService().updateLuiPersonRelation(luiPersonRelationId, luiPersonRelationInfo, context); |
| 99 | |
} |
| 100 | |
} |
| 101 | |
|