001    /**
002     * Copyright 2005-2014 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.rice.kns.lookup;
017    
018    import org.kuali.rice.kns.document.authorization.BusinessObjectRestrictions;
019    import org.kuali.rice.kns.web.struts.form.LookupForm;
020    import org.kuali.rice.kns.web.ui.Column;
021    import org.kuali.rice.kns.web.ui.Field;
022    import org.kuali.rice.kns.web.ui.ResultRow;
023    import org.kuali.rice.kns.web.ui.Row;
024    import org.kuali.rice.krad.bo.BusinessObject;
025    
026    import java.io.Serializable;
027    import java.util.Collection;
028    import java.util.List;
029    import java.util.Map;
030    
031    /**
032     * This class defines an interface for lookupables.
033     *
034     * They should act as facades for LookupableHelperServices and also expose bean handlers
035     * (getCreateNewUrl, getHtmlMenuBar, getTitle, getRows, getExtraButton{Source,Params})
036     *
037     */
038    @Deprecated
039    public interface Lookupable extends Serializable {
040    
041        /**
042         * Initializes the lookup with a businss object class.  This value originates
043         * from the UI via LookupForm population.
044         *
045         * It is required that implementations of this method will initialize the
046         * search area used by the UI to provide the search form.  In particular,
047         * it will ensure that getRows() will return valid results
048         *
049         * @param boClass
050         */
051        public void setBusinessObjectClass(Class<? extends BusinessObject> businessObjectClass);
052    
053        /**
054         *
055         * @return Returns the dataObjectClass this lookupable is representing
056         *
057         */
058        public Class<? extends BusinessObject> getBusinessObjectClass();
059    
060        /**
061         * Initializes the lookup with the given Map of parameters.
062         *
063         * @param parameters
064         */
065        public void setParameters(Map<String, String[]> parameters);
066    
067        /**
068         * @return Returns the parameters passed to this lookup
069         */
070        public Map<String, String[]> getParameters();
071    
072        /**
073         * @return the html to be displayed as a menu bar
074         */
075        public String getHtmlMenuBar();
076    
077        /**
078         * @return the html to be displayed as a supplemental menu bar
079         */
080        public String getSupplementalMenuBar();
081    
082        /**
083         * @return List of Row objects used to render the search area
084         */
085        public List<Row> getRows();
086    
087        /**
088         * @return String displayed as title for the lookup
089         */
090        public String getTitle();
091    
092        /**
093         * @return String url for the location to return to after the lookup
094         */
095        public String getReturnLocation();
096    
097        /**
098         * @return List of Column objects used to render the result table
099         */
100        public List<Column> getColumns();
101    
102        /**
103         * Validates the values filled in as search criteria, also checks for required field values.
104         *
105         * @param fieldValues - Map of property/value pairs
106         */
107        public void validateSearchParameters(Map<String, String> fieldValues);
108    
109        /**
110         *
111         * This method performs the lookup and returns a collection of lookup items
112         * @param lookupForm
113         * @param resultTable
114         * @param bounded
115         * @return results of lookup
116         */
117        public Collection<? extends BusinessObject> performLookup(LookupForm lookupForm, List<ResultRow> resultTable, boolean bounded);
118    
119        /**
120         * Performs a search and returns result list.
121         *
122         * @param fieldValues - Map of property/value pairs
123         * @return List of business objects found by the search
124         * @throws Exception
125         */
126        public List<? extends BusinessObject> getSearchResults(Map<String, String> fieldValues);
127    
128        /**
129         * Similar to getSearchResults, but the number of returned rows is not bounded
130         *
131         * @param fieldValues
132         * @return
133         */
134        public List<? extends BusinessObject> getSearchResultsUnbounded(Map<String, String> fieldValues);
135    
136        /**
137         * @return String providing source for optional extra button
138         */
139        public String getExtraButtonSource();
140    
141        /**
142         * @return String providing return parameters for optional extra button
143         */
144        public String getExtraButtonParams();
145    
146        /**
147         * Determines if there should be more search fields rendered based on already entered search criteria.
148         *
149         * @param fieldValues - Map of property/value pairs
150         * @return boolean
151         */
152        public boolean checkForAdditionalFields(Map<String, String> fieldValues);
153    
154        /**
155         * Builds the return value url.
156         *
157         * @param businessObject - Instance of a business object containing the return values
158         * @param fieldConversions - Map of conversions mapping bo names to caller field names.
159         * @param lookupImpl - Current lookup impl name
160         * @return String url called when selecting a row from the result set
161         */
162        public HtmlData getReturnUrl(BusinessObject businessObject, Map<String, String> fieldConversions, String lookupImpl, BusinessObjectRestrictions businessObjectRestrictions);
163    
164        /**
165         * Builds the Url for a maintenance new document for the lookup business object class
166         * @param businessObject
167         * @return String rendered on Lookup screen for maintenance new document
168         */
169        public String getCreateNewUrl();
170    
171        /**
172         * Sets the requested fields conversions in the lookupable
173         *
174         * @param fieldConversions
175         */
176        public void setFieldConversions(Map<String, String> fieldConversions);
177    
178        /**
179         * Sets the requested read only fields list in the lookupable
180         *
181         * @param readOnlyFieldsList
182         */
183        public void setReadOnlyFieldsList(List<String> readOnlyFieldsList);
184    
185        /**
186         * Sets the helper service for instance
187         * @param helper the helper service
188         */
189        public void setLookupableHelperService(LookupableHelperService helper);
190    
191        /**
192         * Returns the LookupableHelperService designated to help this lookup
193         * @return
194         */
195        public LookupableHelperService getLookupableHelperService();
196    
197        /**
198         * Returns whether this search was performed using the values of the primary keys only
199         *
200         * @return
201         */
202        public boolean isSearchUsingOnlyPrimaryKeyValues();
203    
204        /**
205         * Returns a comma delimited list of primary key field labels, as defined in the DD
206         *
207         * @return
208         */
209        public String getPrimaryKeyFieldLabels();
210    
211        /**
212         * This method returns a list of the default columns used to sort the result set.  For multiple value lookups,
213         * this method does not change when different columns are sorted.
214         *
215         * @return
216         */
217        public List<String> getDefaultSortColumns();
218    
219        /**
220         *
221         * This method allows for customization of the lookup clear
222         *
223         */
224        public void performClear(LookupForm lookupForm);
225    
226        /**
227         *
228         * This method checks whether the header non maint actions should be shown
229         *
230         */
231        public boolean shouldDisplayHeaderNonMaintActions();
232    
233        /**
234         *
235         * This method checks whether the criteria should be shown
236         *
237         */
238        public boolean shouldDisplayLookupCriteria();
239    
240        /**
241         *
242         * This method is called from a custom action button or script
243         *
244         */
245        public boolean performCustomAction(boolean ignoreErrors);
246    
247        /**
248         *
249         * get extra field
250         *
251         * @return
252         */
253        public Field getExtraField();
254    
255        /**
256         * method returns the extraOnLoad variable. The 
257             * varible is currently accessed in page.tag and is called in the onLoad.
258             * it allows us to inject javascript onload.
259             */
260        public String getExtraOnLoad();
261        
262        public void setExtraOnLoad(String extraOnLoad);
263        public void applyFieldAuthorizationsFromNestedLookups(Field field);
264        
265        /**
266         * Performs conditional logic (based on current search values or other parameters) to
267         * override field hidden, read-only, and required attributes previously set.
268         */
269        public void applyConditionalLogicForFieldDisplay();
270    }