1 package org.kuali.student.enrollment.class2.courseoffering.service.impl;
2
3 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
4 import org.kuali.rice.krad.inquiry.InquirableImpl;
5 import org.kuali.student.enrollment.class2.courseoffering.util.CourseOfferingConstants;
6 import org.kuali.student.enrollment.class2.courseoffering.util.CourseOfferingResourceLoader;
7 import org.kuali.student.enrollment.courseoffering.dto.CourseOfferingInfo;
8 import org.kuali.student.enrollment.courseoffering.service.CourseOfferingService;
9 import org.kuali.student.r2.common.util.ContextUtils;
10 import org.kuali.student.r2.lum.course.service.CourseService;
11 import org.kuali.student.r2.lum.util.constants.CourseServiceConstants;
12
13 import javax.xml.namespace.QName;
14 import java.util.Map;
15
16
17 public class CourseOfferingInfoInquirableImpl extends InquirableImpl {
18 private CourseOfferingService courseOfferingService;
19 private CourseService courseService;
20
21 @Override
22 public CourseOfferingInfo retrieveDataObject(Map<String, String> parameters) {
23 try {
24 CourseOfferingInfo courseOfferingInfo = getCourseOfferingService().getCourseOffering(parameters.get(CourseOfferingConstants.COURSEOFFERING_ID), ContextUtils.createDefaultContextInfo());
25 return courseOfferingInfo;
26 } catch (Exception e) {
27 throw new RuntimeException(e);
28 }
29 }
30
31 public CourseOfferingService getCourseOfferingService() {
32 if(courseOfferingService == null)
33 courseOfferingService= CourseOfferingResourceLoader.loadCourseOfferingService();
34 return courseOfferingService;
35 }
36
37 protected CourseService getCourseService() {
38 if(courseService == null) {
39 courseService = (CourseService) GlobalResourceLoader.getService(new QName(CourseServiceConstants.COURSE_NAMESPACE, "CourseService"));
40 }
41 return this.courseService;
42 }
43
44 }