Coverage Report - org.kuali.student.enrollment.class2.acal.service.TermWrapperLookupableImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
TermWrapperLookupableImpl
0%
0/37
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.lookup.LookupableImpl;
 5  
 import org.kuali.rice.krad.web.form.LookupForm;
 6  
 import org.kuali.student.enrollment.acal.dto.KeyDateInfo;
 7  
 import org.kuali.student.enrollment.acal.dto.TermInfo;
 8  
 import org.kuali.student.enrollment.acal.service.AcademicCalendarService;
 9  
 import org.kuali.student.enrollment.class2.acal.dto.TermWrapper;
 10  
 import org.kuali.student.r2.common.dto.ContextInfo;
 11  
 import org.kuali.student.r2.common.exceptions.*;
 12  
 import org.kuali.student.r2.common.util.constants.AtpServiceConstants;
 13  
 
 14  
 import javax.xml.namespace.QName;
 15  
 import java.util.ArrayList;
 16  
 import java.util.List;
 17  
 import java.util.Map;
 18  
 
 19  
 //Core slice class.
 20  
 @Deprecated
 21  0
 public class TermWrapperLookupableImpl extends LookupableImpl {
 22  
     public final static String TERM_WRAPPER_KEY = "key";
 23  
 
 24  
          private transient AcademicCalendarService academicCalendarService;
 25  
 
 26  
     @Override
 27  
     protected List<?> getSearchResults(LookupForm lookupForm, Map<String, String> fieldValues, boolean unbounded) {
 28  0
             TermInfo termInfo = null;
 29  0
             List<TermWrapper> termWrapperList = new ArrayList<TermWrapper>();
 30  
 
 31  0
             String termKey = fieldValues.get(TERM_WRAPPER_KEY);
 32  0
             ContextInfo context = new ContextInfo();
 33  
             try{
 34  0
                     termInfo = getAcademicCalendarService().getTerm(termKey, context);
 35  0
             TermWrapper termWrapper = new TermWrapper();
 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
                     termWrapperList.add(termWrapper);
 56  0
                     return termWrapperList;
 57  0
             }catch (DoesNotExistException dnee){
 58  0
             System.out.println("call getAcademicCalendarService().getKeyDatesForTerm(termKey, context), and get DoesNotExistException:  "+dnee.toString());
 59  0
             }catch (InvalidParameterException ipe){
 60  0
             System.out.println("call getAcademicCalendarService().getKeyDatesForTerm(termKey, context), and get InvalidParameterException:  "+ipe.toString());
 61  0
             }catch (MissingParameterException mpe){
 62  0
             System.out.println("call getAcademicCalendarService().getKeyDatesForTerm(termKey, context), and get MissingParameterException:  "+mpe.toString());
 63  0
             }catch (OperationFailedException ofe){
 64  0
             System.out.println("call getAcademicCalendarService().getKeyDatesForTerm(termKey, context), and get OperationFailedException:  "+ofe.toString());
 65  0
             }catch (PermissionDeniedException pde){
 66  0
             System.out.println("call getAcademicCalendarService().getKeyDatesForTerm(termKey, context), and get PermissionDeniedException:  "+pde.toString());
 67  0
             }
 68  0
             return null;
 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  
 }