1 | |
package org.kuali.student.enrollment.class2.acal.service; |
2 | |
|
3 | |
import java.util.ArrayList; |
4 | |
import java.util.List; |
5 | |
import java.util.Map; |
6 | |
|
7 | |
import javax.xml.namespace.QName; |
8 | |
|
9 | |
import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; |
10 | |
import org.kuali.rice.kns.uif.service.impl.LookupViewHelperServiceImpl; |
11 | |
import org.kuali.student.enrollment.acal.dto.AcademicCalendarInfo; |
12 | |
import org.kuali.student.enrollment.acal.dto.TermInfo; |
13 | |
import org.kuali.student.enrollment.acal.dto.KeyDateInfo; |
14 | |
import org.kuali.student.enrollment.acal.service.AcademicCalendarService; |
15 | |
import org.kuali.student.enrollment.class2.acal.dto.AcademicCalendarWrapper; |
16 | |
import org.kuali.student.enrollment.class2.acal.dto.TermWrapper; |
17 | |
import org.kuali.student.r2.common.dto.ContextInfo; |
18 | |
import org.kuali.student.r2.common.exceptions.DoesNotExistException; |
19 | |
import org.kuali.student.r2.common.exceptions.InvalidParameterException; |
20 | |
import org.kuali.student.r2.common.exceptions.MissingParameterException; |
21 | |
import org.kuali.student.r2.common.exceptions.OperationFailedException; |
22 | |
import org.kuali.student.r2.common.exceptions.PermissionDeniedException; |
23 | |
|
24 | 0 | public class AcademicCalendarWrapperLookupViewHelperServiceImpl extends LookupViewHelperServiceImpl { |
25 | |
public final static String CREDENTIAL_PROGRAM_TYPE_KEY = "credentialProgramTypeKey"; |
26 | |
public final static String ACADEMIC_CALENDAR_KEY = "key"; |
27 | |
private transient AcademicCalendarService academicCalendarService; |
28 | |
|
29 | |
|
30 | |
@Override |
31 | |
protected List<?> getSearchResultsWithBounding(Map<String, String> fieldValues, boolean unbounded) { |
32 | 0 | List<AcademicCalendarWrapper> academicCalendarWrapperList = new ArrayList<AcademicCalendarWrapper>(); |
33 | 0 | AcademicCalendarWrapper academicCalendarWrapper = new AcademicCalendarWrapper(); |
34 | 0 | List<TermWrapper> termWrapperList = academicCalendarWrapper.getTermWrapperList(); |
35 | 0 | academicCalendarService = getAcademicCalendarService(); |
36 | 0 | AcademicCalendarInfo academicCalendarInfo = null; |
37 | 0 | List<AcademicCalendarInfo> academicCalendarInfoList = new ArrayList<AcademicCalendarInfo>(); |
38 | |
|
39 | 0 | String academicCalendarKey = fieldValues.get(ACADEMIC_CALENDAR_KEY); |
40 | 0 | ContextInfo context = ContextInfo.newInstance(); |
41 | |
try{ |
42 | 0 | academicCalendarInfo = academicCalendarService.getAcademicCalendar(academicCalendarKey, context); |
43 | 0 | academicCalendarWrapper.setAcademicCalendarInfo(academicCalendarInfo); |
44 | 0 | academicCalendarWrapperList.add(academicCalendarWrapper); |
45 | 0 | return academicCalendarWrapperList; |
46 | 0 | }catch (DoesNotExistException dnee){ |
47 | 0 | if (academicCalendarInfo == null) |
48 | 0 | return null; |
49 | |
|
50 | 0 | }catch (InvalidParameterException ipe){ |
51 | |
|
52 | 0 | }catch (MissingParameterException mpe){ |
53 | |
|
54 | 0 | }catch (OperationFailedException ofe){ |
55 | |
|
56 | 0 | }catch (PermissionDeniedException pde){ |
57 | |
|
58 | 0 | } |
59 | 0 | return null; |
60 | |
|
61 | |
} |
62 | |
|
63 | |
protected AcademicCalendarService getAcademicCalendarService() { |
64 | 0 | if(academicCalendarService == null) { |
65 | 0 | academicCalendarService = (AcademicCalendarService) GlobalResourceLoader.getService(new QName("http://student.kuali.org/wsdl/acal","AcademicCalendarService")); |
66 | |
} |
67 | |
|
68 | 0 | return academicCalendarService; |
69 | |
} |
70 | |
|
71 | |
|
72 | |
} |