001 /* 002 * Copyright 2011 The Kuali Foundation. 003 * 004 * Licensed under the Educational Community License, Version 2.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/ecl2.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.kfs.vnd.businessobject.lookup; 017 018 import java.util.Collections; 019 import java.util.List; 020 import java.util.Map; 021 022 import org.kuali.kfs.sys.KFSConstants; 023 import org.kuali.rice.kns.bo.PersistableBusinessObject; 024 import org.kuali.rice.kns.lookup.AbstractLookupableHelperServiceImpl; 025 import org.kuali.rice.kns.util.BeanPropertyComparator; 026 027 028 public class VendorPhoneLookupableHelperServiceImpl extends AbstractLookupableHelperServiceImpl { 029 /** 030 * Overrides the getSearchResults in the super class so that we can do some customization in our vendor phone number lookup. 031 * 032 * @see org.kuali.rice.kns.lookup.Lookupable#getSearchResults(java.util.Map) 033 */ 034 @Override 035 public List<PersistableBusinessObject> getSearchResults(Map<String, String> fieldValues) { 036 boolean unbounded = false; 037 super.setBackLocation((String) fieldValues.get(KFSConstants.BACK_LOCATION)); 038 super.setDocFormKey((String) fieldValues.get(KFSConstants.DOC_FORM_KEY)); 039 040 List<PersistableBusinessObject> searchResults = (List) getLookupService().findCollectionBySearchHelper(getBusinessObjectClass(), fieldValues, unbounded); 041 042 // loop through results 043 // sort list if default sort column given 044 List<String> defaultSortColumns = getDefaultSortColumns(); 045 if (defaultSortColumns.size() > 0) { 046 Collections.sort(searchResults, new BeanPropertyComparator(getDefaultSortColumns(), true)); 047 } 048 049 return searchResults; 050 } 051 052 }