1 /**
2 * Copyright 2005-2012 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.element.Link;
19 import org.kuali.rice.krad.uif.field.InputField;
20 import org.kuali.rice.krad.uif.field.LinkField;
21 import org.kuali.rice.krad.uif.service.ViewHelperService;
22 import org.kuali.rice.krad.web.form.LookupForm;
23
24 import java.util.Collection;
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 * Invoked to carry out the lookup search based on the given map of key/value search
36 * values
37 *
38 * @param form - lookup form instance containing the lookup data
39 * @param searchCriteria - map of criteria currently set
40 * @param bounded - indicates whether the results should be limited (if necessary) to the max search
41 * result limit configured
42 * @return the list of result objects, possibly bounded
43 */
44 public Collection<?> performSearch(LookupForm form, Map<String, String> searchCriteria, boolean bounded);
45
46 /**
47 * Invoked when the clear action is requested to result the search fields to
48 * their initial default values
49 *
50 * @param form - lookup form instance containing the lookup data
51 * @param searchCriteria - map of criteria currently set
52 * @return map of criteria with field values reset to defaults
53 */
54 public Map<String, String> performClear(LookupForm form, Map<String, String> searchCriteria);
55
56 /**
57 * Invoked to perform validation on the search criteria before the search is performed
58 *
59 * @param form - lookup form instance containing the lookup data
60 * @param searchCriteria - map of criteria where key is search property name and value is
61 * search value (which can include wildcards)
62 */
63 public boolean validateSearchParameters(LookupForm form, Map<String, String> searchCriteria);
64
65 /**
66 * Sets the class for the data object the lookup will be provided on
67 *
68 * @param dataObjectClass - data object class for lookup
69 */
70 public void setDataObjectClass(Class<?> dataObjectClass);
71
72 /**
73 * Returns the class for the data object the lookup is configured with
74 *
75 * @return Class<?> data object class
76 */
77 public Class<?> getDataObjectClass();
78
79 /**
80 * Invoked to build the return URL for a result row
81 *
82 * <p>
83 * Based on the line contained in the field context, the URL for returning the role is constructed and
84 * set as the href for the link field. If a return link cannot be constructed the field should be set
85 * to not render
86 * </p>
87 *
88 * @param returnLinkField - link field that will be used to render the return URL
89 * @param model - lookup form containing the data
90 */
91 public void getReturnUrlForResults(LinkField returnLinkField, Object model);
92
93 /**
94 * Invoked to build a maintenance URL for a result row
95 *
96 * <p>
97 * Based on the line contained in the field context and the given maintenance method that should be called a
98 * URL is constructed and set as the href on the link field. If a maintenance link cannot be constructed the
99 * 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 }