1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.enrollment.class2.courseoffering.service.impl; |
17 | |
|
18 | |
import org.kuali.rice.krad.lookup.LookupableImpl; |
19 | |
import org.kuali.rice.krad.web.form.LookupForm; |
20 | |
import org.kuali.student.enrollment.class2.courseoffering.util.CourseOfferingResourceLoader; |
21 | |
import org.kuali.student.enrollment.common.util.ContextBuilder; |
22 | |
import org.kuali.student.enrollment.courseoffering.dto.FormatOfferingInfo; |
23 | |
import org.kuali.student.enrollment.courseoffering.service.CourseOfferingService; |
24 | |
import org.kuali.student.r2.common.dto.ContextInfo; |
25 | |
import org.kuali.student.r2.common.exceptions.*; |
26 | |
|
27 | |
import java.util.ArrayList; |
28 | |
import java.util.List; |
29 | |
import java.util.Map; |
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | 0 | public class FormatOfferingInfoLookupableImpl extends LookupableImpl { |
37 | |
public final static String COURSE_OFFER_ID = "courseOfferingId"; |
38 | |
private transient CourseOfferingService courseOfferingService; |
39 | 0 | private ContextInfo contextInfo = null; |
40 | |
|
41 | |
@Override |
42 | |
protected List<?> getSearchResults(LookupForm lookupForm, Map<String, String> fieldValues, boolean unbounded) { |
43 | |
List<FormatOfferingInfo> formatOfferingInfos; |
44 | |
|
45 | |
try { |
46 | 0 | formatOfferingInfos = getCourseOfferingService().getFormatOfferingsByCourseOffering(fieldValues.get(COURSE_OFFER_ID), getContextInfo()); |
47 | 0 | } catch (DoesNotExistException e) { |
48 | 0 | throw new RuntimeException(e); |
49 | 0 | } catch (InvalidParameterException e) { |
50 | 0 | throw new RuntimeException(e); |
51 | 0 | } catch (MissingParameterException e) { |
52 | 0 | throw new RuntimeException(e); |
53 | 0 | } catch (OperationFailedException e) { |
54 | 0 | throw new RuntimeException(e); |
55 | 0 | } catch (PermissionDeniedException e) { |
56 | 0 | throw new RuntimeException(e); |
57 | 0 | } |
58 | |
|
59 | 0 | return formatOfferingInfos; |
60 | |
} |
61 | |
|
62 | |
public CourseOfferingService getCourseOfferingService() { |
63 | 0 | if(courseOfferingService == null) |
64 | 0 | courseOfferingService= CourseOfferingResourceLoader.loadCourseOfferingService(); |
65 | 0 | return courseOfferingService; |
66 | |
} |
67 | |
|
68 | |
public ContextInfo getContextInfo() { |
69 | 0 | if (contextInfo == null){ |
70 | 0 | contextInfo = ContextBuilder.loadContextInfo(); |
71 | |
} |
72 | 0 | return contextInfo; |
73 | |
} |
74 | |
} |