1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kns.lookup; |
17 | |
|
18 | |
import org.kuali.rice.kns.document.authorization.BusinessObjectRestrictions; |
19 | |
import org.kuali.rice.kns.web.struts.form.LookupForm; |
20 | |
import org.kuali.rice.kns.web.ui.Field; |
21 | |
import org.kuali.rice.kns.web.ui.ResultRow; |
22 | |
import org.kuali.rice.krad.bo.BusinessObject; |
23 | |
import org.kuali.rice.krad.service.BusinessObjectDictionaryService; |
24 | |
import org.kuali.rice.krad.service.DataDictionaryService; |
25 | |
import org.kuali.rice.krad.util.KRADConstants; |
26 | |
import org.kuali.rice.krad.util.UrlFactory; |
27 | |
import org.springframework.transaction.annotation.Transactional; |
28 | |
|
29 | |
import java.util.Collection; |
30 | |
import java.util.List; |
31 | |
import java.util.Map; |
32 | |
import java.util.Properties; |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
@Transactional |
38 | |
public class KualiLookupableImpl implements Lookupable { |
39 | 0 | private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(KualiLookupableImpl.class); |
40 | 0 | protected static final String[] IGNORE_LIST = { KRADConstants.DOC_FORM_KEY, KRADConstants.BACK_LOCATION }; |
41 | |
|
42 | |
protected Class businessObjectClass; |
43 | |
protected LookupableHelperService lookupableHelperService; |
44 | 0 | protected String extraOnLoad = ""; |
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | 0 | public KualiLookupableImpl() { |
50 | 0 | } |
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
public void setBusinessObjectClass(Class boClass) { |
58 | 0 | if (boClass == null) { |
59 | 0 | throw new RuntimeException("Business object class is null."); |
60 | |
} |
61 | |
|
62 | 0 | this.businessObjectClass = boClass; |
63 | |
|
64 | |
|
65 | 0 | getLookupableHelperService().setBusinessObjectClass(boClass); |
66 | 0 | } |
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
|
72 | |
|
73 | |
public void setParameters(Map parameters) { |
74 | 0 | getLookupableHelperService().setParameters(parameters); |
75 | 0 | } |
76 | |
|
77 | |
|
78 | |
|
79 | |
|
80 | |
public Map getParameters() { |
81 | 0 | return getLookupableHelperService().getParameters(); |
82 | |
} |
83 | |
|
84 | |
|
85 | |
|
86 | |
|
87 | |
public List getColumns() { |
88 | 0 | return getLookupableHelperService().getColumns(); |
89 | |
} |
90 | |
|
91 | |
|
92 | |
|
93 | |
|
94 | |
|
95 | |
|
96 | |
public void validateSearchParameters(Map fieldValues) { |
97 | 0 | getLookupableHelperService().validateSearchParameters(fieldValues); |
98 | 0 | } |
99 | |
|
100 | |
|
101 | |
|
102 | |
|
103 | |
|
104 | |
|
105 | |
|
106 | |
|
107 | |
public List<BusinessObject> getSearchResultsUnbounded(Map<String, String> fieldValues) { |
108 | 0 | return getLookupableHelperService().getSearchResultsUnbounded(fieldValues); |
109 | |
} |
110 | |
|
111 | |
|
112 | |
|
113 | |
|
114 | |
|
115 | |
|
116 | |
|
117 | |
|
118 | |
public List<BusinessObject> getSearchResults(Map<String, String> fieldValues) { |
119 | 0 | return getLookupableHelperService().getSearchResults(fieldValues); |
120 | |
} |
121 | |
|
122 | |
|
123 | |
|
124 | |
|
125 | |
public HtmlData getReturnUrl(BusinessObject bo, Map fieldConversions, String lookupImpl, BusinessObjectRestrictions businessObjectRestrictions) { |
126 | 0 | return getLookupableHelperService().getReturnUrl(bo, fieldConversions, lookupImpl, getReturnKeys(), businessObjectRestrictions); |
127 | |
} |
128 | |
|
129 | |
|
130 | |
|
131 | |
|
132 | |
public String getCreateNewUrl() { |
133 | 0 | String url = ""; |
134 | |
|
135 | 0 | if (getLookupableHelperService().allowsMaintenanceNewOrCopyAction()) { |
136 | 0 | Properties parameters = new Properties(); |
137 | 0 | parameters.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.MAINTENANCE_NEW_METHOD_TO_CALL); |
138 | 0 | parameters.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, this.businessObjectClass.getName()); |
139 | |
|
140 | 0 | url = UrlFactory.parameterizeUrl(KRADConstants.MAINTENANCE_ACTION, parameters); |
141 | 0 | url = "<a title=\"Create a new record\" href=\"" + url + "\"><img src=\"images/tinybutton-createnew.gif\" alt=\"create new\" width=\"70\" height=\"15\"/></a>"; |
142 | |
} |
143 | |
|
144 | 0 | return url; |
145 | |
} |
146 | |
|
147 | |
|
148 | |
|
149 | |
|
150 | |
|
151 | |
public String getHtmlMenuBar() { |
152 | 0 | return getBusinessObjectDictionaryService().getLookupMenuBar(getBusinessObjectClass()); |
153 | |
} |
154 | |
|
155 | |
|
156 | |
|
157 | |
|
158 | |
public String getSupplementalMenuBar() { |
159 | 0 | return getLookupableHelperService().getSupplementalMenuBar(); |
160 | |
} |
161 | |
|
162 | |
|
163 | |
|
164 | |
|
165 | |
public List getRows() { |
166 | 0 | return getLookupableHelperService().getRows(); |
167 | |
} |
168 | |
|
169 | |
|
170 | |
|
171 | |
|
172 | |
public String getTitle() { |
173 | 0 | return getLookupableHelperService().getTitle(); |
174 | |
} |
175 | |
|
176 | |
|
177 | |
|
178 | |
|
179 | |
public String getReturnLocation() { |
180 | 0 | return getLookupableHelperService().getReturnLocation(); |
181 | |
} |
182 | |
|
183 | |
|
184 | |
|
185 | |
|
186 | |
public Class getBusinessObjectClass() { |
187 | 0 | return businessObjectClass; |
188 | |
} |
189 | |
|
190 | |
|
191 | |
|
192 | |
|
193 | |
public List getReturnKeys() { |
194 | 0 | return getLookupableHelperService().getReturnKeys(); |
195 | |
} |
196 | |
|
197 | |
|
198 | |
|
199 | |
|
200 | |
|
201 | |
public String getExtraButtonSource() { |
202 | 0 | return getBusinessObjectDictionaryService().getExtraButtonSource(getBusinessObjectClass()); |
203 | |
} |
204 | |
|
205 | |
|
206 | |
|
207 | |
|
208 | |
public String getExtraButtonParams() { |
209 | 0 | return getBusinessObjectDictionaryService().getExtraButtonParams(getBusinessObjectClass()); |
210 | |
} |
211 | |
|
212 | |
|
213 | |
|
214 | |
|
215 | |
public List getDefaultSortColumns() { |
216 | 0 | return getLookupableHelperService().getDefaultSortColumns(); |
217 | |
} |
218 | |
|
219 | |
|
220 | |
|
221 | |
|
222 | |
public boolean checkForAdditionalFields(Map fieldValues) { |
223 | 0 | return getLookupableHelperService().checkForAdditionalFields(fieldValues); |
224 | |
} |
225 | |
|
226 | |
|
227 | |
|
228 | |
|
229 | |
public String getBackLocation() { |
230 | 0 | return getLookupableHelperService().getBackLocation(); |
231 | |
} |
232 | |
|
233 | |
|
234 | |
|
235 | |
|
236 | |
public void setBackLocation(String backLocation) { |
237 | 0 | getLookupableHelperService().setBackLocation(backLocation); |
238 | 0 | } |
239 | |
|
240 | |
|
241 | |
|
242 | |
|
243 | |
public String getDocFormKey() { |
244 | 0 | return getLookupableHelperService().getDocFormKey(); |
245 | |
} |
246 | |
|
247 | |
|
248 | |
|
249 | |
|
250 | |
|
251 | |
public void setDocFormKey(String docFormKey) { |
252 | 0 | getLookupableHelperService().setDocFormKey(docFormKey); |
253 | 0 | } |
254 | |
|
255 | |
|
256 | |
|
257 | |
|
258 | |
protected BusinessObjectDictionaryService getBusinessObjectDictionaryService() { |
259 | 0 | return getLookupableHelperService().getBusinessObjectDictionaryService(); |
260 | |
} |
261 | |
|
262 | |
|
263 | |
|
264 | |
|
265 | |
public void setFieldConversions(Map fieldConversions) { |
266 | 0 | getLookupableHelperService().setFieldConversions(fieldConversions); |
267 | 0 | } |
268 | |
|
269 | |
|
270 | |
|
271 | |
|
272 | |
protected DataDictionaryService getDataDictionaryService() { |
273 | 0 | return getLookupableHelperService().getDataDictionaryService(); |
274 | |
} |
275 | |
|
276 | |
|
277 | |
|
278 | |
|
279 | |
|
280 | |
|
281 | |
|
282 | |
public void setReadOnlyFieldsList(List<String> readOnlyFieldsList) { |
283 | 0 | getLookupableHelperService().setReadOnlyFieldsList(readOnlyFieldsList); |
284 | 0 | } |
285 | |
|
286 | |
|
287 | |
public LookupableHelperService getLookupableHelperService() { |
288 | 0 | return lookupableHelperService; |
289 | |
} |
290 | |
|
291 | |
|
292 | |
|
293 | |
|
294 | |
|
295 | |
|
296 | |
public void setLookupableHelperService(LookupableHelperService lookupableHelperService) { |
297 | 0 | this.lookupableHelperService = lookupableHelperService; |
298 | 0 | } |
299 | |
|
300 | |
|
301 | |
|
302 | |
|
303 | |
|
304 | |
public Collection performLookup(LookupForm lookupForm, List<ResultRow> resultTable, boolean bounded) { |
305 | 0 | return getLookupableHelperService().performLookup(lookupForm, resultTable, bounded); |
306 | |
} |
307 | |
|
308 | |
|
309 | |
public boolean isSearchUsingOnlyPrimaryKeyValues() { |
310 | 0 | return getLookupableHelperService().isSearchUsingOnlyPrimaryKeyValues(); |
311 | |
} |
312 | |
|
313 | |
|
314 | |
public String getPrimaryKeyFieldLabels() { |
315 | 0 | return getLookupableHelperService().getPrimaryKeyFieldLabels(); |
316 | |
} |
317 | |
|
318 | |
|
319 | |
|
320 | |
|
321 | |
|
322 | |
|
323 | |
public void performClear(LookupForm lookupForm) { |
324 | 0 | getLookupableHelperService().performClear(lookupForm); |
325 | 0 | } |
326 | |
|
327 | |
|
328 | |
|
329 | |
|
330 | |
|
331 | |
|
332 | |
public boolean shouldDisplayHeaderNonMaintActions() { |
333 | 0 | return getLookupableHelperService().shouldDisplayHeaderNonMaintActions(); |
334 | |
} |
335 | |
|
336 | |
|
337 | |
|
338 | |
|
339 | |
|
340 | |
|
341 | |
public boolean shouldDisplayLookupCriteria() { |
342 | 0 | return getLookupableHelperService().shouldDisplayLookupCriteria(); |
343 | |
} |
344 | |
|
345 | |
protected String getCreateNewUrl(String url){ |
346 | 0 | return "<a title=\"Create a new record\" href=\"" + url + "\"><img src=\"images/tinybutton-createnew.gif\" alt=\"create new\" width=\"70\" height=\"15\"/></a>"; |
347 | |
} |
348 | |
|
349 | |
|
350 | |
|
351 | |
|
352 | |
public boolean performCustomAction(boolean ignoreErrors) { |
353 | 0 | return getLookupableHelperService().performCustomAction(ignoreErrors); |
354 | |
} |
355 | |
|
356 | |
|
357 | |
|
358 | |
|
359 | |
|
360 | |
|
361 | |
public Field getExtraField() { |
362 | 0 | return getLookupableHelperService().getExtraField(); |
363 | |
} |
364 | |
|
365 | |
|
366 | |
|
367 | |
|
368 | |
|
369 | |
|
370 | |
public void applyFieldAuthorizationsFromNestedLookups(Field field) { |
371 | 0 | getLookupableHelperService().applyFieldAuthorizationsFromNestedLookups(field); |
372 | 0 | } |
373 | |
|
374 | |
|
375 | |
|
376 | |
|
377 | |
|
378 | |
|
379 | |
|
380 | |
|
381 | |
public String getExtraOnLoad() { |
382 | 0 | return extraOnLoad; |
383 | |
} |
384 | |
|
385 | |
|
386 | |
|
387 | |
|
388 | |
public void setExtraOnLoad(String extraOnLoad) { |
389 | 0 | this.extraOnLoad = extraOnLoad; |
390 | 0 | } |
391 | |
|
392 | |
|
393 | |
|
394 | |
|
395 | |
public void applyConditionalLogicForFieldDisplay() { |
396 | 0 | getLookupableHelperService().applyConditionalLogicForFieldDisplay(); |
397 | 0 | } |
398 | |
|
399 | |
} |