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   * Created by bobhurt on 2/2/12
16   */
17  package org.kuali.student.enrollment.class2.acal.service.impl;
18  
19  import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
20  import org.kuali.rice.krad.inquiry.InquirableImpl;
21  import org.kuali.student.enrollment.acal.dto.HolidayCalendarInfo;
22  import org.kuali.student.enrollment.acal.dto.HolidayInfo;
23  import org.kuali.student.enrollment.acal.service.AcademicCalendarService;
24  import org.kuali.student.enrollment.class2.acal.form.HolidayCalendarForm;
25  import org.kuali.student.r2.common.dto.ContextInfo;
26  import org.kuali.student.r2.common.exceptions.*;
27  
28  import javax.xml.namespace.QName;
29  import java.util.Collections;
30  import java.util.List;
31  import java.util.Map;
32  
33  /**
34   * This class //TODO ...
35   *
36   * @author Kuali Student Team
37   */
38  public class HolidayCalendarViewHelperServiceInquirableImpl extends InquirableImpl {
39      public final static String ACADEMIC_CALENDAR_KEY = "key";
40      private transient AcademicCalendarService academicCalendarService;
41  
42  //    public HolidayCalendarViewHelperServiceInquirableImpl() {
43  //        int x;
44  //        x = 0;
45  //    }
46  
47      @Override
48      public HolidayCalendarInfo retrieveDataObject(Map<String, String> parameters) {
49          HolidayCalendarInfo holidayCalendarInfo = null;
50  
51          //String academicCalendarKey = parameters.get(ACADEMIC_CALENDAR_KEY);
52          String hcId = parameters.get("id");
53          try{
54              holidayCalendarInfo = getAcademicCalendarService().getHolidayCalendar(hcId, getContextInfo());
55              return holidayCalendarInfo;
56          } catch(Exception e) {
57  //        }catch (DoesNotExistException dnee){
58  //
59  //        }catch (InvalidParameterException ipe){
60  //
61  //        }catch (MissingParameterException mpe){
62  //
63  //        }catch (OperationFailedException ofe){
64  //
65  //        }catch (PermissionDeniedException pde){
66          }
67          return null;
68  
69      }
70  
71      public List<HolidayInfo> getHolidaysForHolidayCalendar(HolidayCalendarForm hcForm) throws Exception{
72          HolidayCalendarInfo hcInfo = hcForm.getHolidayCalendarInfo();
73          return getAcademicCalendarService().getHolidaysForHolidayCalendar(hcInfo.getId(), getContextInfo());
74      }
75  
76      protected AcademicCalendarService getAcademicCalendarService() {
77          if (academicCalendarService == null) {
78              academicCalendarService = (AcademicCalendarService) GlobalResourceLoader.getService(new QName("http://student.kuali.org/wsdl/acal", "AcademicCalendarService"));
79          }
80          return academicCalendarService;
81      }
82  
83      // TODO - where does context come from?
84      private ContextInfo getContextInfo(){
85          return new ContextInfo();
86      }
87  }