RS - platform dependent record set typepublic class SrvBalanceStd<RS> extends Object implements ISrvBalance
Service that maintenance BalanceAt and implements dirty check for all account. If balance for account at given date is NULL then it will be no record BalanceAt, this is cheap approach. All work include recalculation all balances is executed in single transaction
| Constructor and Description |
|---|
SrvBalanceStd()
minimum constructor.
|
SrvBalanceStd(org.beigesoft.service.ISrvOrm<RS> pSrvOrm,
org.beigesoft.service.ISrvDatabase<RS> pSrvDatabase,
ISrvAccSettings pSrvAccSettings,
org.beigesoft.log.ILogger pLogger)
Useful constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
changeBalanceStorePeriod(Map<String,Object> pAddParam,
org.beigesoft.model.EPeriod pPeriod)
Change period of stored balances EPeriod.DAILY/WEEKLY/MONTHLY
and switch on "current balances are dirty".
|
BalanceAt |
evalBalanceAt(Map<String,Object> pAddParam,
Account pAcc,
Long pSubaccId,
Date pDateFor)
Evaluate BalanceAt for given pAcc which itsDate less
or equals pDateFor.
|
org.beigesoft.model.EPeriod |
evalBalanceStorePeriod(Map<String,Object> pAddParam)
Evaluate period of stored balances according settings,
if it's changed then it switch on "current balances are dirty".
|
Date |
evalDateBalanceStoreStart(Map<String,Object> pAddParam)
Evaluate date start of stored balances according settings,
this is the first month of the first accounting entry or start of current
year if there are no any acc-entry.
|
Date |
evalDateNextPeriodStart(Map<String,Object> pAddParam,
Date pDateFor)
Evaluate date start of next balance store period.
|
Date |
evalDatePeriodStartFor(Map<String,Object> pAddParam,
Date pDateFor)
Evaluate start of period nearest to pDateFor.
|
String |
evalQueryBalance(Map<String,Object> pAddParam,
Date pDate)
Evaluate Trial Balance query.
|
org.beigesoft.log.ILogger |
getLogger()
Geter for logger.
|
String |
getQueryBalance()
Getter for queryBalance.
|
ISrvAccSettings |
getSrvAccSettings()
Getter for srvAccSettings.
|
org.beigesoft.service.ISrvDatabase<RS> |
getSrvDatabase()
Geter for srvDatabase.
|
org.beigesoft.service.ISrvOrm<RS> |
getSrvOrm()
Getter for srvOrm.
|
void |
handleNewAccountEntry(Map<String,Object> pAddParam,
Account pAcc,
Long pSubaccId,
Date pDateAt)
Handle new accounting entry is created to check dirty.
|
BalanceAtAllDirtyCheck |
lazyGetBalanceAtAllDirtyCheck(Map<String,Object> pAddParam)
Lazy getter for balanceAtAllDirtyCheck.
|
String |
loadString(String pFileName)
Load string file (usually SQL query).
|
void |
recalculateAll(Map<String,Object> pAddParam,
Date pDateFor,
boolean pIsPrepareNeed)
Forced recalculation all balances for all dates less
or equals pDateFor.
|
void |
recalculateAllIfNeed(Map<String,Object> pAddParam,
Date pDateFor)
Recalculate if need for all balances for all dates less
or equals pDateFor, this method is always invoked by report ledger.
|
void |
recalculateFor(Map<String,Object> pAddParam,
Account pAcc,
Long pSubaccId,
Date pDateFor)
Forced recalculation all stored balances for this account
for all dates less or equals pDateFor.
|
List<TrialBalanceLine> |
retrieveBalanceLines(Map<String,Object> pAddParam,
String pQuery)
Retrieve Trial Balance lines with given query and precision cost.
|
List<TrialBalanceLine> |
retrieveBalanceLinesForStore(String pQuery)
Retrieve Trial Balance lines with given query for store.
|
List<TrialBalanceLine> |
retrieveTrialBalance(Map<String,Object> pAddParam,
Date pDate)
Retrieve Trial Balance.
|
void |
setLogger(org.beigesoft.log.ILogger pLogger)
Setter for logger.
|
void |
setQueryBalance(String pQueryBalance)
Setter for queryBalance.
|
void |
setSrvAccSettings(ISrvAccSettings pSrvAccSettings)
Setter for srvAccSettings.
|
void |
setSrvDatabase(org.beigesoft.service.ISrvDatabase<RS> pSrvDatabase)
Setter for srvDatabase.
|
void |
setSrvOrm(org.beigesoft.service.ISrvOrm<RS> pSrvOrm)
Setter for srvOrm.
|
public SrvBalanceStd()
minimum constructor.
public SrvBalanceStd(org.beigesoft.service.ISrvOrm<RS> pSrvOrm, org.beigesoft.service.ISrvDatabase<RS> pSrvDatabase, ISrvAccSettings pSrvAccSettings, org.beigesoft.log.ILogger pLogger)
Useful constructor.
pSrvOrm - ORM servicepSrvDatabase - Database servicepSrvAccSettings - AccSettings servicepLogger - referencepublic final void changeBalanceStorePeriod(Map<String,Object> pAddParam, org.beigesoft.model.EPeriod pPeriod) throws Exception
Change period of stored balances EPeriod.DAILY/WEEKLY/MONTHLY and switch on "current balances are dirty".
changeBalanceStorePeriod in interface ISrvBalancepAddParam - additional parampPeriod - EPeriod e.g. MONTHLYException - - an exceptionpublic final org.beigesoft.model.EPeriod evalBalanceStorePeriod(Map<String,Object> pAddParam) throws Exception
Evaluate period of stored balances according settings, if it's changed then it switch on "current balances are dirty".
evalBalanceStorePeriod in interface ISrvBalancepAddParam - additional paramException - - an exceptionpublic final BalanceAt evalBalanceAt(Map<String,Object> pAddParam, Account pAcc, Long pSubaccId, Date pDateFor) throws Exception
Evaluate BalanceAt for given pAcc which itsDate less or equals pDateFor. If required BalanceAt (and all BalanceAt from start of year) is null or dirty it makes it (they).
evalBalanceAt in interface ISrvBalancepAddParam - additional parampAcc - accountpSubaccId - subaccount IDpDateFor - date forException - - an exceptionpublic final void handleNewAccountEntry(Map<String,Object> pAddParam, Account pAcc, Long pSubaccId, Date pDateAt) throws Exception
Handle new accounting entry is created to check dirty. This is implementation of dirty check for all accounts.
handleNewAccountEntry in interface ISrvBalancepAddParam - additional parampAcc - accountpSubaccId - subaccount IDpDateAt - date atException - - an exceptionpublic final void recalculateAllIfNeed(Map<String,Object> pAddParam, Date pDateFor) throws Exception
Recalculate if need for all balances for all dates less or equals pDateFor, this method is always invoked by report ledger.
recalculateAllIfNeed in interface ISrvBalancepAddParam - additional parampDateFor - date forException - - an exceptionpublic final void recalculateFor(Map<String,Object> pAddParam, Account pAcc, Long pSubaccId, Date pDateFor) throws Exception
Forced recalculation all stored balances for this account for all dates less or equals pDateFor. This method usually invoked by account subaccount line service when subaccount is added.
recalculateFor in interface ISrvBalancepAddParam - additional parampAcc - accountpSubaccId - subaccount IDpDateFor - date forException - - an exceptionpublic final void recalculateAll(Map<String,Object> pAddParam, Date pDateFor, boolean pIsPrepareNeed) throws Exception
Forced recalculation all balances for all dates less or equals pDateFor. If balance for account at given date is NULL then it will be no recorded into BalanceAt, this is cheap approach.
recalculateAll in interface ISrvBalancepAddParam - additional parampDateFor - date forpIsPrepareNeed - if need evaluation store period/start of storeException - - an exceptionpublic final List<TrialBalanceLine> retrieveTrialBalance(Map<String,Object> pAddParam, Date pDate) throws Exception
Retrieve Trial Balance.
retrieveTrialBalance in interface ISrvBalancepAddParam - additional parampDate - dateException - - an exceptionpublic final Date evalDatePeriodStartFor(Map<String,Object> pAddParam, Date pDateFor) throws Exception
Evaluate start of period nearest to pDateFor. Tested in beige-common org.beigesoft.test.CalendarTest.
evalDatePeriodStartFor in interface ISrvBalancepAddParam - additional parampDateFor - date forException - - an exceptionpublic final Date evalDateBalanceStoreStart(Map<String,Object> pAddParam) throws Exception
Evaluate date start of stored balances according settings, this is the first month of the first accounting entry or start of current year if there are no any acc-entry.
pAddParam - additional paramException - - an exceptionpublic final String evalQueryBalance(Map<String,Object> pAddParam, Date pDate) throws Exception
Evaluate Trial Balance query.
pAddParam - additional parampDate - date of balanceException - - an exceptionpublic final List<TrialBalanceLine> retrieveBalanceLines(Map<String,Object> pAddParam, String pQuery) throws Exception
Retrieve Trial Balance lines with given query and precision cost.
pAddParam - additional parampQuery - dateException - - an exceptionpublic final List<TrialBalanceLine> retrieveBalanceLinesForStore(String pQuery) throws Exception
Retrieve Trial Balance lines with given query for store.
pQuery - dateException - - an exceptionpublic final String loadString(String pFileName) throws IOException
Load string file (usually SQL query).
pFileName - file nameIOException - - IO exceptionpublic final BalanceAtAllDirtyCheck lazyGetBalanceAtAllDirtyCheck(Map<String,Object> pAddParam) throws Exception
Lazy getter for balanceAtAllDirtyCheck.
pAddParam - additional paramException - - an exceptionpublic final Date evalDateNextPeriodStart(Map<String,Object> pAddParam, Date pDateFor) throws Exception
Evaluate date start of next balance store period. Tested in beige-common org.beigesoft.test.CalendarTest.
pAddParam - additional parampDateFor - date forException - - an exceptionpublic final org.beigesoft.service.ISrvOrm<RS> getSrvOrm()
Getter for srvOrm.
public final void setSrvOrm(org.beigesoft.service.ISrvOrm<RS> pSrvOrm)
Setter for srvOrm.
pSrvOrm - referencepublic final org.beigesoft.service.ISrvDatabase<RS> getSrvDatabase()
Geter for srvDatabase.
public final void setSrvDatabase(org.beigesoft.service.ISrvDatabase<RS> pSrvDatabase)
Setter for srvDatabase.
pSrvDatabase - referencepublic final ISrvAccSettings getSrvAccSettings()
Getter for srvAccSettings.
public final void setSrvAccSettings(ISrvAccSettings pSrvAccSettings)
Setter for srvAccSettings.
pSrvAccSettings - referencepublic final String getQueryBalance()
Getter for queryBalance.
public final void setQueryBalance(String pQueryBalance)
Setter for queryBalance.
pQueryBalance - referencepublic final org.beigesoft.log.ILogger getLogger()
Geter for logger.
public final void setLogger(org.beigesoft.log.ILogger pLogger)
Setter for logger.
pLogger - referenceCopyright © 2016–2018. All rights reserved.