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.coa.service;
017    
018    import java.sql.Date;
019    import java.util.Collection;
020    
021    import org.kuali.kfs.coa.businessobject.AccountingPeriod;
022    
023    /**
024     * This service interface defines methods necessary for retrieving fully populated AccountingPeriod business objects from the
025     * database that are necessary for transaction processing in the application.
026     */
027    public interface AccountingPeriodService {
028        /**
029         * This method retrieves all valid accounting periods in the system.
030         * 
031         * @return A list of accounting periods in Kuali.
032         */
033        public Collection getAllAccountingPeriods();
034    
035        /**
036         * This method retrieves a list of all open accounting periods in the system.
037         * 
038         * @return
039         */
040        public Collection getOpenAccountingPeriods();
041    
042        /**
043         * This method retrieves an individual AccountingPeriod based on the period and fiscal year
044         * 
045         * @param periodCode
046         * @param fiscalYear
047         * @return an accounting period
048         */
049        public AccountingPeriod getByPeriod(String periodCode, Integer fiscalYear);
050    
051        
052        /**
053         * This method allows for AccountingPeriod retrieval via String date.
054         * 
055         * @param String
056         */
057        public AccountingPeriod getByStringDate(String dateString);
058        
059        /**
060         * This method takes a date and returns the corresponding period
061         * 
062         * @param date
063         * @return period that matches the date
064         */
065        public AccountingPeriod getByDate(Date date);
066    
067        /**
068         * This method compares two accounting periods, hopefully by comparing their closing dates. If a is earlier than b, it should
069         * return a negative number; if a is later, it should return a positive number; and if the closing dates are equal, it should
070         * return a 0.
071         * 
072         * @param a the first accounting period to compare
073         * @param b the second accounting period to compare
074         * @return an integer representing which is earlier or later, or if they occur simultaneously
075         */
076        public int compareAccountingPeriodsByDate(AccountingPeriod a, AccountingPeriod b);
077    }