org.kuali.kfs.gl.dataaccess.impl
Class BalanceDaoOjb

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springmodules.orm.ojb.support.PersistenceBrokerDaoSupport
          extended by org.kuali.rice.kns.dao.impl.PlatformAwareDaoBaseOjb
              extended by org.kuali.kfs.gl.dataaccess.impl.BalanceDaoOjb
All Implemented Interfaces:
BalanceDao, LedgerBalanceBalancingDao, org.kuali.rice.kns.dao.PlatformAwareDao, org.springframework.beans.factory.InitializingBean

public class BalanceDaoOjb
extends org.kuali.rice.kns.dao.impl.PlatformAwareDaoBaseOjb
implements BalanceDao, LedgerBalanceBalancingDao

An OJB implementation of BalanceDao


Field Summary
protected static String PARAMETER_PREFIX
           
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
BalanceDaoOjb()
           
 
Method Summary
protected  List<String> buildAttributeList(boolean isExtended)
          This method builds the atrribute list used by balance searching
protected  org.apache.ojb.broker.query.Criteria buildCriteriaFromMap(Map fieldValues, Balance balance)
          This method builds the query criteria based on the input field map
protected  List<String> buildGroupByList()
          This method builds group by attribute list used by balance searching
 int countBalancesForFiscalYear(Integer year)
          Returns the count of balances for a given fiscal year; this method is used for year end job reporting
protected  void criteriaBuilder(org.apache.ojb.broker.query.Criteria criteria, String name, Collection collection)
          This method adds to the given criteria if the given collection is non-empty.
protected  void criteriaBuilderHelper(org.apache.ojb.broker.query.Criteria criteria, String name, Collection collection, boolean negate)
          This method provides the implementation for the conveniences methods criteriaBuilder & negatedCriteriaBuilder
 Iterator<Balance> findAccountBalances(Integer universityFiscalYear, String chartOfAccountsCode, String accountNumber)
          Find all matching account balances.
 Iterator<Balance> findAccountBalances(Integer universityFiscalYear, String chartOfAccountsCode, String accountNumber, String sfCode)
          Find all matching account balances.
 Iterator<Balance> findBalance(Map fieldValues, boolean isConsolidated)
          Given a map of values, build a query out of those and find all the balances that qualify
 Iterator<Balance> findBalances(Account account, Integer fiscalYear, Collection includedObjectCodes, Collection excludedObjectCodes, Collection objectTypeCodes, Collection balanceTypeCodes)
          Build a query based on all the parameters, and return an Iterator of all Balances from the database that qualify
 Iterator<Balance> findBalancesForFiscalYear(Integer year)
          Queries the database for all the balances for a given fiscal year
 Iterator<Balance> findCashBalance(Map fieldValues, boolean isConsolidated)
          Using the given fieldValues as keys, return all cash balance records
 Integer findCountGreaterOrEqualThan(Integer year)
           
 Iterator<Balance> findCumulativeBalancesToForwardForFiscalYear(Integer year)
          Returns all of the balances that should be procesed by the BalanceForward year end job under the active rule
 Iterator<Balance> findGeneralBalancesToForwardForFiscalYear(Integer year)
          Returns all of the balances that should be procesed by the BalanceForward year end job under the general rule
 Iterator<Balance> findNominalActivityBalancesForFiscalYear(Integer year)
          Finds all of the balances for the fiscal year that should be processed by nominal activity closing
 Iterator<Balance> findOrganizationReversionBalancesForFiscalYear(Integer year, boolean endOfYear)
          Returns a list of balances to return for the Organization Reversion year end job to process
 Balance getBalanceByPrimaryId(Integer universityFiscalYear, String chartOfAccountsCode, String accountNumber)
          Whoa! This method is seemingly not called in the code base right now, and you know what? You shouldn't call it First of all, we're not even sending in all the primary keys for Balance, and second of all, we're returning a SufficientFundsBalance, which we cast to a Balance, which is *always* going to throw a ClassCastException.
 Balance getBalanceByTransaction(Transaction t)
          Using values from the transaction as keys, lookup the balance the transaction would affect were it posted
protected  org.apache.ojb.broker.query.ReportQueryByCriteria getBalanceCountQuery(Map fieldValues)
          build the query for balance search
