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