1 | |
package org.kuali.student.enrollment.classII.acal.service.decorators; |
2 | |
|
3 | |
import java.util.List; |
4 | |
|
5 | |
import org.kuali.student.enrollment.acal.dto.AcademicCalendarInfo; |
6 | |
import org.kuali.student.enrollment.acal.dto.TermInfo; |
7 | |
import org.kuali.student.enrollment.acal.service.AcademicCalendarServiceDecorator; |
8 | |
import org.kuali.student.r2.common.datadictionary.DataDictionaryValidator; |
9 | |
import org.kuali.student.r2.common.dto.ContextInfo; |
10 | |
import org.kuali.student.r2.common.dto.ValidationResultInfo; |
11 | |
import org.kuali.student.r2.common.exceptions.DoesNotExistException; |
12 | |
import org.kuali.student.r2.common.exceptions.InvalidParameterException; |
13 | |
import org.kuali.student.r2.common.exceptions.MissingParameterException; |
14 | |
import org.kuali.student.r2.common.exceptions.OperationFailedException; |
15 | |
import org.kuali.student.r2.common.exceptions.PermissionDeniedException; |
16 | |
import org.kuali.student.r2.common.infc.HoldsValidator; |
17 | |
|
18 | |
|
19 | 0 | public class AcademicCalendarServiceValidationDecorator extends AcademicCalendarServiceDecorator implements HoldsValidator{ |
20 | |
private DataDictionaryValidator validator; |
21 | |
|
22 | |
@Override |
23 | |
public DataDictionaryValidator getValidator() { |
24 | 0 | return validator; |
25 | |
} |
26 | |
|
27 | |
@Override |
28 | |
public void setValidator(DataDictionaryValidator validator) { |
29 | 0 | this.validator = validator; |
30 | 0 | } |
31 | |
|
32 | |
@Override |
33 | |
public List<ValidationResultInfo> validateAcademicCalendar(String validationType, |
34 | |
AcademicCalendarInfo acalInfo, ContextInfo context) throws DoesNotExistException, |
35 | |
InvalidParameterException, MissingParameterException, OperationFailedException { |
36 | |
try{ |
37 | 0 | this.validator.validate(DataDictionaryValidator.ValidationType.fromString(validationType), acalInfo, context); |
38 | 0 | }catch(PermissionDeniedException ex){ |
39 | 0 | throw new OperationFailedException(); |
40 | 0 | } |
41 | 0 | return this.nextDecorator.validateAcademicCalendar(validationType, acalInfo, context); |
42 | |
} |
43 | |
|
44 | |
@Override |
45 | |
public List<ValidationResultInfo> validateTerm(String validationType, |
46 | |
TermInfo termInfo, ContextInfo context) |
47 | |
throws DoesNotExistException, InvalidParameterException, |
48 | |
MissingParameterException, OperationFailedException { |
49 | |
try{ |
50 | 0 | this.validator.validate(DataDictionaryValidator.ValidationType.fromString(validationType), termInfo, context); |
51 | 0 | }catch(PermissionDeniedException ex){ |
52 | 0 | throw new OperationFailedException(); |
53 | 0 | } |
54 | 0 | return this.nextDecorator.validateTerm(validationType,termInfo, context); |
55 | |
} |
56 | |
|
57 | |
} |