Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
LookupableHelperService |
|
| 1.0;1 |
1 | /** | |
2 | * Copyright 2005-2011 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.opensource.org/licenses/ecl2.php | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
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.Row; | |
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 | ||
26 | import java.io.Serializable; | |
27 | import java.util.Collection; | |
28 | import java.util.List; | |
29 | import java.util.Map; | |
30 | ||
31 | public interface LookupableHelperService extends Serializable{ | |
32 | ||
33 | /** | |
34 | * Initializes the lookup with a businss object class | |
35 | * | |
36 | * @param businessObjectClass | |
37 | */ | |
38 | public void setBusinessObjectClass(Class businessObjectClass); | |
39 | ||
40 | /** | |
41 | * | |
42 | * @return Returns the dataObjectClass this lookupable is representing | |
43 | * | |
44 | */ | |
45 | public Class getBusinessObjectClass(); | |
46 | ||
47 | /** | |
48 | * Initializes the lookup with the given Map of parameters. | |
49 | * | |
50 | * @param parameters | |
51 | */ | |
52 | public void setParameters(Map<String, String[]> parameters); | |
53 | ||
54 | /** | |
55 | * @return Returns the parameters passed to this lookup | |
56 | */ | |
57 | public Map<String, String[]> getParameters(); | |
58 | ||
59 | /** | |
60 | * @return String url for the location to return to after the lookup | |
61 | */ | |
62 | public String getReturnLocation(); | |
63 | ||
64 | /** | |
65 | * @return List of Column objects used to render the result table | |
66 | */ | |
67 | public List getColumns(); | |
68 | ||
69 | /** | |
70 | * Validates the values filled in as search criteria, also checks for required field values. | |
71 | * | |
72 | * @param fieldValues - Map of property/value pairs | |
73 | */ | |
74 | public void validateSearchParameters(Map fieldValues); | |
75 | ||
76 | /** | |
77 | * Performs a search and returns result list. | |
78 | * | |
79 | * @param fieldValues - Map of property/value pairs | |
80 | * @return List of business objects found by the search | |
81 | * @throws Exception | |
82 | */ | |
83 | public List getSearchResults(Map<String, String> fieldValues); | |
84 | ||
85 | /** | |
86 | * Similar to getSearchResults, but the number of returned rows is not bounded | |
87 | * | |
88 | * @param fieldValues | |
89 | * @return | |
90 | */ | |
91 | public List getSearchResultsUnbounded(Map<String, String> fieldValues); | |
92 | ||
93 | /** | |
94 | * Determines if there should be more search fields rendered based on already entered search criteria. | |
95 | * | |
96 | * @param fieldValues - Map of property/value pairs | |
97 | * @return boolean | |
98 | */ | |
99 | public boolean checkForAdditionalFields(Map fieldValues); | |
100 | ||
101 | /** | |
102 | * Builds the return value url. | |
103 | * | |
104 | * @param businessObject - Instance of a business object containing the return values | |
105 | * @param fieldConversions - Map of conversions mapping bo names to caller field names. | |
106 | * @param lookupImpl - Current lookup impl name | |
107 | * @param returnKeys - Keys to return | |
108 | * @return String url called when selecting a row from the result set | |
109 | */ | |
110 | public HtmlData getReturnUrl(BusinessObject businessObject, Map fieldConversions, String lookupImpl, List returnKeys, BusinessObjectRestrictions businessObjectRestrictions); | |
111 | ||
112 | /** | |
113 | * This method builds the return url | |
114 | * | |
115 | * @param businessObject | |
116 | * @param lookupForm | |
117 | * @param returnKeys | |
118 | * @return | |
119 | */ | |
120 | public HtmlData getReturnUrl(BusinessObject businessObject, LookupForm lookupForm, List returnKeys, BusinessObjectRestrictions businessObjectRestrictions); | |
121 | ||
122 | /** | |
123 | * Builds string of action urls that can take place for a result row | |
124 | * | |
125 | * @param businessObject - Instance of a business object containing the return values | |
126 | * @param pkNames - List of primary key names | |
127 | * @return String rendered in actions column of result set | |
128 | */ | |
129 | public String getActionUrls(BusinessObject businessObject, List pkNames, BusinessObjectRestrictions businessObjectRestrictions); | |
130 | ||
131 | /** | |
132 | * | |
133 | * This method is a template method that allows child classes to return their own custom action html data. | |
134 | * | |
135 | * @param businessObject | |
136 | * @param pkNames | |
137 | * @return | |
138 | */ | |
139 | public List<HtmlData> getCustomActionUrls(BusinessObject businessObject, List pkNames); | |
140 | ||
141 | /** | |
142 | * Builds string an inquiry url for drill down on a result field | |
143 | * | |
144 | * @param businessObject - Instance of a business object containing the return values | |
145 | * @param propertyName - Name of the property in the business object | |
146 | * @return String url called on selection of the result field | |
147 | */ | |
148 | public HtmlData getInquiryUrl(BusinessObject businessObject, String propertyName); | |
149 | ||
150 | /** | |
151 | * Sets the requested fields conversions in the lookupable | |
152 | * | |
153 | * @param fieldConversions | |
154 | */ | |
155 | public void setFieldConversions(Map fieldConversions); | |
156 | ||
157 | /** | |
158 | * Gets the readOnlyFieldsList attribute. | |
159 | * @return Returns the readOnlyFieldsList. | |
160 | */ | |
161 | public List<String> getReadOnlyFieldsList(); | |
162 | ||
163 | /** | |
164 | * Sets the requested read only fields list in the lookupable | |
165 | * | |
166 | * @param readOnlyFieldsList | |
167 | */ | |
168 | public void setReadOnlyFieldsList(List<String> readOnlyFieldsList); | |
169 | ||
170 | /** | |
171 | * This method is public because some unit tests depend on it. | |
172 | * | |
173 | * @return a List of the names of fields which are marked in data dictionary as return fields. | |
174 | */ | |
175 | public List getReturnKeys(); | |
176 | ||
177 | public String getDocFormKey(); | |
178 | ||
179 | public void setDocFormKey(String docFormKey); | |
180 | ||
181 | public String getDocNum(); | |
182 | ||
183 | public void setDocNum(String docNum); | |
184 | ||
185 | /** | |
186 | * | |
187 | * This method builds a maintenance url. | |
188 | * | |
189 | * @param businessObject | |
190 | * @param htmlData | |
191 | * @param pkNames | |
192 | * @return | |
193 | */ | |
194 | public String getMaintenanceUrl(BusinessObject businessObject, HtmlData htmlData, List pkNames, BusinessObjectRestrictions businessObjectRestrictions); | |
195 | ||
196 | /** | |
197 | * Determines if underlying lookup bo has associated maintenance document that allows new or copy maintenance actions. | |
198 | * | |
199 | * @return true if bo has maint doc that allows new or copy actions | |
200 | */ | |
201 | public boolean allowsMaintenanceNewOrCopyAction(); | |
202 | ||
203 | /** | |
204 | * Determines if underlying lookup bo has associated document that allows new or copy maintenance actions. | |
205 | * | |
206 | * @return true if bo has doc that allows new or copy actions | |
207 | */ | |
208 | public boolean allowsNewOrCopyAction(String documentTypeName); | |
209 | ||
210 | /** | |
211 | * Returns a list of Row objects to be used to generate the search query screen | |
212 | * | |
213 | * Generally, setDataObjectClass needs to be called with a non-null value for proper operation | |
214 | * @return | |
215 | */ | |
216 | public List<Row> getRows(); | |
217 | ||
218 | /** | |
219 | * This method returns the DataDictionaryService used to initialize this helper service and is used by Lookupable implementations to | |
220 | * retrieve the proper service. | |
221 | * | |
222 | * @return | |
223 | */ | |
224 | public DataDictionaryService getDataDictionaryService(); | |
225 | ||
226 | /** | |
227 | * This method returns the BusinessObjectDictionaryService used to initialize this helper service and is used by Lookupable implementations to | |
228 | * retrieve the proper service. | |
229 | * | |
230 | * @return | |
231 | */ | |
232 | public BusinessObjectDictionaryService getBusinessObjectDictionaryService(); | |
233 | ||
234 | public void setBackLocation(String backLocation); | |
235 | ||
236 | public String getBackLocation(); | |
237 | ||
238 | /** | |
239 | * | |
240 | * This method performs the lookup and returns a collection of BO items | |
241 | * @param lookupForm | |
242 | * @param resultTable | |
243 | * @param bounded | |
244 | * @return the list of result BOs, possibly bounded | |
245 | */ | |
246 | public Collection performLookup(LookupForm lookupForm, Collection resultTable, boolean bounded); | |
247 | ||
248 | /** | |
249 | * This method returns a list of the default columns used to sort the result set. For multiple value lookups, | |
250 | * this method does not change when different columns are sorted. | |
251 | * | |
252 | * @return | |
253 | */ | |
254 | public List getDefaultSortColumns(); | |
255 | ||
256 | /** | |
257 | * This method returns whether the previously executed getSearchResults used the primary key values to search, ignoring all non key values | |
258 | * | |
259 | * @return | |
260 | * @see LookupableHelperService#getPrimaryKeyFieldLabels() | |
261 | */ | |
262 | public boolean isSearchUsingOnlyPrimaryKeyValues(); | |
263 | ||
264 | /** | |
265 | * Returns a comma delimited list of primary key field labels, to be used on the UI to tell the user which fields were used to search | |
266 | * | |
267 | * @return | |
268 | * @see LookupableHelperService#isSearchUsingOnlyPrimaryKeyValues() | |
269 | */ | |
270 | public String getPrimaryKeyFieldLabels(); | |
271 | ||
272 | /** | |
273 | * Determines whether a given BusinessObject that's returned as one of the lookup's results is considered returnable, which means that for | |
274 | * single-value lookups, a "return value" link may be rendered, and for multiple value lookups, a checkbox is rendered. | |
275 | * | |
276 | * Note that this can be part of an authorization mechanism, but not the complete authorization mechanism. The component that invoked the lookup/ | |
277 | * lookup caller (e.g. document, nesting lookup, etc.) needs to check that the object that was passed to it was returnable as well because there | |
278 | * are ways around this method (e.g. crafting a custom return URL). | |
279 | * | |
280 | * @param object an object from the search result set | |
281 | * @return | |
282 | */ | |
283 | public boolean isResultReturnable(BusinessObject object); | |
284 | ||
285 | /** | |
286 | * | |
287 | * This method allows for overriding the clear behavior | |
288 | * | |
289 | */ | |
290 | public void performClear(LookupForm lookupForm); | |
291 | ||
292 | public boolean shouldDisplayHeaderNonMaintActions(); | |
293 | ||
294 | public boolean shouldDisplayLookupCriteria(); | |
295 | ||
296 | /** | |
297 | * This method gets the supplemental lookup menu if any | |
298 | * | |
299 | * @return supplemental menu bar | |
300 | */ | |
301 | public String getSupplementalMenuBar(); | |
302 | ||
303 | /** | |
304 | * @return String displayed as title for the lookup | |
305 | */ | |
306 | public String getTitle(); | |
307 | ||
308 | /** | |
309 | * | |
310 | * performs custom actions. return true to reperform search | |
311 | * | |
312 | * @param ignoreErrors | |
313 | * @return boolean to reperform search | |
314 | */ | |
315 | public boolean performCustomAction(boolean ignoreErrors); | |
316 | ||
317 | /** | |
318 | * get an extra field | |
319 | * @return | |
320 | */ | |
321 | public Field getExtraField(); | |
322 | ||
323 | public void applyFieldAuthorizationsFromNestedLookups(Field field); | |
324 | ||
325 | /** | |
326 | * Performs conditional logic (based on current search values or other parameters) to | |
327 | * override field hidden, read-only, and required attributes previously set. | |
328 | */ | |
329 | public void applyConditionalLogicForFieldDisplay(); | |
330 | } |