org.kuali.kfs.gl.service.impl
Class BalanceServiceImpl

java.lang.Object
  extended by org.kuali.kfs.gl.service.impl.BalanceServiceImpl
All Implemented Interfaces:
BalanceService

@Transactional
public class BalanceServiceImpl
extends Object
implements BalanceService

This class is the OJB implementation of the Balance Service


Field Summary
protected  BalanceDao balanceDao
           
protected  OptionsService optionsService
           
 
Constructor Summary
BalanceServiceImpl()
           
 
Method Summary
 boolean beginningBalanceLoaded(Account account)
          Returns whether or not the beginning budget is loaded for the given account.
 int countBalancesForFiscalYear(Integer year)
          Uses the DAO to count the number of balances associated with the given fiscal year
protected  org.kuali.rice.kns.util.KualiDecimal expenseBalances(Account account)
          Sums all the balances associated with a given account that would be considered "expense" balances
 Iterator findBalance(Map fieldValues, boolean isConsolidated)
          This method gets the size of balance entries according to input fields and values
 Iterator<Balance> findBalancesForFiscalYear(Integer fiscalYear)
          Defers to the DAO to find all balances in the fiscal year.
 Iterator findCashBalance(Map fieldValues, boolean isConsolidated)
          This method finds the summary records of balance entries according to input fields an values, using the DAO
 Iterator<Balance> findCumulativeBalancesToForwardForFiscalYear(Integer year)
          Returns all the balances to be forwarded for the "cumulative" rule
 Iterator<Balance> findGeneralBalancesToForwardForFiscalYear(Integer year)
          Returns all the balances specifically to be processed by the balance forwards job for the "general" rule
 Iterator<Balance> findNominalActivityBalancesForFiscalYear(Integer year)
          This method returns all of the balances specifically for the nominal activity closing job
 Iterator<Balance> findOrganizationReversionBalancesForFiscalYear(Integer year, boolean endOfYear)
          Returns all of the balances to be forwarded for the organization reversion process
 boolean fundBalanceWillNetToZero(Account account)
          Checks to see if the total income balances for the given account equal the total expense balances for the given account
protected  String[] getActualBalanceCodes()
          Use the options table to get a list of all the balance type codes associated with actual balances
protected  String[] getAssetLiabilityFundBalanceBalanceTypeCodes()
          Uses the options table to find all the balance type codes associated with asset/liability
 Integer getBalanceRecordCount(Map fieldValues, boolean isConsolidated)
          This method finds the summary records of balance entries according to input fields and values
 Integer getCashBalanceRecordCount(Map fieldValues, boolean isConsolidated)
          This method gets the size of cash balance entries according to input fields and values
protected  String[] getEncumbranceBaseBudgetBalanceTypeCodes()
          Uses the options table to create a list of all the balance type codes associated with encumbrances
protected  String[] getExpenseObjectTypeCodes()
          Uses the options table to find all the balance type codes associated with expenses
 List<GlSummary> getGlSummary(int universityFiscalYear, List<String> balanceTypeCodes)
          Get the GL Balance summary for the GL Summary report
protected  String[] getIncomeObjectTypeCodes()
          Uses the options table to find all the balance type codes associated with income
 boolean hasAssetLiabilityFundBalanceBalances(Account account)
          Checks the given account to see if there are any non zero asset fund liability fund balances for them
 boolean hasAssetLiabilityOrFundBalance(Account account)
          Determines if the account has asset/liability balances associated with it that will have a net impact
 boolean hasEncumbrancesOrBaseBudgets(Account account)
          Finds all of the encumbrance balances for the given account, and figures out if those encumbrances will have a net impact on the budget
protected  org.kuali.rice.kns.util.KualiDecimal incomeBalances(Account account)
          Returns the sum of balances considered as income for the given account
protected  void loadConstantsFromOptions()
          Private method to load the values from the system options service and store them locally for later use.
 void purgeYearByChart(String chart, int year)
          Purge the balance table by year/chart
 void save(Balance b)
          Saves the balance in a no-nonsense, straight away, three piece suit sort of way
 void setBalanceDao(BalanceDao balanceDao)
           
 void setOptionsService(OptionsService optionsService)
           
protected  org.kuali.rice.kns.util.KualiDecimal sumBalances(Iterator balances)
          Given an iterator of balances, this returns the sum of each balance's beginning balance line amount + annual account linge balance amount
protected  Collection wrap(String[] s)
          Turns an array of Strings into a List of Strings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

balanceDao

protected BalanceDao balanceDao

optionsService

protected OptionsService optionsService
Constructor Detail

BalanceServiceImpl

public BalanceServiceImpl()
Method Detail

wrap

protected Collection wrap(String[] s)
Turns an array of Strings into a List of Strings

Parameters:
s - an array of Strings
Returns:
an implementation of Collection (a List) of Strings

getGlSummary

public List<GlSummary> getGlSummary(int universityFiscalYear,
                                    List<String> balanceTypeCodes)
Description copied from interface: BalanceService
Get the GL Balance summary for the GL Summary report

