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.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.core.atp.dto.MilestoneInfo;
27 import org.kuali.student.r2.core.atp.service.AtpService;
28 import org.kuali.student.r2.core.constants.AtpServiceConstants;
29
30
31 public class MilestoneInfoAdminInquirableImpl extends InquirableImpl
32 {
33 private static final Logger LOG = Logger.getLogger(MilestoneInfoAdminInquirableImpl.class);
34 private transient AtpService atpService;
35 private final static String PRIMARY_KEY = "id";
36 private static final long serialVersionUID = 1L;
37 @Override
38 public MilestoneInfo retrieveDataObject(Map<String, String> parameters)
39 {
40 String key = parameters.get(PRIMARY_KEY);
41 try
42 {
43 MilestoneInfo info = this.getAtpService().getMilestone(key, getContextInfo());
44 return info;
45 }
46 catch (Exception ex) {
47 throw new RuntimeException(ex);
48 }
49 }
50
51 public void setAtpService(AtpService atpService)
52 {
53 this.atpService = atpService;
54 }
55
56 public AtpService getAtpService()
57 {
58 if (atpService == null)
59 {
60 QName qname = new QName(AtpServiceConstants.NAMESPACE,AtpServiceConstants.SERVICE_NAME_LOCAL_PART);
61 atpService = (AtpService) GlobalResourceLoader.getService(qname);
62 }
63 return this.atpService;
64 }
65
66 private ContextInfo getContextInfo() {
67 return ContextBuilder.loadContextInfo();
68 }
69 }
70