View Javadoc

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