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.ArrayList;
19: import java.util.Collection;
20: import java.util.List;
21: import java.util.Map;
22:
23: import org.kuali.core.bo.BusinessObject;
24: import org.kuali.kfs.KFSConstants;
25: import org.kuali.kfs.KFSPropertyConstants;
26: import org.kuali.module.labor.bo.LedgerEntry;
27: import org.springframework.transaction.annotation.Transactional;
28:
29: /**
30: * The class is the front-end for the balance inquiry of Ledger entry For Expense Transfer processing.
31: */
32: @Transactional
33: public class LedgerEntryForExpenseTransferLookupableHelperServiceImpl
34: extends LedgerEntryLookupableHelperServiceImpl {
35: private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger
36: .getLogger(LedgerEntryForExpenseTransferLookupableHelperServiceImpl.class);
37:
38: /**
39: * @see org.kuali.core.lookup.AbstractLookupableHelperServiceImpl#getSearchResults(java.util.Map)
40: */
41: @Override
42: public List<? extends BusinessObject> getSearchResults(
43: Map<String, String> fieldValues) {
44: setBackLocation((String) fieldValues
45: .get(KFSConstants.BACK_LOCATION));
46: setDocFormKey((String) fieldValues
47: .get(KFSConstants.DOC_FORM_KEY));
48:
49: // get the ledger balances with actual balance type code
50: fieldValues.put(
51: KFSPropertyConstants.FINANCIAL_BALANCE_TYPE_CODE,
52: KFSConstants.BALANCE_TYPE_ACTUAL);
53: Collection actualEntries = getLookupService()
54: .findCollectionBySearch(LedgerEntry.class, fieldValues);
55:
56: // get the ledger balances with effort balance type code
57: fieldValues.put(
58: KFSPropertyConstants.FINANCIAL_BALANCE_TYPE_CODE,
59: KFSConstants.BALANCE_TYPE_A21);
60: Collection effortEntries = getLookupService()
61: .findCollectionBySearch(LedgerEntry.class, fieldValues);
62:
63: // get the search result collection
64: Collection consolidatedEntries = new ArrayList();
65: consolidatedEntries.addAll(actualEntries);
66: consolidatedEntries.addAll(effortEntries);
67:
68: // get the actual size of all qualified search results
69: Long actualSize = new Long(consolidatedEntries.size());
70:
71: return this.buildSearchResultList(consolidatedEntries,
72: actualSize);
73: }
74: }
|