1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.krms.termresolver;
17
18 import org.kuali.rice.krms.api.engine.TermResolutionException;
19 import org.kuali.student.enrollment.academicrecord.dto.StudentCourseRecordInfo;
20 import org.kuali.student.enrollment.academicrecord.service.AcademicRecordService;
21 import org.kuali.student.krms.util.KSKRMSExecutionConstants;
22 import org.kuali.student.r2.common.dto.ContextInfo;
23
24 import java.util.Arrays;
25 import java.util.Collections;
26 import java.util.HashSet;
27 import java.util.List;
28 import java.util.Map;
29 import java.util.Set;
30
31 public class CompletedCourseTermResolver extends CompletedCoursesTermResolver {
32
33
34 @Override
35 public String getOutput() {
36 return this.getClass().getSimpleName();
37 }
38
39 @Override
40 public Set<String> getParameterNames() {
41 Set<String> temp = new HashSet<String>(2);
42 temp.add(KSKRMSExecutionConstants.PERSON_ID_TERM_PROPERTY);
43 temp.add(KSKRMSExecutionConstants.COURSE_CODE_TERM_PROPERTY);
44
45 return Collections.unmodifiableSet(temp);
46 }
47
48 @Override
49 public int getCost() {
50
51 return 0;
52 }
53
54
55 @Override
56 public List<StudentCourseRecordInfo> resolve(Map<String, Object> resolvedPrereqs, Map<String, String> parameters)
57 throws TermResolutionException {
58
59 List<StudentCourseRecordInfo> completedCourseRecords = super.resolve(resolvedPrereqs, parameters);
60 String courseCode = parameters.get(KSKRMSExecutionConstants.COURSE_CODE_TERM_PROPERTY);
61
62 for (StudentCourseRecordInfo studentCourseRecordInfo : completedCourseRecords) {
63 if (studentCourseRecordInfo.getCourseCode().equals(courseCode)) {
64 return Arrays.asList(studentCourseRecordInfo);
65 }
66 }
67
68 return null;
69 }
70
71 }