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.labor.web.lookupable;
17:
18: import java.util.Collections;
19: import java.util.List;
20: import java.util.Map;
21:
22: import org.kuali.core.bo.BusinessObject;
23: import org.kuali.core.lookup.AbstractLookupableHelperServiceImpl;
24: import org.kuali.core.lookup.LookupUtils;
25: import org.kuali.core.util.BeanPropertyComparator;
26: import org.kuali.kfs.KFSConstants;
27: import org.kuali.module.labor.web.inquirable.PositionFundingInquirableImpl;
28:
29: public class PositionFundingLookupableHelperServiceImpl extends
30: AbstractLookupableHelperServiceImpl {
31: /**
32: * @see org.kuali.core.lookup.Lookupable#getInquiryUrl(org.kuali.core.bo.BusinessObject, java.lang.String)
33: */
34: @Override
35: public String getInquiryUrl(BusinessObject businessObject,
36: String propertyName) {
37: return (new PositionFundingInquirableImpl()).getInquiryUrl(
38: businessObject, propertyName);
39: }
40:
41: /**
42: * @see org.kuali.core.lookup.AbstractLookupableHelperServiceImpl#getSearchResults(java.util.Map)
43: */
44: @Override
45: public List<? extends BusinessObject> getSearchResults(
46: Map<String, String> fieldValues) {
47: // remove hidden fields
48: LookupUtils.removeHiddenCriteriaFields(
49: getBusinessObjectClass(), fieldValues);
50:
51: setBackLocation(fieldValues.get(KFSConstants.BACK_LOCATION));
52: setDocFormKey(fieldValues.get(KFSConstants.DOC_FORM_KEY));
53: setReferencesToRefresh(fieldValues
54: .get(KFSConstants.REFERENCES_TO_REFRESH));
55:
56: List searchResults = (List) getLookupService()
57: .findCollectionBySearchHelper(getBusinessObjectClass(),
58: fieldValues, false);
59: // sort list if default sort column given
60: List defaultSortColumns = getDefaultSortColumns();
61: if (defaultSortColumns.size() > 0) {
62: Collections.sort(searchResults, new BeanPropertyComparator(
63: getDefaultSortColumns(), true));
64: }
65: return searchResults;
66: }
67: }
|