1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
package org.kuali.student.r2.core.class1.process; |
6 | |
|
7 | |
import java.util.ArrayList; |
8 | |
import java.util.List; |
9 | |
import org.kuali.student.enrollment.courseregistration.service.CourseRegistrationService; |
10 | |
import org.kuali.student.enrollment.class2.courseregistration.service.decorators.CourseRegistrationServiceDecorator; |
11 | |
import org.kuali.student.r2.common.dto.ContextInfo; |
12 | |
import org.kuali.student.r2.common.dto.ValidationResultInfo; |
13 | |
import org.kuali.student.r2.common.exceptions.DoesNotExistException; |
14 | |
import org.kuali.student.r2.common.exceptions.InvalidParameterException; |
15 | |
import org.kuali.student.r2.common.exceptions.MissingParameterException; |
16 | |
import org.kuali.student.r2.common.exceptions.OperationFailedException; |
17 | |
import org.kuali.student.r2.common.exceptions.PermissionDeniedException; |
18 | |
import org.kuali.student.r2.common.infc.ValidationResult; |
19 | |
import org.kuali.student.r2.common.util.constants.ProcessServiceConstants; |
20 | |
import org.kuali.student.r2.core.class1.process.context.CourseRegistrationProcessContextInfo; |
21 | |
import org.kuali.student.r2.core.class1.process.evaluator.ProcessEvaluator; |
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
public class CourseRegistrationServiceProcessCheckDecorator |
28 | |
extends CourseRegistrationServiceDecorator { |
29 | |
|
30 | 0 | public CourseRegistrationServiceProcessCheckDecorator() { |
31 | 0 | } |
32 | |
|
33 | 0 | public CourseRegistrationServiceProcessCheckDecorator(CourseRegistrationService nextDecorator) { |
34 | 0 | setNextDecorator(nextDecorator); |
35 | 0 | } |
36 | |
|
37 | |
private ProcessEvaluator<CourseRegistrationProcessContextInfo> processEvaluator; |
38 | |
|
39 | |
public ProcessEvaluator<CourseRegistrationProcessContextInfo> getProcessEvaluator() { |
40 | 0 | return processEvaluator; |
41 | |
} |
42 | |
|
43 | |
public void setProcessEvaluator(ProcessEvaluator<CourseRegistrationProcessContextInfo> processEvaluator) { |
44 | 0 | this.processEvaluator = processEvaluator; |
45 | 0 | } |
46 | |
|
47 | |
@Override |
48 | |
public List<ValidationResultInfo> checkStudentEligibility(String studentId, ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
49 | 0 | CourseRegistrationProcessContextInfo processContext = CourseRegistrationProcessContextInfo.createForRegistrationEligibility(studentId, null); |
50 | 0 | processContext.setProcessKey(ProcessServiceConstants.PROCESS_KEY_BASIC_ELIGIBILITY); |
51 | 0 | List<? extends ValidationResult> results = this.processEvaluator.evaluate(processContext, context); |
52 | 0 | List<ValidationResultInfo> infos = new ArrayList<ValidationResultInfo>(results.size()); |
53 | 0 | for (ValidationResult vr : results) { |
54 | 0 | infos.add(new ValidationResultInfo(vr)); |
55 | |
} |
56 | 0 | return infos; |
57 | |
} |
58 | |
|
59 | |
@Override |
60 | |
public List<ValidationResultInfo> checkStudentEligibilityForTerm(String studentId, String termKey, ContextInfo context) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
61 | 0 | CourseRegistrationProcessContextInfo processContext = CourseRegistrationProcessContextInfo.createForRegistrationEligibility(studentId, termKey); |
62 | 0 | processContext.setProcessKey(ProcessServiceConstants.PROCESS_KEY_ELIGIBILITY_FOR_TERM); |
63 | |
List<? extends ValidationResult> results; |
64 | 0 | results = this.processEvaluator.evaluate(processContext, context); |
65 | 0 | List<ValidationResultInfo> infos = new ArrayList<ValidationResultInfo>(results.size()); |
66 | 0 | for (ValidationResult vr : results) { |
67 | 0 | infos.add(new ValidationResultInfo(vr)); |
68 | |
} |
69 | 0 | return infos; |
70 | |
|
71 | |
} |
72 | |
|
73 | |
@Override |
74 | |
public List<ValidationResultInfo> checkStudentEligibiltyForCourseOffering(String studentId, String courseOfferingId, ContextInfo context) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
75 | |
|
76 | 0 | return new ArrayList(); |
77 | |
} |
78 | |
} |