protected  org.apache.ojb.broker.query.Query getBalanceQuery(Map fieldValues, boolean isConsolidated)
          build the query for balance search
protected  org.apache.ojb.broker.query.ReportQueryByCriteria getCashBalanceCountQuery(Map fieldValues)
          Builds a query for cash balances, based on the given field values
protected  org.apache.ojb.broker.query.Query getCashBalanceQuery(Map fieldValues, boolean isConsolidated)
          build the query for cash balance search
 Iterator getConsolidatedBalanceRecordCount(Map fieldValues)
          Given a Map of keys to use as a query, if we performed that query as a consolidated query...
 Iterator getConsolidatedCashBalanceRecordCount(Map fieldValues)
          Given a map of keys, return all of the report data about qualifying cash balances
 Balance getCurrentBudgetForObjectCode(Integer universityFiscalYear, String chartOfAccountsCode, String accountNumber, String objectCode)
          Since SubAccountNumber, SubObjectCode, and ObjectType are all part of the primary key of Balance, you're guaranteed to get one of those records when you call this method.
 Integer getDetailedCashBalanceRecordCount(Map fieldValues)
          Get the number of detailed cash balance records that would be returned, were we to do a query based on the given fieldValues
 Iterator<Object[]> getGlSummary(int universityFiscalYear, List<String> balanceTypeCodes)
          Does a ReportQuery to summarize GL balance data
protected  void negatedCriteriaBuilder(org.apache.ojb.broker.query.Criteria criteria, String name, Collection collection)
          Similar to criteriaBuilder, this adds a negative criterion (NOT EQUALS, NOT IN)
 void purgeYearByChart(String chartOfAccountsCode, int year)
          Purge the sufficient funds balance table by year/chart
 void save(Balance b)
          Saves a balance
 void setBalanceTypService(BalanceTypeService balanceTypService)
           
 void setOptionsService(OptionsService optionsService)
           
 void setParameterService(org.kuali.rice.kns.service.ParameterService parameterService)
           
 
Methods inherited from class org.kuali.rice.kns.dao.impl.PlatformAwareDaoBaseOjb
getDbPlatform, setDbPlatform
 
Methods inherited from class org.springmodules.orm.ojb.support.PersistenceBrokerDaoSupport
checkDaoConfig, convertOjbAccessException, createPersistenceBrokerTemplate, getJcdAlias, getPersistenceBroker, getPersistenceBrokerTemplate, releasePersistenceBroker, setJcdAlias, setPersistenceBrokerTemplate
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAMETER_PREFIX

protected static final String PARAMETER_PREFIX
See Also:
Constant Field Values
Constructor Detail

BalanceDaoOjb

public BalanceDaoOjb()
Method Detail

getGlSummary

public Iterator<Object[]> getGlSummary(int universityFiscalYear,
                                       List<String> balanceTypeCodes)
Does a ReportQuery to summarize GL balance data

Specified by:
getGlSummary in interface BalanceDao
Parameters:
universityFiscalYear - the fiscal year of balances to search for
balanceTypeCodes - a list of balance type codes of balances to search for
Returns:
iterator of reported on java.lang.Object arrays with the report data
See Also:
BalanceDao.getGlSummary(int, java.util.List)

findBalancesForFiscalYear

public Iterator<Balance> findBalancesForFiscalYear(Integer year)
Queries the database for all the balances for a given fiscal year

Specified by:
findBalancesForFiscalYear in interface BalanceDao
Parameters:
year - the university fiscal year of balances to return
Returns:
an iterator over all balances for a given fiscal year
See Also:
BalanceDao.findBalancesForFiscalYear(java.lang.Integer)

save

public void save(Balance b)
Saves a balance

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

getBalanceByTransaction

public Balance getBalanceByTransaction(Transaction t)
Using values from the transaction as keys, lookup the balance the transaction would affect were it posted

Specified by:
getBalanceByTransaction in interface BalanceDao
Parameters:
t - a transaction
Returns:
a Balance that the given transaction would affect
See Also:
BalanceDao.getBalanceByTransaction(org.kuali.kfs.gl.businessobject.Transaction)

criteriaBuilder

