1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.student.common.kitchensink;
18
19 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
20 import org.kuali.rice.krad.lookup.LookupableImpl;
21 import org.kuali.rice.krad.web.form.LookupForm;
22 import org.kuali.student.common.util.CalendarSearchViewHelperUtil;
23 import org.kuali.student.r2.common.util.ContextUtils;
24 import org.kuali.student.r2.core.acal.dto.TermInfo;
25 import org.kuali.student.r2.core.atp.service.AtpService;
26 import org.kuali.student.r2.core.class1.type.service.TypeService;
27 import org.kuali.student.r2.core.constants.AtpServiceConstants;
28 import org.kuali.student.r2.core.constants.TypeServiceConstants;
29
30 import javax.xml.namespace.QName;
31 import java.util.List;
32 import java.util.Map;
33
34
35
36
37
38
39
40 public class KitchenSinkTermInfoLookupableImpl extends LookupableImpl {
41
42 private transient AtpService atpService;
43 private transient TypeService typeService;
44
45 @Override
46 protected List<?> getSearchResults(LookupForm lookupForm, Map<String, String> fieldValues, boolean unbounded) {
47 List<TermInfo> rList;
48 String name = fieldValues.get("code");
49 String year = fieldValues.get("startDate");
50
51 try {
52 rList = CalendarSearchViewHelperUtil.searchForTerms(name, year, ContextUtils.createDefaultContextInfo(), getAtpService(), getTypeService());
53 }
54 catch (Exception ex){
55 throw new RuntimeException("Error in AcademicTermLookupableImpl searching for term. name[" + name +"] year["+year +"]", ex);
56 }
57
58 return rList;
59 }
60
61 protected AtpService getAtpService() {
62 if(atpService == null) {
63 atpService = (AtpService) GlobalResourceLoader.getService(new QName(AtpServiceConstants.NAMESPACE, AtpServiceConstants.SERVICE_NAME_LOCAL_PART));
64 }
65 return this.atpService;
66 }
67
68 protected TypeService getTypeService(){
69 if (typeService == null){
70 typeService = GlobalResourceLoader.getService(new QName(TypeServiceConstants.NAMESPACE, TypeServiceConstants.SERVICE_NAME_LOCAL_PART));
71 }
72 return typeService;
73 }
74
75 }