| 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 | 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 | |
} |