001: /*
002: * Copyright 2006-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.service.BusinessObjectDictionaryService;
025: import org.kuali.core.service.DataDictionaryService;
026: import org.kuali.core.web.struts.form.LookupForm;
027: import org.kuali.core.web.ui.Row;
028:
029: public interface LookupableHelperService extends Serializable {
030: /**
031: * Initializes the lookup with a businss object class
032: *
033: * @param businessObjectClass
034: */
035: public void setBusinessObjectClass(Class businessObjectClass);
036:
037: /**
038: *
039: * @return Returns the businessObjectClass this lookupable is representing
040: *
041: */
042: public Class getBusinessObjectClass();
043:
044: /**
045: * @return String url for the location to return to after the lookup
046: */
047: public String getReturnLocation();
048:
049: /**
050: * @return List of Column objects used to render the result table
051: */
052: public List getColumns();
053:
054: /**
055: * Validates the values filled in as search criteria, also checks for required field values.
056: *
057: * @param fieldValues - Map of property/value pairs
058: */
059: public void validateSearchParameters(Map fieldValues);
060:
061: /**
062: * Performs a search and returns result list.
063: *
064: * @param fieldValues - Map of property/value pairs
065: * @return List of business objects found by the search
066: * @throws Exception
067: */
068: public List getSearchResults(Map<String, String> fieldValues);
069:
070: /**
071: * Similar to getSearchResults, but the number of returned rows is not bounded
072: *
073: * @param fieldValues
074: * @return
075: */
076: public List getSearchResultsUnbounded(
077: Map<String, String> fieldValues);
078:
079: /**
080: * Determines if there should be more search fields rendered based on already entered search criteria.
081: *
082: * @param fieldValues - Map of property/value pairs
083: * @return boolean
084: */
085: public boolean checkForAdditionalFields(Map fieldValues);
086:
087: /**
088: * Builds the return value url.
089: *
090: * @param businessObject - Instance of a business object containing the return values
091: * @param fieldConversions - Map of conversions mapping bo names to caller field names.
092: * @param lookupImpl - Current lookup impl name
093: * @return String url called when selecting a row from the result set
094: */
095: public String getReturnUrl(BusinessObject businessObject,
096: Map fieldConversions, String lookupImpl);
097:
098: /**
099: * Builds string of action urls that can take place for a result row
100: *
101: * @param businessObject - Instance of a business object containing the return values
102: * @return String rendered in actions column of result set
103: */
104: public String getActionUrls(BusinessObject businessObject);
105:
106: /**
107: * Builds string an inquiry url for drill down on a result field
108: *
109: * @param businessObject - Instance of a business object containing the return values
110: * @param propertyName - Name of the property in the business object
111: * @return String url called on selection of the result field
112: */
113: public String getInquiryUrl(BusinessObject businessObject,
114: String propertyName);
115:
116: /**
117: * Sets the requested fields conversions in the lookupable
118: *
119: * @param fieldConversions
120: */
121: public void setFieldConversions(Map fieldConversions);
122:
123: /**
124: * Gets the readOnlyFieldsList attribute.
125: * @return Returns the readOnlyFieldsList.
126: */
127: public List<String> getReadOnlyFieldsList();
128:
129: /**
130: * Sets the requested read only fields list in the lookupable
131: *
132: * @param readOnlyFieldsList
133: */
134: public void setReadOnlyFieldsList(List<String> readOnlyFieldsList);
135:
136: /**
137: * This method is public because some unit tests depend on it.
138: *
139: * @return a List of the names of fields which are marked in data dictionary as return fields.
140: */
141: public List getReturnKeys();
142:
143: public String getDocFormKey();
144:
145: public void setDocFormKey(String docFormKey);
146:
147: public String getMaintenanceUrl(BusinessObject businessObject,
148: String methodToCall);
149:
150: /**
151: * Determines if underlying lookup bo has associated maintenance document that allows new or copy maintenance actions.
152: *
153: * @return true if bo has maint doc that allows new or copy actions
154: */
155: public boolean allowsMaintenanceNewOrCopyAction();
156:
157: /**
158: * Returns a list of Row objects to be used to generate the search query screen
159: *
160: * Generally, setBusinessObjectClass needs to be called with a non-null value for proper operation
161: * @return
162: */
163: public List<Row> getRows();
164:
165: /**
166: * This method returns the DataDictionaryService used to initialize this helper service and is used by Lookupable implementations to
167: * retrieve the proper service.
168: *
169: * @return
170: */
171: public DataDictionaryService getDataDictionaryService();
172:
173: /**
174: * This method returns the BusinessObjectDictionaryService used to initialize this helper service and is used by Lookupable implementations to
175: * retrieve the proper service.
176: *
177: * @return
178: */
179: public BusinessObjectDictionaryService getBusinessObjectDictionaryService();
180:
181: public void setBackLocation(String backLocation);
182:
183: public String getBackLocation();
184:
185: /**
186: *
187: * This method performs the lookup and returns a collection of BO items
188: * @param lookupForm
189: * @param resultTable
190: * @param bounded
191: * @return the list of result BOs, possibly bounded
192: */
193: public Collection performLookup(LookupForm lookupForm,
194: Collection resultTable, boolean bounded);
195:
196: /**
197: * This method returns a list of the default columns used to sort the result set. For multiple value lookups,
198: * this method does not change when different columns are sorted.
199: *
200: * @return
201: */
202: public List getDefaultSortColumns();
203:
204: /**
205: * This method returns whether the previously executed getSearchResults used the primary key values to search, ignoring all non key values
206: *
207: * @return
208: * @see LookupableHelperService#getPrimaryKeyFieldLabels()
209: */
210: public boolean isSearchUsingOnlyPrimaryKeyValues();
211:
212: /**
213: * Returns a comma delimited list of primary key field labels, to be used on the UI to tell the user which fields were used to search
214: *
215: * @return
216: * @see LookupableHelperService#isSearchUsingOnlyPrimaryKeyValues()
217: */
218: public String getPrimaryKeyFieldLabels();
219: }
|