/** * <p>Lazy getter for balanceAtAllDirtyCheck.</p> * @return BalanceAtAllDirtyCheck * @throws Exception - an exception **/ public final synchronized BalanceAtAllDirtyCheck lazyGetBalanceAtAllDirtyCheck() throws Exception { if (this.balanceAtAllDirtyCheck == null) { this.balanceAtAllDirtyCheck = getSrvOrm() .retrieveEntityById(BalanceAtAllDirtyCheck.class, 1L); if (this.balanceAtAllDirtyCheck == null) { this.balanceAtAllDirtyCheck = new BalanceAtAllDirtyCheck(); this.balanceAtAllDirtyCheck.setItsId(1L); getSrvOrm().insertEntity(this.balanceAtAllDirtyCheck); } } return this.balanceAtAllDirtyCheck; }
/** * <p>Lazy getter for balanceAtAllDirtyCheck.</p> * @param pAddParam additional param * @return BalanceAtAllDirtyCheck * @throws Exception - an exception **/ public final synchronized BalanceAtAllDirtyCheck lazyGetBalanceAtAllDirtyCheck( final Map<String, Object> pAddParam) throws Exception { if (this.balanceAtAllDirtyCheck == null) { BalanceAtAllDirtyCheck balLoc = new BalanceAtAllDirtyCheck(); balLoc.setItsId(1L); this.balanceAtAllDirtyCheck = getSrvOrm() .retrieveEntity(pAddParam, balLoc); if (this.balanceAtAllDirtyCheck == null) { getSrvOrm().insertEntity(pAddParam, balLoc); balLoc.setIsNew(false); this.balanceAtAllDirtyCheck = getSrvOrm() .retrieveEntity(pAddParam, balLoc); } } return this.balanceAtAllDirtyCheck; }
this.balanceAtAllDirtyCheck .setDateBalanceStoreStart(cal.getTime()); getSrvOrm() .updateEntity(pAddParam, this.balanceAtAllDirtyCheck); } else if (dateBalanceStoreStart.getTime() == this.initDateLong evalDatePeriodStartFor(pAddParam, new Date(dateFirstEntryLong))); getSrvOrm() .updateEntity(pAddParam, this.balanceAtAllDirtyCheck);
/** * <p>Handle new accounting entry is created to check dirty. * This is implementation of dirty check for all accounts.</p> * @param pAddParam additional param * @param pAcc account * @param pSubaccId subaccount ID * @param pDateAt date at * @throws Exception - an exception **/ @Override public final synchronized void handleNewAccountEntry( final Map<String, Object> pAddParam, final Account pAcc, final Long pSubaccId, final Date pDateAt) throws Exception { if (lazyGetBalanceAtAllDirtyCheck(pAddParam).getLeastAccountingEntryDate() .getTime() > pDateAt.getTime()) { if (getLogger().getIsShowDebugMessagesFor(getClass())) { getLogger().debug(null, SrvBalanceStd.class, "changing least last entry date from " + this.balanceAtAllDirtyCheck .getLeastAccountingEntryDate() + " to " + pDateAt); } this.balanceAtAllDirtyCheck .setLeastAccountingEntryDate(pDateAt); getSrvOrm() .updateEntity(pAddParam, this.balanceAtAllDirtyCheck); } }
+ " and BALANCEAT.SUBACCTYPE=" + tbl.getSubaccType(); BalanceAt balanceAt = getSrvOrm().retrieveEntityWithConditions( BalanceAt.class, "where ITSACCOUNT='" + tbl.getAccId() + "' and ITSDATE=" + date.getTime() + subAccWhereStr); balanceAt.setSubaccount(tbl.getSubaccName()); if (balanceAt.getIsNew()) { getSrvOrm().insertEntity(balanceAt); } else { getSrvOrm().updateEntity(balanceAt); .setLeastAccountingEntryDate(lazyGetBalanceAtAllDirtyCheck() .getCurrentBalanceDate()); getSrvOrm().updateEntity(lazyGetBalanceAtAllDirtyCheck()); getLogger().info(SrvBalanceStd.class, SrvBalanceStd.class.getSimpleName() + ": recalculation end BalanceAtAllDirtyCheck is "
+ " and BALANCEAT.SUBACCTYPE=" + tbl.getSubaccType(); BalanceAt balanceAt = getSrvOrm().retrieveEntityWithConditions( pAddParam, BalanceAt.class, "where ITSACCOUNT='" + tbl.getAccId() + "' and ITSDATE=" + date.getTime() + subAccWhereStr); balanceAt.setSubaccount(tbl.getSubaccName()); if (balanceAt.getIsNew()) { getSrvOrm().insertEntity(pAddParam, balanceAt); balanceAt.setIsNew(false); } else { getSrvOrm().updateEntity(pAddParam, balanceAt); .setLeastAccountingEntryDate(this.balanceAtAllDirtyCheck .getCurrentBalanceDate()); getSrvOrm() .updateEntity(pAddParam, this.balanceAtAllDirtyCheck); getLogger().info(null, SrvBalanceStd.class,
.setCurrentBalanceDate(new Date(157766400000L)); lazyGetBalanceAtAllDirtyCheck().setIsPeriodChanged(true); getSrvOrm().updateEntity(lazyGetBalanceAtAllDirtyCheck());
/** * <p>Evaluate period of stored balances according settings, * if it's changed then it switch on "current balances are dirty".</p> * @param pAddParam additional param * @return pPeriod EPeriod e.g. MONTHLY * @throws Exception - an exception **/ @Override public final synchronized EPeriod evalBalanceStorePeriod( final Map<String, Object> pAddParam) throws Exception { if (!lazyGetBalanceAtAllDirtyCheck(pAddParam).getBalanceStorePeriod() .equals(getSrvAccSettings().lazyGetAccSettings(pAddParam) .getBalanceStorePeriod())) { getLogger().info(null, SrvBalanceStd.class, "changing period from " + this.balanceAtAllDirtyCheck .getBalanceStorePeriod() + " to " + getSrvAccSettings() .lazyGetAccSettings(pAddParam).getBalanceStorePeriod()); this.balanceAtAllDirtyCheck .setBalanceStorePeriod(getSrvAccSettings().lazyGetAccSettings(pAddParam) .getBalanceStorePeriod()); this.balanceAtAllDirtyCheck.setIsPeriodChanged(true); this.balanceAtAllDirtyCheck .setCurrentBalanceDate(initDate); getSrvOrm() .updateEntity(pAddParam, this.balanceAtAllDirtyCheck); } return this.balanceAtAllDirtyCheck.getBalanceStorePeriod(); }
.setCurrentBalanceDate(initDate); this.balanceAtAllDirtyCheck.setIsPeriodChanged(true); getSrvOrm() .updateEntity(pAddParam, this.balanceAtAllDirtyCheck);