1 | |
package org.kuali.student.r2.core.classI.atp.service.decorators; |
2 | |
|
3 | |
import java.util.List; |
4 | |
|
5 | |
import org.kuali.student.r2.common.datadictionary.DataDictionaryValidator; |
6 | |
import org.kuali.student.r2.common.dto.ContextInfo; |
7 | |
import org.kuali.student.r2.common.dto.ValidationResultInfo; |
8 | |
import org.kuali.student.r2.common.exceptions.DoesNotExistException; |
9 | |
import org.kuali.student.r2.common.exceptions.InvalidParameterException; |
10 | |
import org.kuali.student.r2.common.exceptions.MissingParameterException; |
11 | |
import org.kuali.student.r2.common.exceptions.OperationFailedException; |
12 | |
import org.kuali.student.r2.common.exceptions.PermissionDeniedException; |
13 | |
import org.kuali.student.r2.common.infc.HoldsValidator; |
14 | |
import org.kuali.student.r2.core.atp.dto.AtpInfo; |
15 | |
import org.kuali.student.r2.core.atp.dto.MilestoneInfo; |
16 | |
import org.kuali.student.r2.core.atp.service.AtpServiceDecorator; |
17 | |
|
18 | 0 | public class AtpServiceValidationDecorator extends AtpServiceDecorator implements HoldsValidator{ |
19 | |
private DataDictionaryValidator validator; |
20 | |
|
21 | |
@Override |
22 | |
public DataDictionaryValidator getValidator() { |
23 | 0 | return validator; |
24 | |
} |
25 | |
|
26 | |
@Override |
27 | |
public void setValidator(DataDictionaryValidator validator) { |
28 | 0 | this.validator = validator; |
29 | 0 | } |
30 | |
|
31 | |
@Override |
32 | |
public List<ValidationResultInfo> validateAtp( |
33 | |
String validationType, |
34 | |
AtpInfo atpInfo, |
35 | |
ContextInfo context) |
36 | |
throws DoesNotExistException, |
37 | |
InvalidParameterException, |
38 | |
MissingParameterException, |
39 | |
OperationFailedException { |
40 | |
|
41 | |
try{ |
42 | 0 | this.validator.validate(DataDictionaryValidator.ValidationType.fromString(validationType), atpInfo, context); |
43 | 0 | }catch(PermissionDeniedException ex){ |
44 | 0 | throw new OperationFailedException(); |
45 | 0 | } |
46 | |
|
47 | 0 | return this.nextDecorator.validateAtp(validationType, atpInfo, context); |
48 | |
|
49 | |
} |
50 | |
|
51 | |
@Override |
52 | |
public List<ValidationResultInfo> validateMilestone(String validationType, MilestoneInfo milestoneInfo, ContextInfo context) |
53 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { |
54 | |
|
55 | |
try{ |
56 | 0 | this.validator.validate(DataDictionaryValidator.ValidationType.fromString(validationType), milestoneInfo, context); |
57 | 0 | } catch(PermissionDeniedException ex){ |
58 | 0 | throw new OperationFailedException(); |
59 | 0 | } |
60 | |
|
61 | 0 | return this.nextDecorator.validateMilestone(validationType, milestoneInfo, context); |
62 | |
} |
63 | |
|
64 | |
|
65 | |
|
66 | |
} |