001 /**
002 * Copyright 2005-2012 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.krad.lookup;
017
018 import org.kuali.rice.krad.uif.element.Link;
019 import org.kuali.rice.krad.uif.field.InputField;
020 import org.kuali.rice.krad.uif.field.LinkField;
021 import org.kuali.rice.krad.uif.service.ViewHelperService;
022 import org.kuali.rice.krad.web.form.LookupForm;
023
024 import java.util.Collection;
025 import java.util.Map;
026
027 /**
028 * Provides contract for implementing a lookup within the lookup framework
029 *
030 * @author Kuali Rice Team (rice.collab@kuali.org)
031 */
032 public interface Lookupable extends ViewHelperService, java.io.Serializable {
033
034 /**
035 * Invoked to carry out the lookup search based on the given map of key/value search
036 * values
037 *
038 * @param form - lookup form instance containing the lookup data
039 * @param searchCriteria - map of criteria currently set
040 * @param bounded - indicates whether the results should be limited (if necessary) to the max search
041 * result limit configured
042 * @return the list of result objects, possibly bounded
043 */
044 public Collection<?> performSearch(LookupForm form, Map<String, String> searchCriteria, boolean bounded);
045
046 /**
047 * Invoked when the clear action is requested to result the search fields to
048 * their initial default values
049 *
050 * @param form - lookup form instance containing the lookup data
051 * @param searchCriteria - map of criteria currently set
052 * @return map of criteria with field values reset to defaults
053 */
054 public Map<String, String> performClear(LookupForm form, Map<String, String> searchCriteria);
055
056 /**
057 * Invoked to perform validation on the search criteria before the search is performed
058 *
059 * @param form - lookup form instance containing the lookup data
060 * @param searchCriteria - map of criteria where key is search property name and value is
061 * search value (which can include wildcards)
062 */
063 public boolean validateSearchParameters(LookupForm form, Map<String, String> searchCriteria);
064
065 /**
066 * Sets the class for the data object the lookup will be provided on
067 *
068 * @param dataObjectClass - data object class for lookup
069 */
070 public void setDataObjectClass(Class<?> dataObjectClass);
071
072 /**
073 * Returns the class for the data object the lookup is configured with
074 *
075 * @return Class<?> data object class
076 */
077 public Class<?> getDataObjectClass();
078
079 /**
080 * Invoked to build the return URL for a result row
081 *
082 * <p>
083 * Based on the line contained in the field context, the URL for returning the role is constructed and
084 * set as the href for the link field. If a return link cannot be constructed the field should be set
085 * to not render
086 * </p>
087 *
088 * @param returnLinkField - link field that will be used to render the return URL
089 * @param model - lookup form containing the data
090 */
091 public void getReturnUrlForResults(LinkField returnLinkField, Object model);
092
093 /**
094 * Invoked to build a maintenance URL for a result row
095 *
096 * <p>
097 * Based on the line contained in the field context and the given maintenance method that should be called a
098 * URL is constructed and set as the href on the link field. If a maintenance link cannot be constructed the
099 * field should be set to not render
100 * </p>
101 *
102 * @param actionLink - link that will be used to return the maintenance URL
103 * @param model - lookup form containing the data
104 * @param maintenanceMethodToCall - name of the method that should be invoked in the maintenance controller
105 */
106 public void getMaintenanceActionLink(Link actionLink, Object model, String maintenanceMethodToCall);
107
108 /**
109 * Set the value for the input field control to contain the field conversion values for the line
110 *
111 * <p>
112 * Creates and populate the value of the input field control. This value is build according to
113 * {@link LookupForm#getFieldConversions} and allows for client side population of the returned fields without
114 * having to do an additional server call.
115 * </p>
116 *
117 * @param selectField - the InputField used to mark the lookup row as selected
118 * @param model - lookup form containing the data
119 */
120 public void setMultiValueLookupSelect(InputField selectField, Object model);
121 }