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