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