Coverage Report - org.kuali.student.enrollment.class2.grading.keyvalue.CourseOfferingForGradingKeyValues
 
Classes in this File Line Coverage Branch Coverage Complexity
CourseOfferingForGradingKeyValues
0%
0/23
0%
0/4
11
 
 1  
 package org.kuali.student.enrollment.class2.grading.keyvalue;
 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.student.enrollment.class2.grading.util.GradingConstants;
 21  
 import org.kuali.student.enrollment.grading.dto.GradeRosterInfo;
 22  
 import org.kuali.student.enrollment.grading.service.GradingService;
 23  
 import org.kuali.student.r2.common.dto.ContextInfo;
 24  
 import org.kuali.student.r2.common.exceptions.*;
 25  
 import org.kuali.student.r2.common.util.constants.GradingServiceConstants;
 26  
 import org.kuali.student.mock.utilities.TestHelper;
 27  
 
 28  
 import javax.xml.namespace.QName;
 29  
 import java.util.ArrayList;
 30  
 import java.util.List;
 31  
 import org.kuali.rice.core.api.util.ConcreteKeyValue;
 32  
 import org.kuali.rice.krad.keyvalues.KeyValuesBase;
 33  
 import org.kuali.rice.krad.util.GlobalVariables;
 34  
 
 35  0
 public class CourseOfferingForGradingKeyValues extends KeyValuesBase {
 36  
 
 37  
     @Override
 38  
     public List getKeyValues() {
 39  0
         List keyValues = new ArrayList();
 40  
 
 41  0
         ContextInfo context = TestHelper.getContext1();
 42  
 
 43  0
         GradingService gradingService = (GradingService) GlobalResourceLoader.getService(new QName(GradingServiceConstants.NAMESPACE, GradingServiceConstants.SERVICE_NAME_LOCAL_PART));
 44  
 
 45  0
         String currentUser = GlobalVariables.getUserSession().getPrincipalId();
 46  
 
 47  
         try {
 48  0
             List<GradeRosterInfo> gradeRosterInfoList = gradingService.getGradeRostersByGraderAndTerm(currentUser, GradingConstants.CURRENT_TERM, context);
 49  0
             keyValues.add(new ConcreteKeyValue("", ""));
 50  0
             if (gradeRosterInfoList != null){
 51  0
                 List courseOfferingList = new ArrayList();
 52  0
                 for (GradeRosterInfo rosterInfo : gradeRosterInfoList){
 53  0
                     keyValues.add(new ConcreteKeyValue(rosterInfo.getCourseOfferingId(), rosterInfo.getName()));
 54  
                 }
 55  
             }
 56  0
         } catch (DoesNotExistException e) {
 57  0
             keyValues.add(new ConcreteKeyValue("", ""));
 58  0
         } catch (InvalidParameterException e) {
 59  0
             throw new RuntimeException(e);
 60  0
         } catch (MissingParameterException e) {
 61  0
             throw new RuntimeException(e);
 62  0
         } catch (OperationFailedException e) {
 63  0
             throw new RuntimeException(e);
 64  0
         } catch (PermissionDeniedException e) {
 65  0
             GlobalVariables.getMessageMap().putError ("test",e.getMessage());
 66  0
         }
 67  
 
 68  0
         return keyValues;
 69  
     }
 70  
 
 71  
 }