1 package org.kuali.ole.ingest.resolver;
2
3 import org.kuali.ole.OLEConstants;
4 import org.kuali.ole.ingest.pojo.ProfileTerm;
5 import org.kuali.rice.krms.api.engine.TermResolutionException;
6 import org.kuali.rice.krms.api.engine.TermResolver;
7
8 import java.util.Collections;
9 import java.util.Map;
10 import java.util.Set;
11
12
13
14
15
16
17
18
19 public abstract class AbstractProfileTermResolver implements TermResolver<Object> {
20
21
22
23
24 @Override
25 public Set<String> getPrerequisites() {
26 return Collections.singleton(OLEConstants.ISBN_TERM);
27 }
28
29
30
31
32
33 @Override
34 public Set<String> getParameterNames() {
35 return Collections.emptySet();
36 }
37
38
39
40
41
42 @Override
43 public int getCost() {
44 return 1;
45 }
46
47
48
49
50
51
52
53
54 @Override
55 public Object resolve(Map<String, Object> resolvedPrereqs,
56 Map<String, String> parameters) throws TermResolutionException {
57 ProfileTerm profileTerm = (ProfileTerm) resolvedPrereqs.get("ISBN Term");
58 if (profileTerm == null) {
59 throw new TermResolutionException("Failed to locate Patron prereq", this, parameters);
60 }
61 return resolveFromProfileTerm(profileTerm);
62 }
63
64 protected abstract Object resolveFromProfileTerm(ProfileTerm profileTerm);
65 }