View Javadoc

1   /**
2    * Copyright 2012 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   *
15   */
16  package org.kuali.student.enrollment.class2.courseoffering.service.impl;
17  
18  import org.kuali.rice.krad.inquiry.InquirableImpl;
19  import org.kuali.student.enrollment.class2.courseoffering.util.CourseOfferingResourceLoader;
20  import org.kuali.student.enrollment.courseoffering.dto.FormatOfferingInfo;
21  import org.kuali.student.enrollment.courseoffering.service.CourseOfferingService;
22  import org.kuali.student.r2.common.util.ContextUtils;
23  
24  import java.util.Map;
25  
26  /**
27   * This class provides a Inquirable implementation for Format Offerings
28   *
29   * @author Kuali Student Team
30   */
31  public class FormatOfferingInfoInquirableImpl extends InquirableImpl {
32      public final static String FORMAT_OFFERING_ID = "id";
33  
34      @Override
35      public FormatOfferingInfo retrieveDataObject(Map<String, String> parameters) {
36          try {
37              FormatOfferingInfo formatOfferingInfo = getCourseOfferingService().getFormatOffering(parameters.get(FORMAT_OFFERING_ID), ContextUtils.createDefaultContextInfo());
38              return formatOfferingInfo;
39          } catch (Exception e) {
40              throw new RuntimeException("FormatOfferingInfo inquiry has failed. ", e);
41          }
42      }
43  
44      public CourseOfferingService getCourseOfferingService() {
45          return CourseOfferingResourceLoader.loadCourseOfferingService();
46      }
47  }