1 /** 2 * Copyright 2005-2013 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.krad.lookup; 17 18 import org.kuali.rice.krad.uif.field.InputField; 19 import org.kuali.rice.krad.uif.field.LinkField; 20 import org.kuali.rice.krad.uif.service.ViewHelperService; 21 import org.kuali.rice.krad.web.form.LookupForm; 22 23 import java.util.Collection; 24 import java.util.List; 25 import java.util.Map; 26 27 /** 28 * Provides contract for implementing a lookup within the lookup framework 29 * 30 * @author Kuali Rice Team (rice.collab@kuali.org) 31 */ 32 public interface Lookupable extends ViewHelperService, java.io.Serializable { 33 34 /** 35 * Initialize the suppressAction indicator on the LookupForm. 36 * 37 * <p> 38 * The suppress action is set to true if the user is not authorized to initiate these documents. The indicator 39 * is then used to hide irrelevant actions such as creating a new document or editing existing ones. 40 * </p> 41 * 42 * @param lookupForm on which to initialize the suppressAction indicator 43 */ 44 public void initSuppressAction(LookupForm lookupForm); 45 46 /** 47 * Invoked to carry out the lookup search based on the given map of key/value search 48 * values 49 * 50 * @param form - lookup form instance containing the lookup data 51 * @param searchCriteria - map of criteria currently set 52 * @param bounded - indicates whether the results should be limited (if necessary) to the max search 53 * result limit configured 54 * @return the list of result objects, possibly bounded 55 */ 56 public Collection<?> performSearch(LookupForm form, Map<String, String> searchCriteria, boolean bounded); 57 58 /** 59 * Invoked when the clear action is requested to result the search fields to 60 * their initial default values 61 * 62 * @param form - lookup form instance containing the lookup data 63 * @param searchCriteria - map of criteria currently set 64 * @return map of criteria with field values reset to defaults 65 */ 66 public Map<String, String> performClear(LookupForm form, Map<String, String> searchCriteria); 67 68 /** 69 * Invoked to perform validation on the search criteria before the search is performed 70 * 71 * @param form - lookup form instance containing the lookup data 72 * @param searchCriteria - map of criteria where key is search property name and value is 73 * search value (which can include wildcards) 74 * @return boolean true if validation was successful, false if there were errors and the search 75 * should not be performed 76 */ 77 public boolean validateSearchParameters(LookupForm form, Map<String, String> searchCriteria); 78 79 /** 80 * Sets the class for the data object the lookup will be provided on 81 * 82 * @param dataObjectClass - data object class for lookup 83 */ 84 public void setDataObjectClass(Class<?> dataObjectClass); 85 86 /** 87 * Returns the class for the data object the lookup is configured with 88 * 89 * @return Class<?> data object class 90 */ 91 public Class<?> getDataObjectClass(); 92 93 /** 94 * Sets the field conversion map on the lookupable 95 * 96 * <p> 97 * The field conversions map specifies the mappings for return fields. When the 98 * user selects a row to return, for each configured field conversion the corresponding value 99 * from the result row will be sent back as the value for the field on the calling field. 100 * </p> 101 * 102 * @param fieldConversions - map of field conversions where key is name of the property on result 103 * data object to get value for, and map value is the name of the field to send the value back as (name 104 * of the field on the calling view) 105 */ 106 public void setFieldConversions(Map<String, String> fieldConversions); 107 108 /** 109 * Sets List of fields on the lookupable that should be made read only in the search 110 * criteria group 111 * 112 * @param readOnlyFieldsList - list of read only fields 113 */ 114 public void setReadOnlyFieldsList(List<String> readOnlyFieldsList); 115 116 /** 117 * Invoked to build the return URL for a result row 118 * 119 * <p> 120 * Based on the line contained in the field context, the URL for returning the role is constructed and 121 * set as the href for the link field. If a return link cannot be constructed the field should be set 122 * to not render 123 * </p> 124 * 125 * @param returnLinkField - link field that will be used to render the return URL 126 * @param model - lookup form containing the data 127 */ 128 public void getReturnUrlForResults(LinkField returnLinkField, Object model); 129 130 /** 131 * Invoked to build a maintenance URL for a result row 132 * 133 * <p> 134 * Based on the line contained in the field context and the given maintenance method that should be called a 135 * URL is constructed and set as the href on the link field. If a maintenance link cannot be constructed the 136 * field should be set to not render 137 * </p> 138 * 139 * @param actionLinkField - link field that will be used to return the maintenance URL 140 * @param model - lookup form containing the data 141 * @param maintenanceMethodToCall - name of the method that should be invoked in the maintenance controller 142 */ 143 public void getMaintenanceActionLink(LinkField actionLinkField, Object model, String maintenanceMethodToCall); 144 145 public void setMultiValueLookupSelect(InputField selectField, Object model); 146 }