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