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.Map;
020    
021    import org.kuali.kfs.gl.businessobject.Encumbrance;
022    import org.kuali.kfs.gl.businessobject.Transaction;
023    
024    /**
025     * A DAO interface that declares methods needed for Encumbrances to interact with the database
026     */
027    public interface EncumbranceDao {
028        /**
029         * Returns an encumbrance that would be affected by the given transaction
030         * 
031         * @param t the transaction to find the affected encumbrance for
032         * @return an Encumbrance that would be affected by the posting of the transaction, or null
033         */
034        public Encumbrance getEncumbranceByTransaction(Transaction t);
035    
036        /**
037         * Returns an Iterator of all encumbrances that need to be closed for the fiscal year
038         * 
039         * @param fiscalYear a fiscal year to find encumbrances for
040         * @return an Iterator of encumbrances to close
041         */
042        public Iterator getEncumbrancesToClose(Integer fiscalYear);
043    
044        /**
045         * Purges the database of all those encumbrances with the given chart and year 
046         * 
047         * @param chartOfAccountsCode the chart of accounts code purged encumbrances will have
048         * @param year the university fiscal year purged encumbrances will have
049         */
050        public void purgeYearByChart(String chartOfAccountsCode, int year);
051    
052        /**
053         * Saves an encumbrance to the database
054         * 
055         * @param e an encumbrance to save
056         */
057        public void save(Encumbrance e);
058    
059        /**
060         * fetch all encumbrance records from GL open encumbrance table
061         * 
062         * @return an Iterator with all encumbrances currently in the database
063         */
064        public Iterator getAllEncumbrances();
065    
066        /**
067         * group all encumbrances with/without the given document type code by fiscal year, chart, account, sub-account, object code,
068         * sub object code, and balance type code, and summarize the encumbrance amount and the encumbrance close amount.
069         * 
070         * @param documentTypeCode the given document type code
071         * @param included indicate if all encumbrances with the given document type are included in the results or not
072         * @return an Iterator of arrays of java.lang.Objects holding summarization data about qualifying encumbrances 
073         */
074        public Iterator getSummarizedEncumbrances(String documentTypeCode, boolean included);
075    
076        /**
077         * This method finds the open encumbrances according to input fields and values
078         * 
079         * @param fieldValues the input fields and values
080         * @return a collection of open encumbrances
081         */
082        public Iterator findOpenEncumbrance(Map fieldValues);
083    
084        /**
085         * Counts the number of the open encumbrances according to input fields and values
086         * 
087         * @param fieldValues the input fields and values
088         * @return the number of the open encumbrances
089         */
090        public Integer getOpenEncumbranceRecordCount(Map fieldValues);
091        
092        /**
093         * @param year the given university fiscal year
094         * @return count of rows for the given fiscal year
095         */
096        public Integer findCountGreaterOrEqualThan(Integer year);
097    }