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.gl.dataaccess;
017
018 import java.util.Iterator;
019 import java.util.List;
020 import java.util.Map;
021
022 import org.kuali.kfs.gl.businessobject.AccountBalance;
023 import org.kuali.kfs.gl.businessobject.Transaction;
024
025 /**
026 * An interface that declares methods needed for AccountBalances to interact with the database
027 */
028 public interface AccountBalanceDao {
029 /**
030 * Given a transaction, finds a matching account balance in the database
031 *
032 * @param t a transaction to find an appropriate related account balance for
033 * @return an appropriate account balance
034 */
035 public AccountBalance getByTransaction(Transaction t);
036
037 /**
038 * Saves an account balance to the database
039 *
040 * @param ab an account balance to save
041 */
042 public void save(AccountBalance ab);
043
044 /**
045 * This method finds the available account balances according to input fields and values
046 *
047 * @param fieldValues the input fields and values
048 * @return the summary records of account balance entries
049 */
050 public Iterator findConsolidatedAvailableAccountBalance(Map fieldValues);
051
052 /**
053 * This method finds the available account balances according to input fields and values
054 *
055 * @param fieldValues the input fields and values
056 * @return account balance entries
057 */
058 public Iterator findAvailableAccountBalance(Map fieldValues);
059
060 /**
061 * Get available balances by consolidation for specific object types
062 *
063 * @param objectTypes the object types that reported account balances must have
064 * @param universityFiscalYear the university fiscal year of account balances to find
065 * @param chartOfAccountsCode the chart of accounts of account balances to find
066 * @param accountNumber the account number of account balances to find
067 * @param isExcludeCostShare whether cost share entries should be excluded from this inquiry
068 * @param isConsolidated whether the results of this should be consolidated or not
069 * @param pendingEntriesCode whether to include no pending entries, approved pending entries, or all pending entries
070 * @return a List of Maps with the appropriate query results
071 */
072 public List findAccountBalanceByConsolidationByObjectTypes(String[] objectTypes, Integer universityFiscalYear, String chartOfAccountsCode, String accountNumber, boolean isExcludeCostShare, boolean isConsolidated, int pendingEntriesCode);
073
074 /**
075 * Get available balances by level
076 *
077 * @param universityFiscalYear the university fiscal year of account balances to find
078 * @param chartOfAccountsCode the chart of accounts of account balances to find
079 * @param accountNumber the account number of account balances to find
080 * @param financialConsolidationObjectCode the consolidation code of account balances to find
081 * @param isCostShareExcluded whether cost share entries should be excluded from this inquiry
082 * @param isConsolidated whether the results of this should be consolidated or not
083 * @return a List of Mapswith the appropriate query results
084 */
085 public List findAccountBalanceByLevel(Integer universityFiscalYear, String chartOfAccountsCode, String accountNumber, String financialConsolidationObjectCode, boolean isCostShareExcluded, boolean isConsolidated, int pendingEntryCode);
086
087 /**
088 * Get available balances by object
089 *
090 * @param universityFiscalYear the university fiscal year of account balances to find
091 * @param chartOfAccountsCode the chart of accounts of account balances to find
092 * @param accountNumber the account number of account balances to find
093 * @param financialObjectLevelCode the object level code of account balances to find
094 * @param financialReportingSortCode
095 * @param isCostShareExcluded whether cost share entries should be excluded from this inquiry
096 * @param isConsolidated whether the results of this should be consolidated or not
097 * @return a List of Maps with the appropriate query results
098 */
099 public List findAccountBalanceByObject(Integer universityFiscalYear, String chartOfAccountsCode, String accountNumber, String financialObjectLevelCode, String financialReportingSortCode, boolean isCostShareExcluded, boolean isConsolidated, int pendingEntryCode);
100
101 /**
102 * Purge an entire fiscal year for a single chart.
103 *
104 * @param chartOfAccountsCode the chart of accounts code of account balances to purge
105 * @param year the fiscal year of account balances to purge
106 */
107 public void purgeYearByChart(String chartOfAccountscode, int year);
108
109 /**
110 * @param year the given university fiscal year
111 * @return count of rows for the given fiscal year
112 */
113 public Integer findCountGreaterOrEqualThan(Integer year);
114 }