Specified by:
getGlSummary in interface BalanceService
Parameters:
universityFiscalYear - the fiscal year to find balances for
balanceTypeCodes - the balance types to summarize
Returns:
a list of summarized GL balances
See Also:
BalanceService.getGlSummary(int, java.util.List)

findBalancesForFiscalYear

public Iterator<Balance> findBalancesForFiscalYear(Integer fiscalYear)
Defers to the DAO to find all balances in the fiscal year.

Specified by:
findBalancesForFiscalYear in interface BalanceService
Parameters:
fiscalYear - the fiscal year to find balances for
Returns:
an Iterator full of balances from the given fiscal year
See Also:
BalanceService.findBalancesForFiscalYear(java.lang.Integer)

hasAssetLiabilityFundBalanceBalances

public boolean hasAssetLiabilityFundBalanceBalances(Account account)
Checks the given account to see if there are any non zero asset fund liability fund balances for them

Specified by:
hasAssetLiabilityFundBalanceBalances in interface BalanceService
Parameters:
account - an account to find balances for
Returns:
true if there are non zero asset liability fund balances, false if otherwise
See Also:
BalanceService.hasAssetLiabilityFundBalanceBalances(org.kuali.kfs.coa.businessobject.Account)

sumBalances

protected org.kuali.rice.kns.util.KualiDecimal sumBalances(Iterator balances)
Given an iterator of balances, this returns the sum of each balance's beginning balance line amount + annual account linge balance amount

Parameters:
balances - an Iterator of balances to sum
Returns:
the sum of all of those balances

incomeBalances

protected org.kuali.rice.kns.util.KualiDecimal incomeBalances(Account account)
Returns the sum of balances considered as income for the given account

Parameters:
account - the account to find income balances for
Returns:
the sum of income balances

expenseBalances

protected org.kuali.rice.kns.util.KualiDecimal expenseBalances(Account account)
Sums all the balances associated with a given account that would be considered "expense" balances

Parameters:
account - an account to find expense balances for
Returns:
the sum of those balances

fundBalanceWillNetToZero

public boolean fundBalanceWillNetToZero(Account account)
Checks to see if the total income balances for the given account equal the total expense balances for the given account

Specified by:
fundBalanceWillNetToZero in interface BalanceService
Parameters:
an - account to find balances for
Returns:
true if income balances equal expense balances, false otherwise
See Also:
BalanceService.fundBalanceWillNetToZero(org.kuali.kfs.coa.businessobject.Account)

hasEncumbrancesOrBaseBudgets

public boolean hasEncumbrancesOrBaseBudgets(Account account)
Finds all of the encumbrance balances for the given account, and figures out if those encumbrances will have a net impact on the budget

Specified by:
hasEncumbrancesOrBaseBudgets in interface BalanceService
Parameters:
account - an account to find balances for
Returns:
true if summed encumbrances for the account are not zero (meaning encumbrances will have a net impact on the budget), false if otherwise
See Also:
BalanceService.hasEncumbrancesOrBaseBudgets(org.kuali.kfs.coa.businessobject.Account)

beginningBalanceLoaded

public boolean beginningBalanceLoaded(Account account)
Returns whether or not the beginning budget is loaded for the given account. Of course, it doesn't really check the account...just the options for the current year to see if all the beginning balances have been loaded

Specified by:
beginningBalanceLoaded in interface BalanceService
Parameters:
an - account to check whether the beginning balance is loaded for
Returns:
true if the beginning balance is loaded, false otherwise
See Also:
BalanceService.beginningBalanceLoaded(org.kuali.kfs.coa.businessobject.Account)

hasAssetLiabilityOrFundBalance

public boolean hasAssetLiabilityOrFundBalance(Account account)
Determines if the account has asset/liability balances associated with it that will have a net impact

Specified by:
hasAssetLiabilityOrFundBalance in interface BalanceService
Parameters:
account - an account to check balances for
Returns:
true if the account has an asset liability balance, false otherwise
See Also:
BalanceService.hasAssetLiabilityOrFundBalance(org.kuali.kfs.coa.businessobject.Account)

save

public void save(Balance b)
Saves the balance in a no-nonsense, straight away, three piece suit sort of way

Specified by:
save in interface BalanceService
Parameters:
b - the balance to save
See Also:
BalanceService.save(org.kuali.kfs.gl.businessobject.Balance)

setBalanceDao

public void setBalanceDao(BalanceDao balanceDao)

setOptionsService

public void setOptionsService(OptionsService optionsService)

findCashBalance

public Iterator findCashBalance(Map fieldValues,
                                boolean isConsolidated)
This method finds the summary records of balance entries according to input fields an values, using the DAO

Specified by:
findCashBalance in interface BalanceService
Parameters:
fieldValues - the input fields an values
isConsolidated - consolidation option is applied or not
Returns:
the summary records of balance entries
See Also:
BalanceService.findCashBalance(java.util.Map, boolean)

getCashBalanceRecordCount

public Integer getCashBalanceRecordCount(Map fieldValues,
                                         boolean isConsolidated)
This method gets the size of cash balance entries according to input fields and values

