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