Coverage Report - org.kuali.student.enrollment.class2.acal.service.AcademicCalendarWrapperInquiryViewHelperServiceImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
AcademicCalendarWrapperInquiryViewHelperServiceImpl
0%
0/42
0%
0/18
9
 
 1  
 package org.kuali.student.enrollment.class2.acal.service;
 2  
 
 3  
 import java.util.ArrayList;
 4  
 import java.util.List;
 5  
 import java.util.Map;
 6  
 
 7  
 import javax.xml.namespace.QName;
 8  
 
 9  
 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
 10  
 import org.kuali.rice.krad.inquiry.InquirableImpl;
 11  
 import org.kuali.student.enrollment.acal.dto.AcademicCalendarInfo;
 12  
 import org.kuali.student.enrollment.acal.dto.TermInfo;
 13  
 import org.kuali.student.enrollment.acal.dto.KeyDateInfo;
 14  
 import org.kuali.student.enrollment.acal.service.AcademicCalendarService;
 15  
 import org.kuali.student.enrollment.class2.acal.dto.AcademicCalendarWrapper;
 16  
 import org.kuali.student.enrollment.class2.acal.dto.TermWrapper;
 17  
 import org.kuali.student.r2.common.dto.ContextInfo;
 18  
 import org.kuali.student.r2.common.exceptions.DoesNotExistException;
 19  
 import org.kuali.student.r2.common.exceptions.InvalidParameterException;
 20  
 import org.kuali.student.r2.common.exceptions.MissingParameterException;
 21  
 import org.kuali.student.r2.common.exceptions.OperationFailedException;
 22  
 import org.kuali.student.r2.common.exceptions.PermissionDeniedException;
 23  
 import org.kuali.student.r2.common.util.constants.AtpServiceConstants;
 24  
 
 25  0
 public class AcademicCalendarWrapperInquiryViewHelperServiceImpl extends InquirableImpl {
 26  
 //         public final static String ACADEMIC_CALENDAR_KEY = "academicCalendarInfo.key";
 27  
      public final static String ACADEMIC_CALENDAR_WRAPPER_KEY = "id";
 28  
          private transient AcademicCalendarService academicCalendarService;
 29  
          
 30  
         @Override
 31  
     public AcademicCalendarWrapper retrieveDataObject(Map<String, String> parameters) {
 32  0
             ContextInfo context = new ContextInfo();
 33  0
             academicCalendarService = getAcademicCalendarService();
 34  0
             AcademicCalendarWrapper academicCalendarWrapper = new AcademicCalendarWrapper();
 35  
             try{
 36  
                     //need to retrieve AcademicCalendarInfo, all TermInfo and all KeyDateInfo to form the AcademicCalendarWrapper.
 37  0
                     String academicCalendarKey = parameters.get(ACADEMIC_CALENDAR_WRAPPER_KEY);
 38  0
                     if(academicCalendarKey == null){
 39  0
                             System.out.println(">>>academicCalendarKey is null");
 40  0
                             return null;
 41  
                     }
 42  
                     else {
 43  0
                             System.out.println(">>>academicCalendarKey ="+academicCalendarKey);
 44  
                     }        
 45  0
                     AcademicCalendarInfo academicCalendarInfo = academicCalendarService.getAcademicCalendar(academicCalendarKey, context);
 46  0
                     academicCalendarWrapper.setAcademicCalendarInfo(academicCalendarInfo);
 47  
                     
 48  0
                     List<TermWrapper> termWrapperList = new ArrayList<TermWrapper>();
 49  0
                     List<TermInfo> termInfoList = academicCalendarService.getTermsForAcademicCalendar(academicCalendarKey, context);
 50  0
                     for (TermInfo termInfo:termInfoList){
 51  0
                             TermWrapper termWrapper = new TermWrapper();
 52  0
                             termWrapper.setTermInfo(termInfo);
 53  0
                             List<KeyDateInfo> keyDateInfoList = academicCalendarService.getKeyDatesForTerm(termInfo.getId(), context);
 54  0
                             for (KeyDateInfo keyDateInfo : keyDateInfoList){
 55  0
                                     if(AtpServiceConstants.MILESTONE_INSTRUCTIONAL_PERIOD_TYPE_KEY.equals(keyDateInfo.getTypeKey())){
 56  0
                                             termWrapper.setClassesMeetDates(keyDateInfo);
 57  
                                     }
 58  0
                                     else if(AtpServiceConstants.MILESTONE_REGISTRATION_PERIOD_TYPE_KEY.equals(keyDateInfo.getTypeKey())){
 59  0
                                             termWrapper.setRegistrationPeriod(keyDateInfo);
 60  
                                     }
 61  0
                                     else if(AtpServiceConstants.MILESTONE_DROP_DATE_TYPE_KEY.equals(keyDateInfo.getTypeKey())){
 62  0
                                             termWrapper.setDropPeriodEndsDate(keyDateInfo);
 63  
                                     }
 64  0
                                     else if(AtpServiceConstants.MILESTONE_FINAL_EXAM_PERIOD_TYPE_KEY.equals(keyDateInfo.getTypeKey())){
 65  0
                                             termWrapper.setFinalExaminationsDates(keyDateInfo);
 66  
                                     }
 67  0
                                     else if(AtpServiceConstants.MILESTONE_GRADES_DUE_TYPE_KEY.equals(keyDateInfo.getTypeKey())){
 68  0
                                             termWrapper.setGradesDueDate(keyDateInfo);
 69  
                                     }
 70  
                                             
 71  
                             }
 72  0
                             termWrapperList.add(termWrapper);                            
 73  0
                     }
 74  0
                     academicCalendarWrapper.setTermWrapperList(termWrapperList);
 75  0
                     return academicCalendarWrapper;
 76  0
         }catch (InvalidParameterException ipe){
 77  
             
 78  0
         }catch (MissingParameterException mpe){
 79  
             
 80  0
         }catch (OperationFailedException ofe){
 81  
            
 82  0
         }catch (PermissionDeniedException pde){
 83  
             
 84  0
         }catch (DoesNotExistException dee){
 85  
             
 86  0
         }
 87  0
         return null;
 88  
 
 89  
         }
 90  
         
 91  
     protected AcademicCalendarService getAcademicCalendarService() {
 92  0
        if(academicCalendarService == null) {
 93  0
                 academicCalendarService = (AcademicCalendarService) GlobalResourceLoader.getService(new QName("http://student.kuali.org/wsdl/acal","AcademicCalendarService"));
 94  
        }
 95  0
        return academicCalendarService;
 96  
    }
 97  
 
 98  
 }