View Javadoc

1   package org.kuali.student.enrollment.class2.acal.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.acal.dto.KeyDateInfo;
6   import org.kuali.student.enrollment.acal.dto.TermInfo;
7   import org.kuali.student.enrollment.acal.service.AcademicCalendarService;
8   import org.kuali.student.r2.common.dto.ContextInfo;
9   
10  import javax.xml.namespace.QName;
11  import java.util.List;
12  import java.util.Map;
13  
14  /**
15   * Created with IntelliJ IDEA.
16   * User: localadmin
17   * Date: 6/19/12
18   * Time: 3:28 PM
19   * To change this template use File | Settings | File Templates.
20   */
21  
22  
23  
24  public class AcademicTermInfoInquirableImpl  extends InquirableImpl {
25  
26      private AcademicCalendarService academicCalendarService;
27  
28      @Override
29      public TermInfo retrieveDataObject(Map<String, String> parameters) {
30          TermInfo termInfo = null;
31  
32          String termKey = parameters.get("id");
33          ContextInfo context = new ContextInfo();
34          try{
35              termInfo = getAcademicCalendarService().getTerm(termKey, context);
36              List<KeyDateInfo> keyDateInfoList = getAcademicCalendarService().getKeyDatesForTerm(termKey, context);
37              return termInfo;
38          }catch (Exception e){
39              e.printStackTrace();
40          }
41  
42          return null;
43  
44      }
45  
46      protected AcademicCalendarService getAcademicCalendarService() {
47          if(academicCalendarService == null) {
48              academicCalendarService = (AcademicCalendarService) GlobalResourceLoader.getService(new QName("http://student.kuali.org/wsdl/acal", "AcademicCalendarService"));
49          }
50          return academicCalendarService;
51      }
52  
53  }