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.ResultRow;
22 import org.kuali.rice.kns.web.ui.Row;
23 import org.kuali.rice.krad.bo.BusinessObject;
24
25 import java.io.Serializable;
26 import java.util.Collection;
27 import java.util.List;
28 import java.util.Map;
29
30 /**
31 * This class defines an interface for lookupables.
32 *
33 * They should act as facades for LookupableHelperServices and also expose bean handlers
34 * (getCreateNewUrl, getHtmlMenuBar, getTitle, getRows, getExtraButton{Source,Params})
35 *
36 */
37 @Deprecated
38 public interface Lookupable extends Serializable {
39
40 /**
41 * Initializes the lookup with a businss object class
42 *
43 * It is required that implementations of this method will initialize the
44 * search area used by the UI to provide the search form. In particular,
45 * it will ensure that getRows() will return valid results
46 *
47 * @param boClass
48 */
49 public void setBusinessObjectClass(Class businessObjectClass);
50
51 /**
52 *
53 * @return Returns the dataObjectClass this lookupable is representing
54 *
55 */
56 public Class getBusinessObjectClass();
57
58 /**
59 * Initializes the lookup with the given Map of parameters.
60 *
61 * @param parameters
62 */
63 public void setParameters(Map<String, String[]> parameters);
64
65 /**
66 * @return Returns the parameters passed to this lookup
67 */
68 public Map<String, String[]> getParameters();
69
70 /**
71 * @return the html to be displayed as a menu bar
72 */
73 public String getHtmlMenuBar();
74
75 /**
76 * @return the html to be displayed as a supplemental menu bar
77 */
78 public String getSupplementalMenuBar();
79
80 /**
81 * @return List of Row objects used to render the search area
82 */
83 public List<? extends Row> getRows();
84
85 /**
86 * @return String displayed as title for the lookup
87 */
88 public String getTitle();
89
90 /**
91 * @return String url for the location to return to after the lookup
92 */
93 public String getReturnLocation();
94
95 /**
96 * @return List of Column objects used to render the result table
97 */
98 public List getColumns();
99
100 /**
101 * Validates the values filled in as search criteria, also checks for required field values.
102 *
103 * @param fieldValues - Map of property/value pairs
104 */
105 public void validateSearchParameters(Map fieldValues);
106
107 /**
108 *
109 * This method performs the lookup and returns a collection of lookup items
110 * @param lookupForm
111 * @param resultTable
112 * @param bounded
113 * @return results of lookup
114 */
115 public Collection performLookup(LookupForm lookupForm, List<ResultRow> resultTable, boolean bounded);
116
117 /**
118 * Performs a search and returns result list.
119 *
120 * @param fieldValues - Map of property/value pairs
121 * @return List of business objects found by the search
122 * @throws Exception
123 */
124 public List<BusinessObject> getSearchResults(Map<String, String> fieldValues);
125
126 /**
127 * Similar to getSearchResults, but the number of returned rows is not bounded
128 *
129 * @param fieldValues
130 * @return
131 */
132 public List<BusinessObject> getSearchResultsUnbounded(Map<String, String> fieldValues);
133
134 /**
135 * @return String providing source for optional extra button
136 */
137 public String getExtraButtonSource();
138
139 /**
140 * @return String providing return parameters for optional extra button
141 */
142 public String getExtraButtonParams();
143
144 /**
145 * Determines if there should be more search fields rendered based on already entered search criteria.
146 *
147 * @param fieldValues - Map of property/value pairs
148 * @return boolean
149 */
150 public boolean checkForAdditionalFields(Map fieldValues);
151
152 /**
153 * Builds the return value url.
154 *
155 * @param businessObject - Instance of a business object containing the return values
156 * @param fieldConversions - Map of conversions mapping bo names to caller field names.
157 * @param lookupImpl - Current lookup impl name
158 * @return String url called when selecting a row from the result set
159 */
160 public HtmlData getReturnUrl(BusinessObject businessObject, Map fieldConversions, String lookupImpl, BusinessObjectRestrictions businessObjectRestrictions);
161
162 /**
163 * Builds the Url for a maintenance new document for the lookup business object class
164 * @param businessObject
165 * @return String rendered on Lookup screen for maintenance new document
166 */
167 public String getCreateNewUrl();
168
169 /**
170 * Sets the requested fields conversions in the lookupable
171 *
172 * @param fieldConversions
173 */
174 public void setFieldConversions(Map fieldConversions);
175
176 /**
177 * Sets the requested read only fields list in the lookupable
178 *
179 * @param readOnlyFieldsList
180 */
181 public void setReadOnlyFieldsList(List<String> readOnlyFieldsList);
182
183 /**
184 * Sets the helper service for instance
185 * @param helper the helper service
186 */
187 public void setLookupableHelperService(LookupableHelperService helper);
188
189 /**
190 * Returns the LookupableHelperService designated to help this lookup
191 * @return
192 */
193 public LookupableHelperService getLookupableHelperService();
194
195 /**
196 * Returns whether this search was performed using the values of the primary keys only
197 *
198 * @return
199 */
200 public boolean isSearchUsingOnlyPrimaryKeyValues();
201
202 /**
203 * Returns a comma delimited list of primary key field labels, as defined in the DD
204 *
205 * @return
206 */
207 public String getPrimaryKeyFieldLabels();
208
209 /**
210 * This method returns a list of the default columns used to sort the result set. For multiple value lookups,
211 * this method does not change when different columns are sorted.
212 *
213 * @return
214 */
215 public List getDefaultSortColumns();
216
217 /**
218 *
219 * This method allows for customization of the lookup clear
220 *
221 */
222 public void performClear(LookupForm lookupForm);
223
224 /**
225 *
226 * This method checks whether the header non maint actions should be shown
227 *
228 */
229 public boolean shouldDisplayHeaderNonMaintActions();
230
231 /**
232 *
233 * This method checks whether the criteria should be shown
234 *
235 */
236 public boolean shouldDisplayLookupCriteria();
237
238 /**
239 *
240 * This method is called from a custom action button or script
241 *
242 */
243 public boolean performCustomAction(boolean ignoreErrors);
244
245 /**
246 *
247 * get extra field
248 *
249 * @return
250 */
251 public Field getExtraField();
252
253 /**
254 * method returns the extraOnLoad variable. The
255 * varible is currently accessed in page.tag and is called in the onLoad.
256 * it allows us to inject javascript onload.
257 */
258 public String getExtraOnLoad();
259
260 public void setExtraOnLoad(String extraOnLoad);
261 public void applyFieldAuthorizationsFromNestedLookups(Field field);
262
263 /**
264 * Performs conditional logic (based on current search values or other parameters) to
265 * override field hidden, read-only, and required attributes previously set.
266 */
267 public void applyConditionalLogicForFieldDisplay();
268 }