com.sage.accpac.sm
Class FiscalCalendar

java.lang.Object
  extended by com.sage.accpac.sm.FiscalCalendar

@ThreadSafe
public final class FiscalCalendar
extends java.lang.Object

The FiscalCalendar class provides methods to access the fiscal calendar set up in the company. The results returned reflect the state of the fiscal calendar at the time that the calls are made; it is possible for the same call to return different answers at different times.

An instance of this class cannot be created directly by applications. It should be obtained from the Program's Program.getFiscalCalendar() method.

The class provides inner classes to give access to the information:

Thread safety
Thread-safe but mutable

Nested Class Summary
static class FiscalCalendar.DateRange
          A date range, as returned by getPeriodDates and other functions
 class FiscalCalendar.FiscalPeriod
          The fiscal period returned by getPeriod
 class FiscalCalendar.FiscalYear
          The properties of a fiscal year, as returned by getYear and other methods
 
Method Summary
 FiscalCalendar.FiscalYear getFirstYear()
          returns the first fiscal year in the calendar.
 FiscalCalendar.FiscalYear getLastYear()
          returns the last fiscal year in the calendar.
 FiscalCalendar.FiscalPeriod getPeriod(java.util.Date date)
          Locates the fiscal year and period a given date falls on.
 FiscalCalendar.DateRange getPeriodDates(int year, int period)
          Retrieves the start and end dates of a given fiscal year and period.
 int getQuarter(int year, int period)
          retrieves the quarter a given fiscal period belongs to.
 FiscalCalendar.DateRange getQuarterDates(int year, int quarter)
          Retrieves the start and end dates of a given fiscal year and quarter.
 FiscalCalendar.FiscalYear getYear(int year)
          Looks up a fiscal year in the calendar and retrieves its details.
 FiscalCalendar.DateRange getYearDates(int year)
          Retrieves the start and end dates of a given fiscal year.
 java.util.List<java.lang.Integer> getYears()
          Return a list of the years that are in the Fiscal Calendar, as integers.
 boolean isPeriodOpen(int year, int period)
          Gets whether a fiscal period is open or not
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFirstYear

public FiscalCalendar.FiscalYear getFirstYear()
returns the first fiscal year in the calendar.

Returns:
a FiscalYear instance for the first year of the program's fiscal calendar, or null if there is none.
See Also:
getLastYear(), #getYear(String), getYears()

getLastYear

public FiscalCalendar.FiscalYear getLastYear()
returns the last fiscal year in the calendar.

Returns:
a FiscalYear instance for the last year of the program's fiscal calendar, or null if there is none.
See Also:
getFirstYear(), #getYear(String), getYears()

getPeriod

public FiscalCalendar.FiscalPeriod getPeriod(java.util.Date date)
Locates the fiscal year and period a given date falls on.

Parameters:
date - Date
Returns:
A FiscalPeriod object corresponding to the date given, or null if the date does not appear in the fiscal calendar.

getPeriodDates

public FiscalCalendar.DateRange getPeriodDates(int year,
                                               int period)
Retrieves the start and end dates of a given fiscal year and period.

Parameters:
year - Fiscal year.
period - Fiscal period within the fiscal year.
Returns:
null if the fiscal period is not in the calendar and the DateRange if it is

getQuarter

public int getQuarter(int year,
                      int period)
retrieves the quarter a given fiscal period belongs to.

Parameters:
year - Fiscal year
period - Fiscal period within the year
Returns:
The quarter that the period is in
Throws:
java.lang.IllegalArgumentException - If the fiscal period is not in the fiscal calendar

getQuarterDates

public FiscalCalendar.DateRange getQuarterDates(int year,
                                                int quarter)
Retrieves the start and end dates of a given fiscal year and quarter.

Parameters:
year - Fiscal year.
quarter - Quarter within the fiscal year.
Returns:
A DateRange for the quarter, or null if the quarter is not in the fiscal calendar

getYear

public FiscalCalendar.FiscalYear getYear(int year)
Looks up a fiscal year in the calendar and retrieves its details.

Parameters:
year - The fiscal year to locate in the fiscal calendar.
Returns:
a FiscalYear record for the specified year of the program's fiscal calendar, or null if it is not found in the calendar.

getYearDates

public FiscalCalendar.DateRange getYearDates(int year)
Retrieves the start and end dates of a given fiscal year.

Parameters:
year - Fiscal year.
Returns:
A DateRange for the year, or null if the year is not in the fiscal calendar

getYears

public java.util.List<java.lang.Integer> getYears()
Return a list of the years that are in the Fiscal Calendar, as integers.
To use the result, for example, for (Integer i: c.getYears()) System.out.println("Year " + i);


isPeriodOpen

public boolean isPeriodOpen(int year,
                            int period)
Gets whether a fiscal period is open or not

Parameters:
year - Fiscal year.
period - Fiscal period within the fiscal year.
Returns:
true if the period is open, false otherwise
Throws:
IllgalArgumentException - if the fiscal period is not in the fiscal calendar


Copyright © 2010 Sage Software, Inc. All rights reserved.