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 javax.xml.namespace.QName;
 4  
 import java.util.ArrayList;
 5  
 import java.util.List;
 6  
 import java.util.Map;
 7  
 import java.util.Properties;
 8  
 
 9  
 import org.apache.commons.lang.StringUtils;
 10  
 
 11  
 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
 12  
 import org.kuali.rice.krad.lookup.LookupableImpl;
 13  
 import org.kuali.rice.krad.web.form.LookupForm;
 14  
 import org.kuali.rice.krad.uif.UifConstants;
 15  
 import org.kuali.rice.krad.uif.UifParameters;
 16  
 import org.kuali.rice.krad.util.KRADUtils;
 17  
 import org.kuali.rice.krad.util.UrlFactory;
 18  
 import org.kuali.rice.krad.util.KRADConstants;
 19  
 
 20  
 import org.kuali.student.enrollment.acal.dto.KeyDateInfo;
 21  
 import org.kuali.student.enrollment.acal.dto.TermInfo;
 22  
 import org.kuali.student.enrollment.acal.service.AcademicCalendarService;
 23  
 import org.kuali.student.enrollment.class2.acal.dto.TermWrapper;
 24  
 import org.kuali.student.r2.common.dto.ContextInfo;
 25  
 import org.kuali.student.r2.common.exceptions.*;
 26  
 import org.kuali.student.r2.common.util.constants.AtpServiceConstants;
 27  
 
 28  0
 public class TermWrapperLookupableImpl extends LookupableImpl {
 29  
     public final static String TERM_WRAPPER_KEY = "key";
 30  
 
 31  
          private transient AcademicCalendarService academicCalendarService;
 32  
 
 33  
     @Override
 34  
     protected List<?> getSearchResults(LookupForm lookupForm, Map<String, String> fieldValues, boolean unbounded) {
 35  0
             TermInfo termInfo = null;
 36  0
             List<TermWrapper> termWrapperList = new ArrayList<TermWrapper>();
 37  
 
 38  0
             String termKey = fieldValues.get(TERM_WRAPPER_KEY);
 39  0
             ContextInfo context = new ContextInfo();
 40  
             try{
 41  0
                     termInfo = getAcademicCalendarService().getTerm(termKey, context);
 42  0
             TermWrapper termWrapper = new TermWrapper();
 43  0
             termWrapper.setTermInfo(termInfo);
 44  0
             List<KeyDateInfo>  keyDateInfoList = getAcademicCalendarService().getKeyDatesForTerm(termKey, context);
 45  0
             for (KeyDateInfo keyDateInfo : keyDateInfoList){
 46  0
                                     if(AtpServiceConstants.MILESTONE_INSTRUCTIONAL_PERIOD_TYPE_KEY.equals(keyDateInfo.getTypeKey())){
 47  0
                         termWrapper.setClassesMeetDates(keyDateInfo);
 48  
                                     }
 49  0
                                     else if(AtpServiceConstants.MILESTONE_REGISTRATION_PERIOD_TYPE_KEY.equals(keyDateInfo.getTypeKey())){
 50  0
                                             termWrapper.setRegistrationPeriod(keyDateInfo);
 51  
                                     }
 52  0
                                     else if(AtpServiceConstants.MILESTONE_DROP_DATE_TYPE_KEY.equals(keyDateInfo.getTypeKey())){
 53  0
                                             termWrapper.setDropPeriodEndsDate(keyDateInfo);
 54  
                                     }
 55  0
                                     else if(AtpServiceConstants.MILESTONE_FINAL_EXAM_PERIOD_TYPE_KEY.equals(keyDateInfo.getTypeKey())){
 56  0
                                             termWrapper.setFinalExaminationsDates(keyDateInfo);
 57  
                                     }
 58  0
                                     else if(AtpServiceConstants.MILESTONE_GRADES_DUE_TYPE_KEY.equals(keyDateInfo.getTypeKey())){
 59  0
                                             termWrapper.setGradesDueDate(keyDateInfo);
 60  
                                     }
 61  
                     }
 62  0
                     termWrapperList.add(termWrapper);
 63  0
                     return termWrapperList;
 64  0
             }catch (DoesNotExistException dnee){
 65  0
             System.out.println("call getAcademicCalendarService().getKeyDatesForTerm(termKey, context), and get DoesNotExistException:  "+dnee.toString());
 66  0
             }catch (InvalidParameterException ipe){
 67  0
             System.out.println("call getAcademicCalendarService().getKeyDatesForTerm(termKey, context), and get InvalidParameterException:  "+ipe.toString());
 68  0
             }catch (MissingParameterException mpe){
 69  0
             System.out.println("call getAcademicCalendarService().getKeyDatesForTerm(termKey, context), and get MissingParameterException:  "+mpe.toString());
 70  0
             }catch (OperationFailedException ofe){
 71  0
             System.out.println("call getAcademicCalendarService().getKeyDatesForTerm(termKey, context), and get OperationFailedException:  "+ofe.toString());
 72  0
             }catch (PermissionDeniedException pde){
 73  0
             System.out.println("call getAcademicCalendarService().getKeyDatesForTerm(termKey, context), and get PermissionDeniedException:  "+pde.toString());
 74  0
             }
 75  0
             return null;
 76  
     }
 77  
 
 78  
     protected AcademicCalendarService getAcademicCalendarService() {
 79  0
         if(academicCalendarService == null) {
 80  0
                  academicCalendarService = (AcademicCalendarService) GlobalResourceLoader.getService(new QName("http://student.kuali.org/wsdl/acal", "AcademicCalendarService"));
 81  
         }
 82  0
         return academicCalendarService;
 83  
     }
 84  
 }