01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.module.vendor.lookup;
17:
18: import java.util.Collections;
19: import java.util.List;
20: import java.util.Map;
21:
22: import org.kuali.core.bo.PersistableBusinessObject;
23: import org.kuali.core.lookup.AbstractLookupableHelperServiceImpl;
24: import org.kuali.core.util.BeanPropertyComparator;
25: import org.kuali.kfs.KFSConstants;
26:
27: public class VendorPhoneLookupableHelperServiceImpl extends
28: AbstractLookupableHelperServiceImpl {
29: /**
30: * Overrides the getSearchResults in the super class so that we can do some customization in our vendor phone number lookup.
31: *
32: * @see org.kuali.core.lookup.Lookupable#getSearchResults(java.util.Map)
33: */
34: @Override
35: public List<PersistableBusinessObject> getSearchResults(
36: Map<String, String> fieldValues) {
37: boolean unbounded = false;
38: super .setBackLocation((String) fieldValues
39: .get(KFSConstants.BACK_LOCATION));
40: super .setDocFormKey((String) fieldValues
41: .get(KFSConstants.DOC_FORM_KEY));
42:
43: List<PersistableBusinessObject> searchResults = (List) getLookupService()
44: .findCollectionBySearchHelper(getBusinessObjectClass(),
45: fieldValues, unbounded);
46:
47: // loop through results
48: // sort list if default sort column given
49: List<String> defaultSortColumns = getDefaultSortColumns();
50: if (defaultSortColumns.size() > 0) {
51: Collections.sort(searchResults, new BeanPropertyComparator(
52: getDefaultSortColumns(), true));
53: }
54:
55: return searchResults;
56: }
57:
58: }
|