Coverage Report - org.kuali.student.enrollment.class2.acal.service.TermWrapperInquiryViewHelperServiceImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
TermWrapperInquiryViewHelperServiceImpl
0%
0/30
0%
0/14
7.5
 
 1  
 package org.kuali.student.enrollment.class2.acal.service;
 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.enrollment.class2.acal.dto.TermWrapper;
 9  
 import org.kuali.student.r2.common.dto.ContextInfo;
 10  
 import org.kuali.student.r2.common.exceptions.*;
 11  
 import org.kuali.student.r2.common.util.constants.AtpServiceConstants;
 12  
 
 13  
 import javax.xml.namespace.QName;
 14  
 import java.util.List;
 15  
 import java.util.Map;
 16  
 
 17  
 /**
 18  
  * Created by IntelliJ IDEA.
 19  
  * User: huangb
 20  
  */
 21  0
 public class TermWrapperInquiryViewHelperServiceImpl extends InquirableImpl {
 22  
      public final static String TERM_WRAPPER_KEY = "key";
 23  
          private transient AcademicCalendarService academicCalendarService;
 24  
 
 25  
     @Override
 26  
     public TermWrapper retrieveDataObject(Map<String, String> parameters) {
 27  0
             TermInfo termInfo = null;
 28  0
         TermWrapper termWrapper = new TermWrapper();
 29  
 
 30  0
             String termKey = parameters.get(TERM_WRAPPER_KEY);
 31  0
             ContextInfo context = new ContextInfo();
 32  
             try{
 33  0
                     termInfo = getAcademicCalendarService().getTerm(termKey, context);
 34  0
             termWrapper.setTermInfo(termInfo);
 35  0
             List<KeyDateInfo>  keyDateInfoList = getAcademicCalendarService().getKeyDatesForTerm(termKey, context);
 36  0
             for (KeyDateInfo keyDateInfo : keyDateInfoList){
 37  0
                                     if(AtpServiceConstants.MILESTONE_INSTRUCTIONAL_PERIOD_TYPE_KEY.equals(keyDateInfo.getTypeKey())){
 38  0
                                             termWrapper.setClassesMeetDates(keyDateInfo);
 39  
                                     }
 40  0
                                     else if(AtpServiceConstants.MILESTONE_REGISTRATION_PERIOD_TYPE_KEY.equals(keyDateInfo.getTypeKey())){
 41  0
                                             termWrapper.setRegistrationPeriod(keyDateInfo);
 42  
                                     }
 43  0
                                     else if(AtpServiceConstants.MILESTONE_DROP_DATE_TYPE_KEY.equals(keyDateInfo.getTypeKey())){
 44  0
                                             termWrapper.setDropPeriodEndsDate(keyDateInfo);
 45  
                                     }
 46  0
                                     else if(AtpServiceConstants.MILESTONE_FINAL_EXAM_PERIOD_TYPE_KEY.equals(keyDateInfo.getTypeKey())){
 47  0
                                             termWrapper.setFinalExaminationsDates(keyDateInfo);
 48  
                                     }
 49  0
                                     else if(AtpServiceConstants.MILESTONE_GRADES_DUE_TYPE_KEY.equals(keyDateInfo.getTypeKey())){
 50  0
                                             termWrapper.setGradesDueDate(keyDateInfo);
 51  
                                     }
 52  
                     }
 53  0
                     return termWrapper;
 54  0
             }catch (DoesNotExistException dnee){
 55  
 
 56  0
             }catch (InvalidParameterException ipe){
 57  
 
 58  0
             }catch (MissingParameterException mpe){
 59  
 
 60  0
             }catch (OperationFailedException ofe){
 61  
 
 62  0
             }catch (PermissionDeniedException pde){
 63  
 
 64  0
             }
 65  0
             return null;
 66  
 
 67  
     }
 68  
 
 69  
     protected AcademicCalendarService getAcademicCalendarService() {
 70  0
        if(academicCalendarService == null) {
 71  0
                 academicCalendarService = (AcademicCalendarService) GlobalResourceLoader.getService(new QName("http://student.kuali.org/wsdl/acal", "AcademicCalendarService"));
 72  
        }
 73  0
        return academicCalendarService;
 74  
    }
 75  
 }