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