1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.ui.admin.lrc;
17
18
19 import java.util.Map;
20 import javax.xml.namespace.QName;
21 import org.apache.log4j.Logger;
22 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
23 import org.kuali.rice.krad.inquiry.InquirableImpl;
24 import org.kuali.student.common.util.ContextBuilder;
25 import org.kuali.student.r2.common.dto.ContextInfo;
26 import org.kuali.student.r2.lum.lrc.dto.ResultScaleInfo;
27 import org.kuali.student.r2.lum.lrc.service.LRCService;
28 import org.kuali.student.r2.lum.util.constants.LrcServiceConstants;
29
30
31 public class ResultScaleInfoAdminInquirableImpl extends InquirableImpl
32 {
33 private static final Logger LOG = Logger.getLogger(ResultScaleInfoAdminInquirableImpl.class);
34 private transient LRCService lRCService;
35 private final static String PRIMARY_KEY = "key";
36 private static final long serialVersionUID = 1L;
37 @Override
38 public ResultScaleInfo retrieveDataObject(Map<String, String> parameters)
39 {
40 String key = parameters.get(PRIMARY_KEY);
41 try
42 {
43 ResultScaleInfo info = this.getLRCService().getResultScale(key, getContextInfo());
44 return info;
45 }
46 catch (Exception ex) {
47 throw new RuntimeException(ex);
48 }
49 }
50
51 public void setLRCService(LRCService lRCService)
52 {
53 this.lRCService = lRCService;
54 }
55
56 public LRCService getLRCService()
57 {
58 if (lRCService == null)
59 {
60 QName qname = new QName(LrcServiceConstants.NAMESPACE,LrcServiceConstants.SERVICE_NAME_LOCAL_PART);
61 lRCService = (LRCService) GlobalResourceLoader.getService(qname);
62 }
63 return this.lRCService;
64 }
65
66 private ContextInfo getContextInfo() {
67 return ContextBuilder.loadContextInfo();
68 }
69 }
70