protected void criteriaBuilder(org.apache.ojb.broker.query.Criteria criteria,
                               String name,
                               Collection collection)
This method adds to the given criteria if the given collection is non-empty. It uses an EQUALS if there is exactly one element in the collection; otherwise, its uses an IN

Parameters:
criteria - - the criteria that might have a criterion appended
name - - name of the attribute
collection - - the collection to inspect

negatedCriteriaBuilder

protected void negatedCriteriaBuilder(org.apache.ojb.broker.query.Criteria criteria,
                                      String name,
                                      Collection collection)
Similar to criteriaBuilder, this adds a negative criterion (NOT EQUALS, NOT IN)

Parameters:
criteria - - the criteria that might have a criterion appended
name - - name of the attribute
collection - - the collection to inspect

criteriaBuilderHelper

protected void criteriaBuilderHelper(org.apache.ojb.broker.query.Criteria criteria,
                                     String name,
                                     Collection collection,
                                     boolean negate)
This method provides the implementation for the conveniences methods criteriaBuilder & negatedCriteriaBuilder

Parameters:
criteria - - the criteria that might have a criterion appended
name - - name of the attribute
collection - - the collection to inspect
negate - - the criterion will be negated (NOT EQUALS, NOT IN) when this is true

findBalances

public Iterator<Balance> findBalances(Account account,
                                      Integer fiscalYear,
                                      Collection includedObjectCodes,
                                      Collection excludedObjectCodes,
                                      Collection objectTypeCodes,
                                      Collection balanceTypeCodes)
Build a query based on all the parameters, and return an Iterator of all Balances from the database that qualify

Specified by:
findBalances in interface BalanceDao
Parameters:
account - the account of balances to find
fiscalYear - the fiscal year of balances to find
includedObjectCodes - a Collection of object codes found balances should have one of
excludedObjectCodes - a Collection of object codes found balances should not have one of
objectTypeCodes - a Collection of object type codes found balances should have one of
balanceTypeCodes - a Collection of balance type codes found balances should have one of
Returns:
an Iterator of Balances
See Also:
BalanceDao.findBalances(org.kuali.kfs.coa.businessobject.Account, java.lang.Integer, java.util.Collection, java.util.Collection, java.util.Collection, java.util.Collection)

findCashBalance

public Iterator<Balance> findCashBalance(Map fieldValues,
                                         boolean isConsolidated)
Using the given fieldValues as keys, return all cash balance records

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

getDetailedCashBalanceRecordCount

public Integer getDetailedCashBalanceRecordCount(Map fieldValues)
Get the number of detailed cash balance records that would be returned, were we to do a query based on the given fieldValues

Specified by:
getDetailedCashBalanceRecordCount in interface BalanceDao
Parameters:
fieldValues - the input fields and values
isConsolidated - consolidation option is applied or not
Returns:
the size collection of cash balance entry groups
See Also:
org.kuali.kfs.gl.dataaccess.BalanceDao#getCashBalanceRecordCount(java.util.Map, boolean)

getConsolidatedCashBalanceRecordCount

public Iterator getConsolidatedCashBalanceRecordCount(Map fieldValues)
Given a map of keys, return all of the report data about qualifying cash balances

Specified by:
getConsolidatedCashBalanceRecordCount in interface BalanceDao
Parameters:
fieldValues - the input fields and values
Returns:
the size collection of cash balance entry groups
See Also:
org.kuali.kfs.gl.dataaccess.BalanceDao#getCashBalanceRecordSize(java.util.Map, boolean)

findBalance

public Iterator<Balance> findBalance(Map fieldValues,
                                     boolean isConsolidated)
Given a map of values, build a query out of those and find all the balances that qualify

Specified by:
findBalance in interface BalanceDao
Parameters:
fieldValues - a Map of fieldValues to use as keys in the query
isConsolidated - should the results be consolidated?
Returns:
an Iterator of Balances
See Also:
BalanceDao.findBalance(java.util.Map, boolean)

getConsolidatedBalanceRecordCount

public Iterator getConsolidatedBalanceRecordCount(Map fieldValues)
Given a Map of keys to use as a query, if we performed that query as a consolidated query... how many records would we get back?

