1
2
3
4
5
6
7
8
9
10
11
12 package org.kuali.student.enrollment.state.service.impl;
13
14 import java.util.Map;
15 import javax.xml.namespace.QName;
16 import org.apache.log4j.Logger;
17 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
18 import org.kuali.rice.krad.inquiry.InquirableImpl;
19 import org.kuali.student.enrollment.common.util.ContextBuilder;
20 import org.kuali.student.r2.common.dto.ContextInfo;
21 import org.kuali.student.r2.common.exceptions.DoesNotExistException;
22 import org.kuali.student.r2.common.exceptions.InvalidParameterException;
23 import org.kuali.student.r2.common.exceptions.MissingParameterException;
24 import org.kuali.student.r2.common.exceptions.OperationFailedException;
25 import org.kuali.student.r2.common.exceptions.PermissionDeniedException;
26 import org.kuali.student.r2.core.constants.StateServiceConstants;
27 import org.kuali.student.r2.core.class1.state.dto.LifecycleInfo;
28 import org.kuali.student.r2.core.class1.state.service.StateService;
29
30
31
32
33
34
35 public class LifecycleInfoAdminInquirableImpl
36 extends InquirableImpl {
37
38 private final static String KEY = "key";
39 private transient StateService stateService;
40 final Logger logger = Logger.getLogger(LifecycleInfoAdminInquirableImpl.class);
41
42 @Override
43 public LifecycleInfo retrieveDataObject(Map<String, String> parameters) {
44 try {
45 return getStateService().getLifecycle(parameters.get(KEY), getContextInfo());
46 } catch (DoesNotExistException ex) {
47 throw new RuntimeException (ex);
48 } catch (InvalidParameterException ex) {
49 throw new RuntimeException (ex);
50 } catch (MissingParameterException ex) {
51 throw new RuntimeException (ex);
52 } catch (OperationFailedException ex) {
53 throw new RuntimeException (ex);
54 } catch (PermissionDeniedException ex) {
55 throw new RuntimeException (ex);
56 }
57 }
58
59 public void setStateService(StateService stateService) {
60 this.stateService = stateService;
61 }
62
63 public StateService getStateService() {
64 if (stateService == null) {
65 stateService = (StateService) GlobalResourceLoader.getService(new QName(StateServiceConstants.NAMESPACE,
66 StateServiceConstants.SERVICE_NAME_LOCAL_PART));
67 }
68 return this.stateService;
69 }
70
71 private ContextInfo getContextInfo() {
72 return ContextBuilder.loadContextInfo();
73 }
74 }