Coverage Report - org.kuali.student.enrollment.class2.courseoffering.service.RegistrationGroupWrapperLookupViewHelperServiceImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
RegistrationGroupWrapperLookupViewHelperServiceImpl
0%
0/33
0%
0/8
5.667
 
 1  
 package org.kuali.student.enrollment.class2.courseoffering.service;
 2  
 
 3  
 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
 4  
 import org.kuali.rice.kns.authorization.BusinessObjectRestrictions;
 5  
 import org.kuali.rice.kns.uif.service.impl.LookupViewHelperServiceImpl;
 6  
 import org.kuali.student.enrollment.class2.courseoffering.dto.RegistrationGroupWrapper;
 7  
 import org.kuali.student.enrollment.courseoffering.dto.RegistrationGroupInfo;
 8  
 import org.kuali.student.enrollment.courseoffering.service.CourseOfferingService;
 9  
 import org.kuali.student.r2.common.dto.ContextInfo;
 10  
 import org.kuali.student.r2.common.exceptions.*;
 11  
 
 12  
 import javax.xml.namespace.QName;
 13  
 import java.util.ArrayList;
 14  
 import java.util.List;
 15  
 import java.util.Map;
 16  
 
 17  0
 public class RegistrationGroupWrapperLookupViewHelperServiceImpl extends LookupViewHelperServiceImpl {
 18  
 
 19  
     private transient CourseOfferingService courseOfferingService;
 20  
     private static final String TERM_FIELD_NAME = "courseOffering.termKey";
 21  
     private static final String SUBJECT_AREA_FIELD_NAME = "courseOffering.subjectArea";
 22  
 
 23  
     @Override
 24  
     protected List<?> getSearchResultsWithBounding(Map<String, String> fieldValues, boolean unbounded) {
 25  
 
 26  0
         ContextInfo context = ContextInfo.newInstance();
 27  0
         String termKey = fieldValues.get(TERM_FIELD_NAME);
 28  0
         String subjectArea = fieldValues.get(SUBJECT_AREA_FIELD_NAME);
 29  
 
 30  
         List<RegistrationGroupWrapper> registrationGroupWrappers;
 31  
 
 32  
         try {
 33  0
             List<String> courseOfferingIds = getCourseOfferingService().getCourseOfferingIdsByTermAndSubjectArea(termKey, subjectArea, context);
 34  0
             registrationGroupWrappers = new ArrayList<RegistrationGroupWrapper>(courseOfferingIds.size());
 35  
 
 36  0
             for(String coId : courseOfferingIds) {
 37  0
                 List<RegistrationGroupInfo> regGroups = getCourseOfferingService().getRegGroupsForCourseOffering(coId, context);
 38  
 
 39  0
                 for(RegistrationGroupInfo regGroup : regGroups) {
 40  0
                     RegistrationGroupWrapper wrapper = new RegistrationGroupWrapper();
 41  
 
 42  0
                     wrapper.setCourseOffering(getCourseOfferingService().getCourseOffering(coId, context));
 43  0
                     wrapper.setRegistrationGroup(regGroup);
 44  
 
 45  
                     // TODO right now getOfferingsByIdList throws a not supported exception
 46  
                     //wrapper.setActivityOfferings(getCourseOfferingService().getActivityOfferingsByIdList(regGroup.getActivityOfferingIds(), context));
 47  
 
 48  0
                     for(String activityId : regGroup.getActivityOfferingIds()) {
 49  0
                         wrapper.getActivityOfferings().add(getCourseOfferingService().getActivityOffering(activityId, context));
 50  
                     }
 51  
 
 52  0
                     registrationGroupWrappers.add(wrapper);
 53  0
                 }
 54  
 
 55  0
             }
 56  
 
 57  0
         } catch (DoesNotExistException e) {
 58  0
             throw new RuntimeException(e);
 59  0
         } catch (InvalidParameterException e) {
 60  0
             throw new RuntimeException(e);
 61  0
         } catch (MissingParameterException e) {
 62  0
             throw new RuntimeException(e);
 63  0
         } catch (OperationFailedException e) {
 64  0
             throw new RuntimeException(e);
 65  0
         } catch (PermissionDeniedException e) {
 66  0
             throw new RuntimeException(e);
 67  0
         }
 68  
 
 69  0
         return registrationGroupWrappers;
 70  
     }
 71  
 
 72  
     protected CourseOfferingService getCourseOfferingService() {
 73  0
         if (courseOfferingService == null) {
 74  0
             courseOfferingService = (CourseOfferingService) GlobalResourceLoader.getService(new QName("http://student.kuali.org/wsdl/courseOffering", "CourseOfferingService"));
 75  
         }
 76  
 
 77  0
         return courseOfferingService;
 78  
     }
 79  
 
 80  
     @Override
 81  
     protected String getActionUrls(Object dataObject, List<String> pkNames, BusinessObjectRestrictions dataObjectRestrictions) {
 82  0
         return "";
 83  
     }
 84  
 }
 85