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.common.util.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 | 0 | public class EnrollmentFeeInquirableImpl extends InquirableImpl { |
38 | |
|
39 | |
private FeeService feeService; |
40 | |
private ContextInfo contextInfo; |
41 | |
|
42 | |
@Override |
43 | |
public EnrollmentFeeInfo retrieveDataObject(Map<String, String> parameters) { |
44 | |
|
45 | 0 | EnrollmentFeeInfo efiRet = null; |
46 | |
|
47 | |
try { |
48 | 0 | String id = parameters.get("id"); |
49 | |
|
50 | 0 | if(id != null && !"".equals(id)){ |
51 | 0 | efiRet = getFeeService().getFee(id,getContextInfo() ); |
52 | |
} |
53 | 0 | } catch (Exception e) { |
54 | 0 | e.printStackTrace(); |
55 | 0 | } |
56 | 0 | return efiRet; |
57 | |
} |
58 | |
|
59 | |
public FeeService getFeeService() { |
60 | 0 | if (feeService == null) { |
61 | 0 | this.feeService = (FeeService) GlobalResourceLoader.getService(new QName(FeeServiceConstants.NAMESPACE, FeeServiceConstants.SERVICE_NAME_LOCAL_PART)); |
62 | |
} |
63 | 0 | return this.feeService; |
64 | |
} |
65 | |
|
66 | |
public void setFeeService(FeeService feeService) { |
67 | 0 | this.feeService = feeService; |
68 | 0 | } |
69 | |
|
70 | |
public CourseOfferingService getCourseOfferingService() { |
71 | 0 | return CourseOfferingResourceLoader.loadCourseOfferingService(); |
72 | |
} |
73 | |
|
74 | |
public ContextInfo getContextInfo() { |
75 | 0 | if (null == contextInfo) { |
76 | 0 | contextInfo = new ContextInfo(); |
77 | 0 | contextInfo.setAuthenticatedPrincipalId(GlobalVariables.getUserSession().getPrincipalId()); |
78 | 0 | contextInfo.setPrincipalId(GlobalVariables.getUserSession().getPrincipalId()); |
79 | 0 | LocaleInfo localeInfo = new LocaleInfo(); |
80 | 0 | localeInfo.setLocaleLanguage(Locale.getDefault().getLanguage()); |
81 | 0 | localeInfo.setLocaleRegion(Locale.getDefault().getCountry()); |
82 | 0 | contextInfo.setLocale(localeInfo); |
83 | |
} |
84 | 0 | return contextInfo; |
85 | |
} |
86 | |
|
87 | |
|
88 | |
} |
89 | |
|