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