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.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.service.ViewHelperService;
21
22 import java.util.Collection;
23 import java.util.Map;
24
25 /**
26 * Provides contract for implementing a lookup within the lookup framework.
27 *
28 * @author Kuali Rice Team (rice.collab@kuali.org)
29 */
30 public interface Lookupable extends ViewHelperService, java.io.Serializable {
31
32 /**
33 * Invoked to carry out the lookup search based on the given map of key/value search values.
34 *
35 * @param form lookup form instance containing the lookup data
36 * @param searchCriteria map of criteria currently set
37 * @param bounded indicates whether the results should be limited (if necessary) to the max search
38 * result limit configured
39 * @return the list of result objects, possibly bounded with {@link CollectionIncomplete}
40 */
41 Collection<?> performSearch(LookupForm form, Map<String, String> searchCriteria, boolean bounded);
42
43 /**
44 * Invoked when the clear action is requested to reset the search fields to their initial default values.
45 *
46 * @param form lookup form instance containing the lookup data
47 * @param searchCriteria map of criteria currently set
48 * @return map of criteria with field values reset to defaults
49 */
50 Map<String, String> performClear(LookupForm form, Map<String, String> searchCriteria);
51
52 /**
53 * Returns the class for the data object the lookup is configured with.
54 *
55 * @return Class<?> data object class
56 */
57 Class<?> getDataObjectClass();
58
59 /**
60 * Sets the class for the data object the lookup will be provided on.
61 *
62 * @param dataObjectClass - data object class for lookup
63 */
64 void setDataObjectClass(Class<?> dataObjectClass);
65
66 /**
67 * Invoked to build the return URL for a result row.
68 *
69 * <p>Based on the line contained in the field context, the URL for returning the role is constructed and
70 * set as the href for the link. If a return link cannot be constructed the link should be set
71 * to not render</p>
72 *
73 * @param returnLink link that will be used to render the return URL
74 * @param model lookup form containing the data
75 */
76 void buildReturnUrlForResult(Link returnLink, Object model);
77
78 /**
79 * Invoked to build a maintenance URL for a result row.
80 *
81 * <p>Based on the line contained in the field context and the given maintenance method that should be called a
82 * URL is constructed and set as the action on the action link. If a maintenance link cannot be constructed the
83 * action link should be set to not render</p>
84 *
85 * @param actionLink link that will be used to return the maintenance URL
86 * @param model lookup form containing the data
87 * @param maintenanceMethodToCall name of the method that should be invoked in the maintenance controller
88 */
89 void buildMaintenanceActionLink(Link actionLink, Object model, String maintenanceMethodToCall);
90
91 /**
92 * Set the value for the input field control to contain the field conversion values for the line.
93 *
94 * <p>Creates and populate the value of the input field control. This value is built according to
95 * {@link LookupForm#getFieldConversions} and allows for client side population of the returned fields without
96 * having to do an additional server call.</p>
97 *
98 * @param selectField the InputField used to mark the lookup row as selected
99 * @param model lookup form containing the model data
100 */
101 void buildMultiValueSelectField(InputField selectField, Object model);
102
103 /**
104 * Determines if given data object has associated maintenance document that allows new or copy maintenance actions.
105 *
106 * @return boolean true if the maintenance new or copy action is allowed for the data object instance, false
107 * otherwise
108 */
109 boolean allowsMaintenanceNewOrCopyAction();
110
111 /**
112 * Determines if given data object has associated maintenance document that allows edit maintenance actions.
113 *
114 * @param dataObject data object
115 * @return boolean true if the maintenance edit action is allowed for the data object instance, false otherwise
116 */
117 boolean allowsMaintenanceEditAction(Object dataObject);
118
119 /**
120 * Determines if given data object has associated maintenance document that allows delete maintenance actions.
121 *
122 * @param dataObject data object
123 * @return boolean true if the maintenance delete action is allowed for the data object instance, false otherwise
124 */
125 boolean allowsMaintenanceDeleteAction(Object dataObject);
126
127 }