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.kns.service.KNSServiceLocator;
21 import org.kuali.rice.krad.service.BusinessObjectService;
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.HashMap;
30 import java.util.List;
31 import java.util.Map;
32
33
34
35
36 public class AgendaInquiryHelperServiceImpl extends KualiInquirableImpl {
37
38 private transient KrmsRetriever krmsRetriever = new KrmsRetriever();
39
40 private BusinessObjectService businessObjectService;
41
42 @Override
43 public AgendaEditor retrieveDataObject(Map fieldValues) {
44 AgendaEditor agendaEditor = null;
45
46 Map<String, Object> primaryKeys = new HashMap<String, Object>();
47 primaryKeys.put("id", fieldValues.get("id"));
48
49 AgendaBo agenda = getBusinessObjectService().findByPrimaryKey(AgendaBo.class, primaryKeys);
50 if (agenda != null) {
51 agendaEditor = new AgendaEditor();
52 agendaEditor.setAgenda(agenda);
53 agendaEditor.setNamespace(agenda.getContext().getNamespace());
54 agendaEditor.setContextName(agenda.getContext().getName());
55 agendaEditor.setCustomAttributesMap(agenda.getAttributes());
56 }
57
58 return agendaEditor;
59 }
60
61
62
63
64
65
66 private AgendaEditor retrieveAgendaEditor(InquiryForm model) {
67 InquiryForm inquiryForm = (InquiryForm)model;
68 return (AgendaEditor)inquiryForm.getDataObject();
69 }
70
71
72
73
74
75
76
77
78 public List<RemotableAttributeField> retrieveAgendaCustomAttributes(View view, Object model, Container container) {
79 AgendaEditor agendaEditor = retrieveAgendaEditor((InquiryForm) model);
80 return krmsRetriever.retrieveAgendaCustomAttributes(agendaEditor);
81 }
82
83
84
85
86
87
88
89
90 public List<RemotableAttributeField> retrieveRuleActionCustomAttributes(View view, Object model, Container container) {
91 AgendaEditor agendaEditor = retrieveAgendaEditor((InquiryForm)model);
92 return krmsRetriever.retrieveRuleActionCustomAttributes(agendaEditor);
93 }
94
95
96
97
98
99
100
101
102 public List<RemotableAttributeField> retrieveRuleCustomAttributes(View view, Object model, Container container) {
103 AgendaEditor agendaEditor = retrieveAgendaEditor((InquiryForm)model);
104 return krmsRetriever.retrieveRuleCustomAttributes(agendaEditor);
105 }
106
107
108
109
110
111
112
113
114
115
116
117 public List<RemotableAttributeField> retrieveTermParameters(View view, Object model, Container container) {
118 return Collections.emptyList();
119 }
120
121
122 public BusinessObjectService getBusinessObjectService() {
123 if(businessObjectService == null){
124 return KNSServiceLocator.getBusinessObjectService();
125 }
126 return businessObjectService;
127 }
128
129 public void setBusinessObjectService(BusinessObjectService businessObjectService) {
130 this.businessObjectService = businessObjectService;
131 }
132
133 }