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.apache.commons.lang.StringUtils; |
20 | |
import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; |
21 | |
import org.kuali.rice.kns.uif.service.impl.LookupViewHelperServiceImpl; |
22 | |
import org.kuali.rice.kns.util.GlobalVariables; |
23 | |
import org.kuali.student.enrollment.class2.grading.service.GradeCourseOfferringLookupHelperService; |
24 | |
import org.kuali.student.enrollment.class2.grading.util.GradingConstants; |
25 | |
import org.kuali.student.enrollment.courseoffering.dto.CourseOfferingInfo; |
26 | |
import org.kuali.student.enrollment.courseoffering.service.CourseOfferingService; |
27 | |
import org.kuali.student.enrollment.grading.dto.GradeRosterInfo; |
28 | |
import org.kuali.student.enrollment.grading.service.GradingService; |
29 | |
import org.kuali.student.r2.common.dto.ContextInfo; |
30 | |
import org.kuali.student.r2.common.exceptions.*; |
31 | |
|
32 | |
import javax.xml.namespace.QName; |
33 | |
import java.util.ArrayList; |
34 | |
import java.util.List; |
35 | |
import java.util.Map; |
36 | |
|
37 | 0 | public class GradeCourseOfferringLookupHelperServiceImpl extends LookupViewHelperServiceImpl implements GradeCourseOfferringLookupHelperService { |
38 | |
|
39 | |
@Override |
40 | |
protected List<?> getSearchResultsWithBounding(Map<String, String> fieldValues, boolean unbounded) { |
41 | |
|
42 | 0 | ContextInfo context = ContextInfo.newInstance(); |
43 | |
|
44 | 0 | String termKey = fieldValues.get("termKey"); |
45 | |
|
46 | 0 | String currentUser = GlobalVariables.getUserSession().getPrincipalId(); |
47 | 0 | List<CourseOfferingInfo> courseOfferingInfoList = new ArrayList(); |
48 | |
|
49 | 0 | GradingService gradingService = (GradingService) GlobalResourceLoader.getService(new QName(GradingConstants.GRADING_SERVICE_URL, GradingConstants.GRADING_SERVICE_NAME)); |
50 | 0 | CourseOfferingService courseOfferingService = (CourseOfferingService)GlobalResourceLoader.getService(new QName("http://student.kuali.org/wsdl/courseOffering", "CourseOfferingMockService")); |
51 | |
try { |
52 | 0 | List<GradeRosterInfo> gradeRosterInfoList = gradingService.getGradeRostersByGraderAndTerm(currentUser, termKey, context); |
53 | 0 | if (gradeRosterInfoList != null){ |
54 | 0 | List<String> courseOfferingIds = new ArrayList(); |
55 | 0 | for (GradeRosterInfo gradeInfo : gradeRosterInfoList){ |
56 | 0 | courseOfferingIds.add(gradeInfo.getCourseOfferingId()); |
57 | |
} |
58 | 0 | courseOfferingInfoList = courseOfferingService.getCourseOfferingsByIdList(courseOfferingIds, context); |
59 | |
} |
60 | |
|
61 | 0 | } catch (DoesNotExistException e) { |
62 | 0 | e.printStackTrace(); |
63 | 0 | } catch (InvalidParameterException e) { |
64 | 0 | e.printStackTrace(); |
65 | 0 | } catch (MissingParameterException e) { |
66 | 0 | e.printStackTrace(); |
67 | 0 | } catch (OperationFailedException e) { |
68 | 0 | e.printStackTrace(); |
69 | 0 | } catch (PermissionDeniedException e) { |
70 | 0 | e.printStackTrace(); |
71 | 0 | } |
72 | |
|
73 | 0 | return courseOfferingInfoList; |
74 | |
} |
75 | |
} |