001: /*
002: * Copyright 2005-2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.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/ecl1.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.core.lookup;
017:
018: import java.io.Serializable;
019: import java.util.Collection;
020: import java.util.List;
021: import java.util.Map;
022:
023: import org.kuali.core.bo.BusinessObject;
024: import org.kuali.core.web.struts.form.LookupForm;
025: import org.kuali.core.web.ui.ResultRow;
026:
027: /**
028: * This class defines an interface for lookupables.
029: *
030: * They should act as facades for LookupableHelperServices and also expose bean handlers
031: * (getCreateNewUrl, getHtmlMenuBar, getTitle, getRows, getExtraButton{Source,Params}, getLookupInstructions)
032: *
033: */
034: public interface Lookupable extends Serializable {
035:
036: /**
037: * Initializes the lookup with a businss object class
038: *
039: * It is required that implementations of this method will initialize the
040: * search area used by the UI to provide the search form. In particular,
041: * it will ensure that getRows() will return valid results
042: *
043: * @param boClass
044: */
045: public void setBusinessObjectClass(Class businessObjectClass);
046:
047: /**
048: *
049: * @return Returns the businessObjectClass this lookupable is representing
050: *
051: */
052: public Class getBusinessObjectClass();
053:
054: /**
055: * @return the html to be displayed as a menu bar
056: */
057: public String getHtmlMenuBar();
058:
059: /**
060: * @return List of Row objects used to render the search area
061: */
062: public List getRows();
063:
064: /**
065: * @return String displayed as title for the lookup
066: */
067: public String getTitle();
068:
069: /**
070: * @return String url for the location to return to after the lookup
071: */
072: public String getReturnLocation();
073:
074: /**
075: * @return List of Column objects used to render the result table
076: */
077: public List getColumns();
078:
079: /**
080: * Validates the values filled in as search criteria, also checks for required field values.
081: *
082: * @param fieldValues - Map of property/value pairs
083: */
084: public void validateSearchParameters(Map fieldValues);
085:
086: /**
087: *
088: * This method performs the lookup and returns a collection of lookup items
089: * @param lookupForm
090: * @param resultTable
091: * @param bounded
092: * @return results of lookup
093: */
094: public Collection performLookup(LookupForm lookupForm,
095: List<ResultRow> resultTable, boolean bounded);
096:
097: /**
098: * Performs a search and returns result list.
099: *
100: * @param fieldValues - Map of property/value pairs
101: * @return List of business objects found by the search
102: * @throws Exception
103: */
104: public List<BusinessObject> getSearchResults(
105: Map<String, String> fieldValues);
106:
107: /**
108: * Similar to getSearchResults, but the number of returned rows is not bounded
109: *
110: * @param fieldValues
111: * @return
112: */
113: public List<BusinessObject> getSearchResultsUnbounded(
114: Map<String, String> fieldValues);
115:
116: /**
117: * @return String providing instructions for using the lookup
118: */
119: public String getLookupInstructions();
120:
121: /**
122: * @return String providing source for optional extra button
123: */
124: public String getExtraButtonSource();
125:
126: /**
127: * @return String providing return parameters for optional extra button
128: */
129: public String getExtraButtonParams();
130:
131: /**
132: * Determines if there should be more search fields rendered based on already entered search criteria.
133: *
134: * @param fieldValues - Map of property/value pairs
135: * @return boolean
136: */
137: public boolean checkForAdditionalFields(Map fieldValues);
138:
139: /**
140: * Builds the return value url.
141: *
142: * @param businessObject - Instance of a business object containing the return values
143: * @param fieldConversions - Map of conversions mapping bo names to caller field names.
144: * @param lookupImpl - Current lookup impl name
145: * @return String url called when selecting a row from the result set
146: */
147: public String getReturnUrl(BusinessObject businessObject,
148: Map fieldConversions, String lookupImpl);
149:
150: /**
151: * Builds the Url for a maintenance new document for the lookup business object class
152: * @param businessObject
153: * @return String rendered on Lookup screen for maintenance new document
154: */
155: public String getCreateNewUrl();
156:
157: /**
158: * Sets the requested fields conversions in the lookupable
159: *
160: * @param fieldConversions
161: */
162: public void setFieldConversions(Map fieldConversions);
163:
164: /**
165: * Sets the requested read only fields list in the lookupable
166: *
167: * @param readOnlyFieldsList
168: */
169: public void setReadOnlyFieldsList(List<String> readOnlyFieldsList);
170:
171: /**
172: * Sets the helper service for instance
173: * @param helper the helper service
174: */
175: public void setLookupableHelperService(
176: LookupableHelperService helper);
177:
178: /**
179: * Returns the LookupableHelperService designated to help this lookup
180: * @return
181: */
182: public LookupableHelperService getLookupableHelperService();
183:
184: /**
185: * Returns whether this search was performed using the values of the primary keys only
186: *
187: * @return
188: */
189: public boolean isSearchUsingOnlyPrimaryKeyValues();
190:
191: /**
192: * Returns a comma delimited list of primary key field labels, as defined in the DD
193: *
194: * @return
195: */
196: public String getPrimaryKeyFieldLabels();
197:
198: /**
199: * This method returns a list of the default columns used to sort the result set. For multiple value lookups,
200: * this method does not change when different columns are sorted.
201: *
202: * @return
203: */
204: public List getDefaultSortColumns();
205: }
|