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 */ 38 @Deprecated 39 public interface Lookupable extends Serializable { 40 41 /** 42 * Initializes the lookup with a businss object class. This value originates 43 * from the UI via LookupForm population. 44 * 45 * It is required that implementations of this method will initialize the 46 * search area used by the UI to provide the search form. In particular, 47 * it will ensure that getRows() will return valid results 48 * 49 * @param boClass 50 */ 51 public void setBusinessObjectClass(Class<? extends BusinessObject> businessObjectClass); 52 53 /** 54 * 55 * @return Returns the dataObjectClass this lookupable is representing 56 * 57 */ 58 public Class<? extends BusinessObject> getBusinessObjectClass(); 59 60 /** 61 * Initializes the lookup with the given Map of parameters. 62 * 63 * @param parameters 64 */ 65 public void setParameters(Map<String, String[]> parameters); 66 67 /** 68 * @return Returns the parameters passed to this lookup 69 */ 70 public Map<String, String[]> getParameters(); 71 72 /** 73 * @return the html to be displayed as a menu bar 74 */ 75 public String getHtmlMenuBar(); 76 77 /** 78 * @return the html to be displayed as a supplemental menu bar 79 */ 80 public String getSupplementalMenuBar(); 81 82 /** 83 * @return List of Row objects used to render the search area 84 */ 85 public List<Row> getRows(); 86 87 /** 88 * @return String displayed as title for the lookup 89 */ 90 public String getTitle(); 91 92 /** 93 * @return String url for the location to return to after the lookup 94 */ 95 public String getReturnLocation(); 96 97 /** 98 * @return List of Column objects used to render the result table 99 */ 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 }