1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.kuali.student.enrollment.class2.courseoffering.service.impl;
16
17 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
18 import org.kuali.rice.krad.inquiry.InquirableImpl;
19 import org.kuali.rice.krad.util.GlobalVariables;
20 import org.kuali.student.enrollment.class2.courseoffering.util.CourseOfferingResourceLoader;
21 import org.kuali.student.enrollment.courseoffering.service.CourseOfferingService;
22 import org.kuali.student.r2.common.dto.ContextInfo;
23 import org.kuali.student.r2.common.dto.LocaleInfo;
24 import org.kuali.student.r2.core.constants.FeeServiceConstants;
25 import org.kuali.student.r2.core.fee.dto.EnrollmentFeeInfo;
26 import org.kuali.student.r2.core.fee.service.FeeService;
27
28 import javax.xml.namespace.QName;
29 import java.util.Locale;
30 import java.util.Map;
31
32
33
34
35
36
37 public class EnrollmentFeeInfoInquirableImpl extends InquirableImpl {
38
39 private FeeService feeService;
40 private ContextInfo contextInfo;
41
42 @Override
43 public EnrollmentFeeInfo retrieveDataObject(Map<String, String> parameters) {
44
45 EnrollmentFeeInfo efiRet = null;
46
47 try {
48 String id = parameters.get("id");
49
50 if(id != null && !"".equals(id)){
51 efiRet = getFeeService().getFee(id,getContextInfo() );
52 }
53 } catch (Exception e) {
54 e.printStackTrace();
55 }
56 return efiRet;
57 }
58
59 public FeeService getFeeService() {
60 if (feeService == null) {
61 this.feeService = (FeeService) GlobalResourceLoader.getService(new QName(FeeServiceConstants.NAMESPACE, FeeServiceConstants.SERVICE_NAME_LOCAL_PART));
62 }
63 return this.feeService;
64 }
65
66 public void setFeeService(FeeService feeService) {
67 this.feeService = feeService;
68 }
69
70 public CourseOfferingService getCourseOfferingService() {
71 return CourseOfferingResourceLoader.loadCourseOfferingService();
72 }
73
74 public ContextInfo getContextInfo() {
75 if (null == contextInfo) {
76 contextInfo = new ContextInfo();
77 contextInfo.setAuthenticatedPrincipalId(GlobalVariables.getUserSession().getPrincipalId());
78 contextInfo.setPrincipalId(GlobalVariables.getUserSession().getPrincipalId());
79 LocaleInfo localeInfo = new LocaleInfo();
80 localeInfo.setLocaleLanguage(Locale.getDefault().getLanguage());
81 localeInfo.setLocaleRegion(Locale.getDefault().getCountry());
82 contextInfo.setLocale(localeInfo);
83 }
84 return contextInfo;
85 }
86
87
88 }
89