Specified by:
getConsolidatedBalanceRecordCount in interface BalanceDao
Parameters:
fieldValues - a Map of values to use as keys to build the query
Returns:
an Iterator of counts...
See Also:
BalanceDao.getConsolidatedBalanceRecordCount(java.util.Map)

getCashBalanceCountQuery

protected org.apache.ojb.broker.query.ReportQueryByCriteria getCashBalanceCountQuery(Map fieldValues)
Builds a query for cash balances, based on the given field values

Parameters:
fieldValues - a map of keys to use when building the query
Returns:
an OJB ReportQuery to use as the query

getCashBalanceQuery

protected org.apache.ojb.broker.query.Query getCashBalanceQuery(Map fieldValues,
                                                                boolean isConsolidated)
build the query for cash balance search

Parameters:
fieldValues - Map of keys to use for the query
isConsolidated - should the results be consolidated?
Returns:
the OJB query to perform

getBalanceQuery

protected org.apache.ojb.broker.query.Query getBalanceQuery(Map fieldValues,
                                                            boolean isConsolidated)
build the query for balance search

Parameters:
fieldValues - Map of keys to use for the query
isConsolidated - should the results be consolidated?
Returns:
an OJB query to perform

getBalanceCountQuery

protected org.apache.ojb.broker.query.ReportQueryByCriteria getBalanceCountQuery(Map fieldValues)
build the query for balance search

Parameters:
fieldValues - Map of keys to use for the query
Returns:
an OJB ReportQuery to perform

buildCriteriaFromMap

protected org.apache.ojb.broker.query.Criteria buildCriteriaFromMap(Map fieldValues,
                                                                    Balance balance)
This method builds the query criteria based on the input field map

Parameters:
fieldValues - Map of keys to use for the query
balance - this really usen't used in the method
Returns:
a query criteria

buildAttributeList

protected List<String> buildAttributeList(boolean isExtended)
This method builds the atrribute list used by balance searching

Parameters:
isExtended - should we add the attributes to sum each of the monthly totals?
Returns:
List an attribute list

buildGroupByList

protected List<String> buildGroupByList()
This method builds group by attribute list used by balance searching

Returns:
List an group by attribute list

getBalanceByPrimaryId

public Balance getBalanceByPrimaryId(Integer universityFiscalYear,
                                     String chartOfAccountsCode,
                                     String accountNumber)
Whoa! This method is seemingly not called in the code base right now, and you know what? You shouldn't call it First of all, we're not even sending in all the primary keys for Balance, and second of all, we're returning a SufficientFundsBalance, which we cast to a Balance, which is *always* going to throw a ClassCastException. Don't call this method. Just...just step away.

Specified by:
getBalanceByPrimaryId in interface BalanceDao
Parameters:
universityFiscalYear - the university fiscal year of the balance to find
chartOfAccountsCode - the chart of accounts code of the balance to find
accountNumber - the account number of the balance to find
Returns:
the balance that is specified by those...er...partially defined primary keys.
See Also:
BalanceDao.getBalanceByPrimaryId(java.lang.Integer, java.lang.String, java.lang.String)

getCurrentBudgetForObjectCode

public Balance getCurrentBudgetForObjectCode(Integer universityFiscalYear,
                                             String chartOfAccountsCode,
                                             String accountNumber,
                                             String objectCode)
Since SubAccountNumber, SubObjectCode, and ObjectType are all part of the primary key of Balance, you're guaranteed to get one of those records when you call this method. Let's hope the right one.

Specified by:
getCurrentBudgetForObjectCode in interface BalanceDao
Parameters:
universityFiscalYear - the fiscal year of the CB balance to return
chartOfAccountsCode - the chart of the accounts code of the CB balanes to return
accountNumber - the account number of the CB balance to return
objectCode - the object code of the CB balance to return
Returns:
the CB Balance record
See Also:
BalanceDao.getCurrentBudgetForObjectCode(java.lang.Integer, java.lang.String, java.lang.String, java.lang.String)

findAccountBalances

public Iterator<Balance> findAccountBalances(Integer universityFiscalYear,
                                             String chartOfAccountsCode,
                                             String accountNumber)
Find all matching account balances.

