Coverage Report - org.kuali.student.enrollment.class2.grading.service.impl.GradeCourseOfferringLookupableImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
GradeCourseOfferringLookupableImpl
0%
0/14
0%
0/2
4
 
 1  
 package org.kuali.student.enrollment.class2.grading.service.impl;
 2  
 
 3  
 /*
 4  
  * Copyright 2007 The Kuali Foundation
 5  
  *
 6  
  * Licensed under the Educational Community License, Version 1.0 (the "License");
 7  
  * you may not use this file except in compliance with the License.
 8  
  * You may obtain a copy of the License at
 9  
  *
 10  
  * http://www.opensource.org/licenses/ecl1.php
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 
 19  
 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
 20  
 import org.kuali.rice.krad.lookup.LookupableImpl;
 21  
 import org.kuali.rice.krad.util.GlobalVariables;
 22  
 import org.kuali.rice.krad.web.form.LookupForm;
 23  
 import org.kuali.student.enrollment.class2.grading.util.GradingConstants;
 24  
 import org.kuali.student.enrollment.courseoffering.dto.CourseOfferingInfo;
 25  
 import org.kuali.student.enrollment.courseoffering.service.CourseOfferingService;
 26  
 import org.kuali.student.enrollment.grading.dto.GradeRosterInfo;
 27  
 import org.kuali.student.enrollment.grading.service.GradingService;
 28  
 import org.kuali.student.r2.common.dto.ContextInfo;
 29  
 import org.kuali.student.r2.common.exceptions.*;
 30  
 
 31  
 import javax.xml.namespace.QName;
 32  
 import java.util.ArrayList;
 33  
 import java.util.List;
 34  
 import java.util.Map;
 35  
 
 36  0
 public class GradeCourseOfferringLookupableImpl extends LookupableImpl {
 37  
 
 38  
     @Override
 39  
     protected List<?> getSearchResults(LookupForm lookupForm, Map<String, String> fieldValues, boolean unbounded) {
 40  0
         ContextInfo context = ContextInfo.newInstance();
 41  
 
 42  0
         String termKey = fieldValues.get("termKey");
 43  
 
 44  0
         String currentUser = GlobalVariables.getUserSession().getPrincipalId();
 45  0
         List<CourseOfferingInfo> courseOfferingInfoList = new ArrayList();
 46  
 
 47  0
         GradingService gradingService = (GradingService) GlobalResourceLoader.getService(new QName(GradingConstants.GRADING_SERVICE_URL, GradingConstants.GRADING_SERVICE_NAME));
 48  0
         CourseOfferingService courseOfferingService = (CourseOfferingService)GlobalResourceLoader.getService(new QName("http://student.kuali.org/wsdl/courseOffering", "coService"));
 49  
 
 50  
         try{
 51  0
             List<String> coIds = courseOfferingService.getCourseOfferingIdsByTermAndInstructorId(termKey,currentUser,context);
 52  0
             if (!coIds.isEmpty()){
 53  0
                 courseOfferingInfoList = courseOfferingService.getCourseOfferingsByIdList(coIds, context);
 54  
             }
 55  0
         }catch(Exception e){
 56  
             //FIXME: Change it to use proper error handling
 57  0
             throw new RuntimeException(e);
 58  0
         }
 59  
 
 60  0
         return courseOfferingInfoList;
 61  
     }
 62  
 }