1 /*
2 * The Kuali Financial System, a comprehensive financial management system for higher education.
3 *
4 * Copyright 2005-2014 The Kuali Foundation
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
15 *
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 package org.kuali.kfs.coa.service;
20
21 import java.sql.Date;
22 import java.util.Collection;
23
24 import org.kuali.kfs.coa.businessobject.AccountingPeriod;
25
26 /**
27 * This service interface defines methods necessary for retrieving fully populated AccountingPeriod business objects from the
28 * database that are necessary for transaction processing in the application.
29 */
30 public interface AccountingPeriodService {
31 /**
32 * This method retrieves all valid accounting periods in the system.
33 *
34 * @return A list of accounting periods in Kuali.
35 */
36 public Collection<AccountingPeriod> getAllAccountingPeriods();
37
38 /**
39 * This method retrieves a list of all open accounting periods in the system.
40 *
41 * @return
42 */
43 public Collection<AccountingPeriod> getOpenAccountingPeriods();
44
45 /**
46 * This method retrieves an individual AccountingPeriod based on the period and fiscal year
47 *
48 * @param periodCode
49 * @param fiscalYear
50 * @return an accounting period
51 */
52 public AccountingPeriod getByPeriod(String periodCode, Integer fiscalYear);
53
54
55 /**
56 * This method allows for AccountingPeriod retrieval via String date.
57 *
58 * @param String
59 */
60 public AccountingPeriod getByStringDate(String dateString);
61
62 /**
63 * This method takes a date and returns the corresponding period
64 *
65 * @param date
66 * @return period that matches the date
67 */
68 public AccountingPeriod getByDate(Date date);
69
70 /**
71 * This method compares two accounting periods, hopefully by comparing their closing dates. If a is earlier than b, it should
72 * return a negative number; if a is later, it should return a positive number; and if the closing dates are equal, it should
73 * return a 0.
74 *
75 * @param a the first accounting period to compare
76 * @param b the second accounting period to compare
77 * @return an integer representing which is earlier or later, or if they occur simultaneously
78 */
79 public int compareAccountingPeriodsByDate(AccountingPeriod a, AccountingPeriod b);
80
81 public void clearCache();
82 }