Specified by:
findAccountBalances in interface BalanceDao
Parameters:
universityFiscalYear - the university fiscal year of balances to return
chartOfAccountsCode - the chart of accounts code of balances to return
accountNumber - the account number of balances to return
Returns:
balances sorted by object code

findAccountBalances

public Iterator<Balance> findAccountBalances(Integer universityFiscalYear,
                                             String chartOfAccountsCode,
                                             String accountNumber,
                                             String sfCode)
Find all matching account balances. The Sufficient funds code is used to determine the sort of the results.

Specified by:
findAccountBalances in interface BalanceDao
Parameters:
universityFiscalYear - the university fiscal year of balances to return
chartOfAccountsCode - the chart of accounts code of balances to return
accountNumber - the account number of balances to return
sfCode - the sufficient funds code, used to sort on
Returns:
an Iterator of balances

purgeYearByChart

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

Specified by:
purgeYearByChart in interface BalanceDao
Parameters:
chart - the chart of balances to purge
year - the university fiscal year of balances to purge

countBalancesForFiscalYear

public int countBalancesForFiscalYear(Integer year)
Returns the count of balances for a given fiscal year; this method is used for year end job reporting

Specified by:
countBalancesForFiscalYear in interface BalanceDao
Parameters:
year - the university fiscal year to count balances for
Returns:
an int with the count of balances for that fiscal year
See Also:
BalanceDao.countBalancesForFiscalYear(java.lang.Integer)

findNominalActivityBalancesForFiscalYear

public Iterator<Balance> findNominalActivityBalancesForFiscalYear(Integer year)
Finds all of the balances for the fiscal year that should be processed by nominal activity closing

Specified by:
findNominalActivityBalancesForFiscalYear in interface BalanceDao
Parameters:
year - the university fiscal year of balances to find
Returns:
an Iterator of Balances to process
See Also:
BalanceDao.findNominalActivityBalancesForFiscalYear(java.lang.Integer)

findGeneralBalancesToForwardForFiscalYear

public Iterator<Balance> findGeneralBalancesToForwardForFiscalYear(Integer year)
Returns all of the balances that should be procesed by the BalanceForward year end job under the general rule

Specified by:
findGeneralBalancesToForwardForFiscalYear in interface BalanceDao
Parameters:
the - university fiscal year to find balances for
Returns:
an Iterator of Balances to process
See Also:
BalanceDao.findCumulativeBalancesToForwardForFiscalYear(java.lang.Integer)

findCumulativeBalancesToForwardForFiscalYear

public Iterator<Balance> findCumulativeBalancesToForwardForFiscalYear(Integer year)
Returns all of the balances that should be procesed by the BalanceForward year end job under the active rule

Specified by:
findCumulativeBalancesToForwardForFiscalYear in interface BalanceDao
Parameters:
the - university fiscal year to find balances for
Returns:
an Iterator of Balances to process
See Also:
BalanceDao.findGeneralBalancesToForwardForFiscalYear(java.lang.Integer)

findOrganizationReversionBalancesForFiscalYear

public Iterator<Balance> findOrganizationReversionBalancesForFiscalYear(Integer year,
                                                                        boolean endOfYear)
Returns a list of balances to return for the Organization Reversion year end job to process

Specified by:
findOrganizationReversionBalancesForFiscalYear in interface BalanceDao
Parameters:
the - university fiscal year to find balances for
endOfYear - if true, use currrent year accounts, otherwise use prior year accounts
Returns:
an Iterator of Balances to process
See Also:
BalanceDao.findOrganizationReversionBalancesForFiscalYear(java.lang.Integer, boolean)

findCountGreaterOrEqualThan

public Integer findCountGreaterOrEqualThan(Integer year)
Specified by:
findCountGreaterOrEqualThan in interface LedgerBalanceBalancingDao
Parameters:
year - the given university fiscal year
Returns:
count of rows for the given fiscal year
See Also:
org.kuali.kfs.gl.dataaccess.BalancingDao#findCountGreaterOrEqualThan(java.lang.Integer)

setOptionsService

public void setOptionsService(OptionsService optionsService)

setParameterService

public void setParameterService(org.kuali.rice.kns.service.ParameterService parameterService)

setBalanceTypService

public void setBalanceTypService(BalanceTypeService balanceTypService)


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