1 | |
package org.kuali.student.enrollment.class2.grading.service.impl; |
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.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 | |
|
57 | 0 | throw new RuntimeException(e); |
58 | 0 | } |
59 | |
|
60 | 0 | return courseOfferingInfoList; |
61 | |
} |
62 | |
} |