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.module.ld.businessobject.lookup; 017 018 import java.util.ArrayList; 019 import java.util.Collection; 020 import java.util.List; 021 import java.util.Map; 022 023 import org.kuali.kfs.module.ld.businessobject.LedgerEntry; 024 import org.kuali.kfs.sys.KFSConstants; 025 import org.kuali.kfs.sys.KFSPropertyConstants; 026 import org.kuali.rice.kns.bo.BusinessObject; 027 028 /** 029 * The class is the front-end for the balance inquiry of Ledger entry For Expense Transfer processing. 030 */ 031 public class LedgerEntryForExpenseTransferLookupableHelperServiceImpl extends LedgerEntryLookupableHelperServiceImpl { 032 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(LedgerEntryForExpenseTransferLookupableHelperServiceImpl.class); 033 034 /** 035 * @see org.kuali.rice.kns.lookup.AbstractLookupableHelperServiceImpl#getSearchResults(java.util.Map) 036 */ 037 @Override 038 public List<? extends BusinessObject> getSearchResults(Map<String, String> fieldValues) { 039 setBackLocation((String) fieldValues.get(KFSConstants.BACK_LOCATION)); 040 setDocFormKey((String) fieldValues.get(KFSConstants.DOC_FORM_KEY)); 041 042 // get the ledger balances with actual balance type code 043 fieldValues.put(KFSPropertyConstants.FINANCIAL_BALANCE_TYPE_CODE, KFSConstants.BALANCE_TYPE_ACTUAL); 044 Collection actualEntries = getLookupService().findCollectionBySearch(LedgerEntry.class, fieldValues); 045 046 // get the ledger balances with effort balance type code 047 fieldValues.put(KFSPropertyConstants.FINANCIAL_BALANCE_TYPE_CODE, KFSConstants.BALANCE_TYPE_A21); 048 Collection effortEntries = getLookupService().findCollectionBySearch(LedgerEntry.class, fieldValues); 049 050 // get the search result collection 051 Collection consolidatedEntries = new ArrayList(); 052 consolidatedEntries.addAll(actualEntries); 053 consolidatedEntries.addAll(effortEntries); 054 055 // get the actual size of all qualified search results 056 Long actualSize = new Long(consolidatedEntries.size()); 057 058 return this.buildSearchResultList(consolidatedEntries, actualSize); 059 } 060 }