1 | |
package org.kuali.student.enrollment.class2.acal.service; |
2 | |
|
3 | |
import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; |
4 | |
import org.kuali.rice.krad.inquiry.InquirableImpl; |
5 | |
import org.kuali.student.enrollment.acal.dto.AcademicCalendarInfo; |
6 | |
import org.kuali.student.enrollment.acal.dto.KeyDateInfo; |
7 | |
import org.kuali.student.enrollment.acal.dto.TermInfo; |
8 | |
import org.kuali.student.enrollment.acal.service.AcademicCalendarService; |
9 | |
import org.kuali.student.enrollment.class2.acal.dto.AcademicCalendarWrapper; |
10 | |
import org.kuali.student.enrollment.class2.acal.dto.TermWrapper; |
11 | |
import org.kuali.student.r2.common.dto.ContextInfo; |
12 | |
import org.kuali.student.r2.common.exceptions.*; |
13 | |
import org.kuali.student.r2.common.util.constants.AtpServiceConstants; |
14 | |
|
15 | |
import javax.xml.namespace.QName; |
16 | |
import java.util.ArrayList; |
17 | |
import java.util.List; |
18 | |
import java.util.Map; |
19 | |
|
20 | |
|
21 | 0 | @Deprecated |
22 | 0 | public class AcademicCalendarWrapperInquiryViewHelperServiceImpl extends InquirableImpl { |
23 | |
|
24 | |
public final static String ACADEMIC_CALENDAR_WRAPPER_KEY = "id"; |
25 | |
private transient AcademicCalendarService academicCalendarService; |
26 | |
|
27 | |
@Override |
28 | |
public AcademicCalendarWrapper retrieveDataObject(Map<String, String> parameters) { |
29 | 0 | ContextInfo context = new ContextInfo(); |
30 | 0 | academicCalendarService = getAcademicCalendarService(); |
31 | 0 | AcademicCalendarWrapper academicCalendarWrapper = new AcademicCalendarWrapper(); |
32 | |
try{ |
33 | |
|
34 | 0 | String academicCalendarKey = parameters.get(ACADEMIC_CALENDAR_WRAPPER_KEY); |
35 | 0 | if(academicCalendarKey == null){ |
36 | 0 | System.out.println(">>>academicCalendarKey is null"); |
37 | 0 | return null; |
38 | |
} |
39 | |
else { |
40 | 0 | System.out.println(">>>academicCalendarKey ="+academicCalendarKey); |
41 | |
} |
42 | 0 | AcademicCalendarInfo academicCalendarInfo = academicCalendarService.getAcademicCalendar(academicCalendarKey, context); |
43 | 0 | academicCalendarWrapper.setAcademicCalendarInfo(academicCalendarInfo); |
44 | |
|
45 | 0 | List<TermWrapper> termWrapperList = new ArrayList<TermWrapper>(); |
46 | 0 | List<TermInfo> termInfoList = academicCalendarService.getTermsForAcademicCalendar(academicCalendarKey, context); |
47 | 0 | for (TermInfo termInfo:termInfoList){ |
48 | 0 | TermWrapper termWrapper = new TermWrapper(); |
49 | 0 | termWrapper.setTermInfo(termInfo); |
50 | 0 | List<KeyDateInfo> keyDateInfoList = academicCalendarService.getKeyDatesForTerm(termInfo.getId(), context); |
51 | 0 | for (KeyDateInfo keyDateInfo : keyDateInfoList){ |
52 | 0 | if(AtpServiceConstants.MILESTONE_INSTRUCTIONAL_PERIOD_TYPE_KEY.equals(keyDateInfo.getTypeKey())){ |
53 | 0 | termWrapper.setClassesMeetDates(keyDateInfo); |
54 | |
} |
55 | 0 | else if(AtpServiceConstants.MILESTONE_REGISTRATION_PERIOD_TYPE_KEY.equals(keyDateInfo.getTypeKey())){ |
56 | 0 | termWrapper.setRegistrationPeriod(keyDateInfo); |
57 | |
} |
58 | 0 | else if(AtpServiceConstants.MILESTONE_DROP_DATE_TYPE_KEY.equals(keyDateInfo.getTypeKey())){ |
59 | 0 | termWrapper.setDropPeriodEndsDate(keyDateInfo); |
60 | |
} |
61 | 0 | else if(AtpServiceConstants.MILESTONE_FINAL_EXAM_PERIOD_TYPE_KEY.equals(keyDateInfo.getTypeKey())){ |
62 | 0 | termWrapper.setFinalExaminationsDates(keyDateInfo); |
63 | |
} |
64 | 0 | else if(AtpServiceConstants.MILESTONE_GRADES_DUE_TYPE_KEY.equals(keyDateInfo.getTypeKey())){ |
65 | 0 | termWrapper.setGradesDueDate(keyDateInfo); |
66 | |
} |
67 | |
|
68 | |
} |
69 | 0 | termWrapperList.add(termWrapper); |
70 | 0 | } |
71 | 0 | academicCalendarWrapper.setTermWrapperList(termWrapperList); |
72 | 0 | return academicCalendarWrapper; |
73 | 0 | }catch (InvalidParameterException ipe){ |
74 | |
|
75 | 0 | }catch (MissingParameterException mpe){ |
76 | |
|
77 | 0 | }catch (OperationFailedException ofe){ |
78 | |
|
79 | 0 | }catch (PermissionDeniedException pde){ |
80 | |
|
81 | 0 | }catch (DoesNotExistException dee){ |
82 | |
|
83 | 0 | } |
84 | 0 | return null; |
85 | |
|
86 | |
} |
87 | |
|
88 | |
protected AcademicCalendarService getAcademicCalendarService() { |
89 | 0 | if(academicCalendarService == null) { |
90 | 0 | academicCalendarService = (AcademicCalendarService) GlobalResourceLoader.getService(new QName("http://student.kuali.org/wsdl/acal","AcademicCalendarService")); |
91 | |
} |
92 | 0 | return academicCalendarService; |
93 | |
} |
94 | |
|
95 | |
} |