1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.student.enrollment.class2.acal.service.impl; |
18 | |
|
19 | |
import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; |
20 | |
import org.kuali.rice.krad.inquiry.InquirableImpl; |
21 | |
import org.kuali.student.enrollment.acal.dto.HolidayCalendarInfo; |
22 | |
import org.kuali.student.enrollment.acal.dto.HolidayInfo; |
23 | |
import org.kuali.student.enrollment.acal.service.AcademicCalendarService; |
24 | |
import org.kuali.student.enrollment.class2.acal.form.HolidayCalendarForm; |
25 | |
import org.kuali.student.r2.common.dto.ContextInfo; |
26 | |
import org.kuali.student.r2.common.exceptions.*; |
27 | |
|
28 | |
import javax.xml.namespace.QName; |
29 | |
import java.util.Collections; |
30 | |
import java.util.List; |
31 | |
import java.util.Map; |
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | 0 | public class HolidayCalendarViewHelperServiceInquirableImpl extends InquirableImpl { |
39 | |
public final static String ACADEMIC_CALENDAR_KEY = "key"; |
40 | |
private transient AcademicCalendarService academicCalendarService; |
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
@Override |
48 | |
public HolidayCalendarInfo retrieveDataObject(Map<String, String> parameters) { |
49 | 0 | HolidayCalendarInfo holidayCalendarInfo = null; |
50 | |
|
51 | |
|
52 | 0 | String hcId = parameters.get("id"); |
53 | |
try{ |
54 | 0 | holidayCalendarInfo = getAcademicCalendarService().getHolidayCalendar(hcId, getContextInfo()); |
55 | 0 | return holidayCalendarInfo; |
56 | 0 | } catch(Exception e) { |
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
} |
67 | 0 | return null; |
68 | |
|
69 | |
} |
70 | |
|
71 | |
public List<HolidayInfo> getHolidaysForHolidayCalendar(HolidayCalendarForm hcForm) throws Exception{ |
72 | 0 | HolidayCalendarInfo hcInfo = hcForm.getHolidayCalendarInfo(); |
73 | 0 | return getAcademicCalendarService().getHolidaysForHolidayCalendar(hcInfo.getId(), getContextInfo()); |
74 | |
} |
75 | |
|
76 | |
protected AcademicCalendarService getAcademicCalendarService() { |
77 | 0 | if (academicCalendarService == null) { |
78 | 0 | academicCalendarService = (AcademicCalendarService) GlobalResourceLoader.getService(new QName("http://student.kuali.org/wsdl/acal", "AcademicCalendarService")); |
79 | |
} |
80 | 0 | return academicCalendarService; |
81 | |
} |
82 | |
|
83 | |
|
84 | |
private ContextInfo getContextInfo(){ |
85 | 0 | return new ContextInfo(); |
86 | |
} |
87 | |
} |