1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.class3.krms.termresolver;
17
18 import java.util.Date;
19 import java.util.Map;
20 import java.util.Set;
21
22 import org.kuali.rice.krms.api.engine.TermResolutionException;
23 import org.kuali.student.krms.KRMSConstants;
24 import org.kuali.student.r2.core.atp.dto.AtpInfo;
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
27
28
29
30
31
32
33 public class AtpEndDateFieldTermResolver extends AbstractKSTermResolver<Date> {
34 private static final Logger log = LoggerFactory
35 .getLogger(AtpEndDateFieldTermResolver.class);
36
37
38
39
40 public AtpEndDateFieldTermResolver(String termName, String principalId) {
41 super(termName, principalId);
42 }
43
44
45
46
47 @Override
48 public Set<String> getPrerequisites() {
49 Set<String> prereq = super.getPrerequisites();
50
51 prereq.add(KRMSConstants.CURRENT_TERM_ID);
52
53 return prereq;
54 }
55
56
57
58 @Override
59 public Date resolve(Map<String, Object> resolvedPrereqs,
60 Map<String, String> parameters) throws TermResolutionException {
61
62 AtpInfo atp = (AtpInfo) resolvedPrereqs.get(KRMSConstants.CURRENT_TERM_ID);
63
64 if (atp == null)
65 throw new TermResolutionException("atp undefined for term = " + KRMSConstants.CURRENT_TERM_ID, this, parameters);
66
67 return atp.getEndDate();
68
69
70 }
71
72
73
74 }