1 package org.kuali.student.enrollment.class2.grading.keyvalue;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
36 @Deprecated
37 public class CourseOfferingForGradingKeyValues extends KeyValuesBase {
38
39 @Override
40 public List getKeyValues() {
41 List keyValues = new ArrayList();
42
43 ContextInfo context = TestHelper.getContext1();
44
45 GradingService gradingService = (GradingService) GlobalResourceLoader.getService(new QName(GradingServiceConstants.NAMESPACE, GradingServiceConstants.SERVICE_NAME_LOCAL_PART));
46
47 String currentUser = GlobalVariables.getUserSession().getPrincipalId();
48
49 try {
50 List<GradeRosterInfo> gradeRosterInfoList = gradingService.getGradeRostersByGraderAndTerm(currentUser, GradingConstants.CURRENT_TERM, context);
51 keyValues.add(new ConcreteKeyValue("", ""));
52 if (gradeRosterInfoList != null){
53
54 for (GradeRosterInfo rosterInfo : gradeRosterInfoList){
55 keyValues.add(new ConcreteKeyValue(rosterInfo.getCourseOfferingId(), rosterInfo.getName()));
56 }
57 }
58 } catch (DoesNotExistException e) {
59 keyValues.add(new ConcreteKeyValue("", ""));
60 } catch (InvalidParameterException e) {
61 throw new RuntimeException(e);
62 } catch (MissingParameterException e) {
63 throw new RuntimeException(e);
64 } catch (OperationFailedException e) {
65 throw new RuntimeException(e);
66 } catch (PermissionDeniedException e) {
67 GlobalVariables.getMessageMap().putError ("test",e.getMessage());
68 }
69
70 return keyValues;
71 }
72
73 }