Specified by:
getCashBalanceRecordCount in interface BalanceService
Parameters:
fieldValues - the input fields and values
isConsolidated - consolidation option is applied or not
Returns:
the count of cash balance entries
See Also:
BalanceService.getCashBalanceRecordCount(java.util.Map, boolean)

findBalance

public Iterator findBalance(Map fieldValues,
                            boolean isConsolidated)
This method gets the size of balance entries according to input fields and values

Specified by:
findBalance in interface BalanceService
Parameters:
fieldValues - the input fields and values
isConsolidated - consolidation option is applied or not
Returns:
the size of balance entries
See Also:
BalanceService.findBalance(java.util.Map, boolean)

getBalanceRecordCount

public Integer getBalanceRecordCount(Map fieldValues,
                                     boolean isConsolidated)
This method finds the summary records of balance entries according to input fields and values

Specified by:
getBalanceRecordCount in interface BalanceService
Parameters:
fieldValues - the input fields and values
isConsolidated - consolidation option is applied or not
Returns:
the summary records of balance entries
See Also:
BalanceService.getBalanceRecordCount(java.util.Map, boolean)

purgeYearByChart

public void purgeYearByChart(String chart,
                             int year)
Purge the balance table by year/chart

Specified by:
purgeYearByChart in interface BalanceService
Parameters:
chart - the chart of balances to purge
year - the year of balances to purge

loadConstantsFromOptions

protected void loadConstantsFromOptions()
Private method to load the values from the system options service and store them locally for later use.


getActualBalanceCodes

protected String[] getActualBalanceCodes()
Use the options table to get a list of all the balance type codes associated with actual balances

Returns:
an array of balance type codes for actual balances

getIncomeObjectTypeCodes

protected String[] getIncomeObjectTypeCodes()
Uses the options table to find all the balance type codes associated with income

Returns:
an array of income balance type codes

getExpenseObjectTypeCodes

protected String[] getExpenseObjectTypeCodes()
Uses the options table to find all the balance type codes associated with expenses

Returns:
an array of expense option type codes

getAssetLiabilityFundBalanceBalanceTypeCodes

protected String[] getAssetLiabilityFundBalanceBalanceTypeCodes()
Uses the options table to find all the balance type codes associated with asset/liability

Returns:
an array of asset/liability balance type codes

getEncumbranceBaseBudgetBalanceTypeCodes

protected String[] getEncumbranceBaseBudgetBalanceTypeCodes()
Uses the options table to create a list of all the balance type codes associated with encumbrances

Returns:
an array of encumbrance balance type codes

countBalancesForFiscalYear

public int countBalancesForFiscalYear(Integer year)
Uses the DAO to count the number of balances associated with the given fiscal year

Specified by:
countBalancesForFiscalYear in interface BalanceService
Parameters:
fiscal - year a fiscal year to count balances for
Returns:
an integer with the number of balances
See Also:
BalanceService.countBalancesForFiscalYear(java.lang.Integer)

findNominalActivityBalancesForFiscalYear

public Iterator<Balance> findNominalActivityBalancesForFiscalYear(Integer year)
This method returns all of the balances specifically for the nominal activity closing job

Specified by:
findNominalActivityBalancesForFiscalYear in interface BalanceService
Parameters:
year - year to find balances for
Returns:
an Iterator of nominal activity balances
See Also:
BalanceService.findNominalActivityBalancesForFiscalYear(java.lang.Integer)

findCumulativeBalancesToForwardForFiscalYear

public Iterator<Balance> findCumulativeBalancesToForwardForFiscalYear(Integer year)
Returns all the balances to be forwarded for the "cumulative" rule

Specified by:
findCumulativeBalancesToForwardForFiscalYear in interface BalanceService
Parameters:
year - the fiscal year to find balances for
Returns:
an Iterator of balances to process for the cumulative/active balance forward process
See Also:
BalanceService.findCumulativeBalancesToForwardForFiscalYear(java.lang.Integer)

findGeneralBalancesToForwardForFiscalYear

public Iterator<Balance> findGeneralBalancesToForwardForFiscalYear(Integer year)
Returns all the balances specifically to be processed by the balance forwards job for the "general" rule

Specified by:
findGeneralBalancesToForwardForFiscalYear in interface BalanceService
Parameters:
year - the fiscal year to find balances for
Returns:
an Iterator of balances to process for the general balance forward process
See Also:
BalanceService.findGeneralBalancesToForwardForFiscalYear(java.lang.Integer)

findOrganizationReversionBalancesForFiscalYear

public Iterator<Balance> findOrganizationReversionBalancesForFiscalYear(Integer year,
                                                                        boolean endOfYear)
Returns all of the balances to be forwarded for the organization reversion process

Specified by:
findOrganizationReversionBalancesForFiscalYear in interface BalanceService
Parameters:
year - the year of balances to find
endOfYear - whether the organization reversion process is running end of year (before the fiscal year change over) or beginning of year (after the fiscal year change over)
Returns:
an iterator of balances to put through the strenuous organization reversion process
See Also:
BalanceService.findOrganizationReversionBalancesForFiscalYear(java.lang.Integer, boolean)


Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.