Coverage Report - org.kuali.student.enrollment.class2.courseoffering.service.CourseOfferingInfoLookupableImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
CourseOfferingInfoLookupableImpl
0%
0/23
0%
0/4
7
 
 1  
 package org.kuali.student.enrollment.class2.courseoffering.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.courseoffering.dto.CourseOfferingInfo;
 7  
 import org.kuali.student.enrollment.courseoffering.service.CourseOfferingService;
 8  
 import org.kuali.student.r2.common.dto.ContextInfo;
 9  
 import org.kuali.student.r2.common.exceptions.*;
 10  
 
 11  
 import javax.xml.namespace.QName;
 12  
 import java.util.ArrayList;
 13  
 import java.util.List;
 14  
 import java.util.Map;
 15  
 
 16  0
 public class CourseOfferingInfoLookupableImpl extends LookupableImpl {
 17  
 
 18  
     private transient CourseOfferingService courseOfferingService;
 19  
     private static final String TERM_FIELD_NAME = "termKey";
 20  
     private static final String SUBJECT_AREA_FIELD_NAME = "subjectArea";
 21  
 
 22  
     @Override
 23  
     protected List<?> getSearchResults(LookupForm lookupForm, Map<String, String> fieldValues, boolean unbounded) {
 24  
 
 25  0
         ContextInfo context = new ContextInfo();
 26  0
         String termKey = fieldValues.get(TERM_FIELD_NAME);
 27  0
         String subjectArea = fieldValues.get(SUBJECT_AREA_FIELD_NAME);
 28  
 
 29  
         List<CourseOfferingInfo> courseOfferings;
 30  
 
 31  
         try {
 32  0
             List<String> courseOfferingIds = getCourseOfferingService().getCourseOfferingIdsByTermAndSubjectArea(termKey, subjectArea, context);
 33  0
             courseOfferings = new ArrayList<CourseOfferingInfo>(courseOfferingIds.size());
 34  
 
 35  0
             for(String coId : courseOfferingIds) {
 36  0
                 courseOfferings.add(getCourseOfferingService().getCourseOffering(coId, context));
 37  
             }
 38  
 
 39  0
         } catch (DoesNotExistException e) {
 40  0
             throw new RuntimeException(e);
 41  0
         } catch (InvalidParameterException e) {
 42  0
             throw new RuntimeException(e);
 43  0
         } catch (MissingParameterException e) {
 44  0
             throw new RuntimeException(e);
 45  0
         } catch (OperationFailedException e) {
 46  0
             throw new RuntimeException(e);
 47  0
         } catch (PermissionDeniedException e) {
 48  0
             throw new RuntimeException(e);
 49  0
         }
 50  
 
 51  0
         return courseOfferings;
 52  
     }
 53  
 
 54  
     protected CourseOfferingService getCourseOfferingService() {
 55  0
         if (courseOfferingService == null) {
 56  0
             courseOfferingService = (CourseOfferingService) GlobalResourceLoader.getService(new QName("http://student.kuali.org/wsdl/courseOffering", "CourseOfferingService"));
 57  
         }
 58  
 
 59  0
         return courseOfferingService;
 60  
     }
 61  
 }