1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krms.impl.repository;
17
18 import org.kuali.rice.core.api.uif.RemotableAttributeField;
19 import org.kuali.rice.kns.inquiry.KualiInquirableImpl;
20 import org.kuali.rice.krad.data.DataObjectService;
21 import org.kuali.rice.krad.service.KRADServiceLocator;
22 import org.kuali.rice.krad.uif.container.Container;
23 import org.kuali.rice.krad.uif.view.View;
24 import org.kuali.rice.krad.web.form.InquiryForm;
25 import org.kuali.rice.krms.impl.ui.AgendaEditor;
26 import org.kuali.rice.krms.impl.util.KrmsRetriever;
27
28 import java.util.Collections;
29 import java.util.List;
30 import java.util.Map;
31
32
33
34
35 public class AgendaInquiryHelperServiceImpl extends KualiInquirableImpl {
36
37 private transient KrmsRetriever krmsRetriever = new KrmsRetriever();
38
39 private DataObjectService dataObjectService;
40
41 @Override
42 public AgendaEditor retrieveDataObject(Map fieldValues) {
43 AgendaEditor agendaEditor = null;
44
45 AgendaBo agenda = getDataObjectService().find(AgendaBo.class, fieldValues.get("id"));
46 if (agenda != null) {
47 agendaEditor = new AgendaEditor();
48 agendaEditor.setAgenda(agenda);
49 agendaEditor.setNamespace(agenda.getContext().getNamespace());
50 agendaEditor.setContextName(agenda.getContext().getName());
51 agendaEditor.setCustomAttributesMap(agenda.getAttributes());
52 }
53
54 return agendaEditor;
55 }
56
57
58
59
60
61
62
63 private AgendaEditor retrieveAgendaEditor(InquiryForm model) {
64 InquiryForm inquiryForm = (InquiryForm) model;
65 return (AgendaEditor) inquiryForm.getDataObject();
66 }
67
68
69
70
71
72
73
74
75
76 public List<RemotableAttributeField> retrieveAgendaCustomAttributes(View view, Object model, Container container) {
77 AgendaEditor agendaEditor = retrieveAgendaEditor((InquiryForm) model);
78 return krmsRetriever.retrieveAgendaCustomAttributes(agendaEditor);
79 }
80
81
82
83
84
85
86
87
88
89 public List<RemotableAttributeField> retrieveRuleActionCustomAttributes(View view, Object model,
90 Container container) {
91 AgendaEditor agendaEditor = retrieveAgendaEditor((InquiryForm) model);
92 return krmsRetriever.retrieveRuleActionCustomAttributes(agendaEditor);
93 }
94
95
96
97
98
99
100
101
102
103 public List<RemotableAttributeField> retrieveRuleCustomAttributes(View view, Object model, Container container) {
104 AgendaEditor agendaEditor = retrieveAgendaEditor((InquiryForm) model);
105 return krmsRetriever.retrieveRuleCustomAttributes(agendaEditor);
106 }
107
108
109
110
111
112
113
114
115
116
117
118 public List<RemotableAttributeField> retrieveTermParameters(View view, Object model, Container container) {
119 return Collections.emptyList();
120 }
121
122 public DataObjectService getDataObjectService() {
123 if (dataObjectService == null) {
124 return KRADServiceLocator.getDataObjectService();
125 }
126 return dataObjectService;
127 }
128
129 public void setDataObjectService(DataObjectService dataObjectService) {
130 this.dataObjectService = dataObjectService;
131 }
132
133 }