Java tutorial
// Description: Java7 in-memory RAM DbIO implementation for AccountEntry. /* * MSS Code Factory Accounting Business Application Model * * Copyright (c) 2014 Mark Sobkow * * This program is available as free software under the GNU GPL v3, or * under a commercial license from Mark Sobkow. For commercial licensing * details, please contact msobkow@sasktel.net. * * Under the terms of the GPL: * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * This source code incorporates modified modules originally licensed * under the Apache 2.0 license by MSS Code Factory including CFSecurity * (net-sourceforge-msscodefactory-2.0-cfsecurity.xml), * CFInternet (net-sourceforge-msscodefactory-2.0-cfinternet.xml), and * CFCrm 2.0 (net-sourceforge-msscodefactory-2.0-cfcrm.xml), with all of the * required models being available as part of the MSS Code Factory 1.11 * distribution source and install zips. * * You can download installations of MSS Code Factory 1.11 from * http://msscodefactory.sourceforge.net/ * * *********************************************************************** * * Code manufactured by MSS Code Factory */ package net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam; import java.sql.*; import java.util.*; import net.sourceforge.msscodefactory.cflib.v1_11.CFLib.*; import org.apache.commons.codec.binary.Base64; import net.sourceforge.msscodefactory.cfacc.v2_0.CFAcc.*; import net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.*; /* * CFAccRamAccountEntryTable in-memory RAM DbIO implementation * for AccountEntry. */ public class CFAccRamAccountEntryTable implements ICFAccAccountEntryTable { private CFAccRamSchema schema; private Map<CFAccAccountEntryPKey, CFAccAccountEntryBuff> dictByPKey = new HashMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); private SortedMap<CFAccAccountEntryByUEntryIdxKey, CFAccAccountEntryBuff> dictByUEntryIdx = new TreeMap<CFAccAccountEntryByUEntryIdxKey, CFAccAccountEntryBuff>(); private SortedMap<CFAccAccountEntryByAccTsIdxKey, SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>> dictByAccTsIdx = new TreeMap<CFAccAccountEntryByAccTsIdxKey, SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>>(); private SortedMap<CFAccAccountEntryByEStampIdxKey, SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>> dictByEStampIdx = new TreeMap<CFAccAccountEntryByEStampIdxKey, SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>>(); private SortedMap<CFAccAccountEntryBySplitIdxKey, SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>> dictBySplitIdx = new TreeMap<CFAccAccountEntryBySplitIdxKey, SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>>(); private SortedMap<CFAccAccountEntryByTenantIdxKey, SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>> dictByTenantIdx = new TreeMap<CFAccAccountEntryByTenantIdxKey, SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>>(); private SortedMap<CFAccAccountEntryByAcctIdxKey, SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>> dictByAcctIdx = new TreeMap<CFAccAccountEntryByAcctIdxKey, SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>>(); private SortedMap<CFAccAccountEntryByXfrAcctIdxKey, SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>> dictByXfrAcctIdx = new TreeMap<CFAccAccountEntryByXfrAcctIdxKey, SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>>(); private SortedMap<CFAccAccountEntryByDrCcyIdxKey, SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>> dictByDrCcyIdx = new TreeMap<CFAccAccountEntryByDrCcyIdxKey, SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>>(); private SortedMap<CFAccAccountEntryByCrCcyIdxKey, SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>> dictByCrCcyIdx = new TreeMap<CFAccAccountEntryByCrCcyIdxKey, SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>>(); private SortedMap<CFAccAccountEntryByCvtCcyIdxKey, SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>> dictByCvtCcyIdx = new TreeMap<CFAccAccountEntryByCvtCcyIdxKey, SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>>(); private SortedMap<CFAccAccountEntryByBalCcyIdxKey, SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>> dictByBalCcyIdx = new TreeMap<CFAccAccountEntryByBalCcyIdxKey, SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>>(); public CFAccRamAccountEntryTable(CFAccRamSchema argSchema) { schema = argSchema; } public void createAccountEntry(CFAccAuthorization Authorization, CFAccAccountEntryBuff Buff) { CFAccAccountEntryPKey pkey = schema.getFactoryAccountEntry().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredAccountId(Buff.getRequiredAccountId()); pkey.setRequiredEntryId(schema.nextAccountEntryIdGen()); Buff.setRequiredTenantId(pkey.getRequiredTenantId()); Buff.setRequiredAccountId(pkey.getRequiredAccountId()); Buff.setRequiredEntryId(pkey.getRequiredEntryId()); CFAccAccountEntryByUEntryIdxKey keyUEntryIdx = schema.getFactoryAccountEntry().newUEntryIdxKey(); keyUEntryIdx.setRequiredEntryId(Buff.getRequiredEntryId()); CFAccAccountEntryByAccTsIdxKey keyAccTsIdx = schema.getFactoryAccountEntry().newAccTsIdxKey(); keyAccTsIdx.setRequiredTenantId(Buff.getRequiredTenantId()); keyAccTsIdx.setRequiredAccountId(Buff.getRequiredAccountId()); keyAccTsIdx.setRequiredEntryStamp(Buff.getRequiredEntryStamp()); CFAccAccountEntryByEStampIdxKey keyEStampIdx = schema.getFactoryAccountEntry().newEStampIdxKey(); keyEStampIdx.setRequiredEntryStamp(Buff.getRequiredEntryStamp()); CFAccAccountEntryBySplitIdxKey keySplitIdx = schema.getFactoryAccountEntry().newSplitIdxKey(); keySplitIdx.setOptionalSplitEntryId(Buff.getOptionalSplitEntryId()); CFAccAccountEntryByTenantIdxKey keyTenantIdx = schema.getFactoryAccountEntry().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId()); CFAccAccountEntryByAcctIdxKey keyAcctIdx = schema.getFactoryAccountEntry().newAcctIdxKey(); keyAcctIdx.setRequiredTenantId(Buff.getRequiredTenantId()); keyAcctIdx.setRequiredAccountId(Buff.getRequiredAccountId()); CFAccAccountEntryByXfrAcctIdxKey keyXfrAcctIdx = schema.getFactoryAccountEntry().newXfrAcctIdxKey(); keyXfrAcctIdx.setOptionalTransferTenantId(Buff.getOptionalTransferTenantId()); keyXfrAcctIdx.setOptionalTransferAccountId(Buff.getOptionalTransferAccountId()); CFAccAccountEntryByDrCcyIdxKey keyDrCcyIdx = schema.getFactoryAccountEntry().newDrCcyIdxKey(); keyDrCcyIdx.setOptionalDebitCurrencyId(Buff.getOptionalDebitCurrencyId()); CFAccAccountEntryByCrCcyIdxKey keyCrCcyIdx = schema.getFactoryAccountEntry().newCrCcyIdxKey(); keyCrCcyIdx.setOptionalCreditCurrencyId(Buff.getOptionalCreditCurrencyId()); CFAccAccountEntryByCvtCcyIdxKey keyCvtCcyIdx = schema.getFactoryAccountEntry().newCvtCcyIdxKey(); keyCvtCcyIdx.setRequiredConvertedCurrencyId(Buff.getRequiredConvertedCurrencyId()); CFAccAccountEntryByBalCcyIdxKey keyBalCcyIdx = schema.getFactoryAccountEntry().newBalCcyIdxKey(); keyBalCcyIdx.setRequiredBalanceCurrencyId(Buff.getRequiredBalanceCurrencyId()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createAccountEntry", pkey); } if (dictByUEntryIdx.containsKey(keyUEntryIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "createAccountEntry", "AccountEntryUEntryIdx", keyUEntryIdx); } // Validate foreign keys { boolean allNull = true; allNull = false; allNull = false; if (!allNull) { if (null == schema.getTableAccount().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredAccountId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "createAccountEntry", "Container", "Account", "Account", null); } } } { boolean allNull = true; allNull = false; if (!allNull) { if (null == schema.getTableTenant().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "createAccountEntry", "Owner", "Tenant", "Tenant", null); } } } { boolean allNull = true; allNull = false; if (!allNull) { if (null == schema.getTableISOCurrency().readDerivedByIdIdx(Authorization, Buff.getRequiredConvertedCurrencyId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "createAccountEntry", "Lookup", "ConvertedCurrency", "ISOCurrency", null); } } } { boolean allNull = true; allNull = false; if (!allNull) { if (null == schema.getTableISOCurrency().readDerivedByIdIdx(Authorization, Buff.getRequiredBalanceCurrencyId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "createAccountEntry", "Lookup", "BalanceCurrency", "ISOCurrency", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); dictByUEntryIdx.put(keyUEntryIdx, Buff); SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictAccTsIdx; if (dictByAccTsIdx.containsKey(keyAccTsIdx)) { subdictAccTsIdx = dictByAccTsIdx.get(keyAccTsIdx); } else { subdictAccTsIdx = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByAccTsIdx.put(keyAccTsIdx, subdictAccTsIdx); } subdictAccTsIdx.put(pkey, Buff); SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictEStampIdx; if (dictByEStampIdx.containsKey(keyEStampIdx)) { subdictEStampIdx = dictByEStampIdx.get(keyEStampIdx); } else { subdictEStampIdx = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByEStampIdx.put(keyEStampIdx, subdictEStampIdx); } subdictEStampIdx.put(pkey, Buff); SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictSplitIdx; if (dictBySplitIdx.containsKey(keySplitIdx)) { subdictSplitIdx = dictBySplitIdx.get(keySplitIdx); } else { subdictSplitIdx = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictBySplitIdx.put(keySplitIdx, subdictSplitIdx); } subdictSplitIdx.put(pkey, Buff); SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictTenantIdx; if (dictByTenantIdx.containsKey(keyTenantIdx)) { subdictTenantIdx = dictByTenantIdx.get(keyTenantIdx); } else { subdictTenantIdx = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByTenantIdx.put(keyTenantIdx, subdictTenantIdx); } subdictTenantIdx.put(pkey, Buff); SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictAcctIdx; if (dictByAcctIdx.containsKey(keyAcctIdx)) { subdictAcctIdx = dictByAcctIdx.get(keyAcctIdx); } else { subdictAcctIdx = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByAcctIdx.put(keyAcctIdx, subdictAcctIdx); } subdictAcctIdx.put(pkey, Buff); SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictXfrAcctIdx; if (dictByXfrAcctIdx.containsKey(keyXfrAcctIdx)) { subdictXfrAcctIdx = dictByXfrAcctIdx.get(keyXfrAcctIdx); } else { subdictXfrAcctIdx = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByXfrAcctIdx.put(keyXfrAcctIdx, subdictXfrAcctIdx); } subdictXfrAcctIdx.put(pkey, Buff); SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictDrCcyIdx; if (dictByDrCcyIdx.containsKey(keyDrCcyIdx)) { subdictDrCcyIdx = dictByDrCcyIdx.get(keyDrCcyIdx); } else { subdictDrCcyIdx = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByDrCcyIdx.put(keyDrCcyIdx, subdictDrCcyIdx); } subdictDrCcyIdx.put(pkey, Buff); SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictCrCcyIdx; if (dictByCrCcyIdx.containsKey(keyCrCcyIdx)) { subdictCrCcyIdx = dictByCrCcyIdx.get(keyCrCcyIdx); } else { subdictCrCcyIdx = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByCrCcyIdx.put(keyCrCcyIdx, subdictCrCcyIdx); } subdictCrCcyIdx.put(pkey, Buff); SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictCvtCcyIdx; if (dictByCvtCcyIdx.containsKey(keyCvtCcyIdx)) { subdictCvtCcyIdx = dictByCvtCcyIdx.get(keyCvtCcyIdx); } else { subdictCvtCcyIdx = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByCvtCcyIdx.put(keyCvtCcyIdx, subdictCvtCcyIdx); } subdictCvtCcyIdx.put(pkey, Buff); SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictBalCcyIdx; if (dictByBalCcyIdx.containsKey(keyBalCcyIdx)) { subdictBalCcyIdx = dictByBalCcyIdx.get(keyBalCcyIdx); } else { subdictBalCcyIdx = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByBalCcyIdx.put(keyBalCcyIdx, subdictBalCcyIdx); } subdictBalCcyIdx.put(pkey, Buff); } public CFAccAccountEntryBuff readDerived(CFAccAuthorization Authorization, CFAccAccountEntryPKey PKey) { final String S_ProcName = "CFAccRamAccountEntry.readDerived() "; CFAccAccountEntryPKey key = schema.getFactoryAccountEntry().newPKey(); key.setRequiredTenantId(PKey.getRequiredTenantId()); key.setRequiredAccountId(PKey.getRequiredAccountId()); key.setRequiredEntryId(PKey.getRequiredEntryId()); CFAccAccountEntryBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAccAccountEntryBuff lockDerived(CFAccAuthorization Authorization, CFAccAccountEntryPKey PKey) { final String S_ProcName = "CFAccRamAccountEntry.readDerived() "; CFAccAccountEntryPKey key = schema.getFactoryAccountEntry().newPKey(); key.setRequiredTenantId(PKey.getRequiredTenantId()); key.setRequiredAccountId(PKey.getRequiredAccountId()); key.setRequiredEntryId(PKey.getRequiredEntryId()); CFAccAccountEntryBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAccAccountEntryBuff[] readAllDerived(CFAccAuthorization Authorization) { final String S_ProcName = "CFAccRamAccountEntry.readAllDerived() "; CFAccAccountEntryBuff[] retList = new CFAccAccountEntryBuff[dictByPKey.values().size()]; Iterator<CFAccAccountEntryBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); } public CFAccAccountEntryBuff readDerivedByUEntryIdx(CFAccAuthorization Authorization, UUID EntryId) { final String S_ProcName = "CFAccRamAccountEntry.readDerivedByUEntryIdx() "; CFAccAccountEntryByUEntryIdxKey key = schema.getFactoryAccountEntry().newUEntryIdxKey(); key.setRequiredEntryId(EntryId); CFAccAccountEntryBuff buff; if (dictByUEntryIdx.containsKey(key)) { buff = dictByUEntryIdx.get(key); } else { buff = null; } return (buff); } public CFAccAccountEntryBuff[] readDerivedByAccTsIdx(CFAccAuthorization Authorization, long TenantId, long AccountId, Calendar EntryStamp) { final String S_ProcName = "CFAccRamAccountEntry.readDerivedByAccTsIdx() "; CFAccAccountEntryByAccTsIdxKey key = schema.getFactoryAccountEntry().newAccTsIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredAccountId(AccountId); key.setRequiredEntryStamp(EntryStamp); CFAccAccountEntryBuff[] recArray; if (dictByAccTsIdx.containsKey(key)) { SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictAccTsIdx = dictByAccTsIdx.get(key); recArray = new CFAccAccountEntryBuff[subdictAccTsIdx.size()]; Iterator<CFAccAccountEntryBuff> iter = subdictAccTsIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAccAccountEntryBuff[0]; } return (recArray); } public CFAccAccountEntryBuff[] readDerivedByEStampIdx(CFAccAuthorization Authorization, Calendar EntryStamp) { final String S_ProcName = "CFAccRamAccountEntry.readDerivedByEStampIdx() "; CFAccAccountEntryByEStampIdxKey key = schema.getFactoryAccountEntry().newEStampIdxKey(); key.setRequiredEntryStamp(EntryStamp); CFAccAccountEntryBuff[] recArray; if (dictByEStampIdx.containsKey(key)) { SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictEStampIdx = dictByEStampIdx.get(key); recArray = new CFAccAccountEntryBuff[subdictEStampIdx.size()]; Iterator<CFAccAccountEntryBuff> iter = subdictEStampIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAccAccountEntryBuff[0]; } return (recArray); } public CFAccAccountEntryBuff[] readDerivedBySplitIdx(CFAccAuthorization Authorization, UUID SplitEntryId) { final String S_ProcName = "CFAccRamAccountEntry.readDerivedBySplitIdx() "; CFAccAccountEntryBySplitIdxKey key = schema.getFactoryAccountEntry().newSplitIdxKey(); key.setOptionalSplitEntryId(SplitEntryId); CFAccAccountEntryBuff[] recArray; if (dictBySplitIdx.containsKey(key)) { SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictSplitIdx = dictBySplitIdx.get(key); recArray = new CFAccAccountEntryBuff[subdictSplitIdx.size()]; Iterator<CFAccAccountEntryBuff> iter = subdictSplitIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAccAccountEntryBuff[0]; } return (recArray); } public CFAccAccountEntryBuff[] readDerivedByTenantIdx(CFAccAuthorization Authorization, long TenantId) { final String S_ProcName = "CFAccRamAccountEntry.readDerivedByTenantIdx() "; CFAccAccountEntryByTenantIdxKey key = schema.getFactoryAccountEntry().newTenantIdxKey(); key.setRequiredTenantId(TenantId); CFAccAccountEntryBuff[] recArray; if (dictByTenantIdx.containsKey(key)) { SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictTenantIdx = dictByTenantIdx.get(key); recArray = new CFAccAccountEntryBuff[subdictTenantIdx.size()]; Iterator<CFAccAccountEntryBuff> iter = subdictTenantIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAccAccountEntryBuff[0]; } return (recArray); } public CFAccAccountEntryBuff[] readDerivedByAcctIdx(CFAccAuthorization Authorization, long TenantId, long AccountId) { final String S_ProcName = "CFAccRamAccountEntry.readDerivedByAcctIdx() "; CFAccAccountEntryByAcctIdxKey key = schema.getFactoryAccountEntry().newAcctIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredAccountId(AccountId); CFAccAccountEntryBuff[] recArray; if (dictByAcctIdx.containsKey(key)) { SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictAcctIdx = dictByAcctIdx.get(key); recArray = new CFAccAccountEntryBuff[subdictAcctIdx.size()]; Iterator<CFAccAccountEntryBuff> iter = subdictAcctIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAccAccountEntryBuff[0]; } return (recArray); } public CFAccAccountEntryBuff[] readDerivedByXfrAcctIdx(CFAccAuthorization Authorization, Long TransferTenantId, Long TransferAccountId) { final String S_ProcName = "CFAccRamAccountEntry.readDerivedByXfrAcctIdx() "; CFAccAccountEntryByXfrAcctIdxKey key = schema.getFactoryAccountEntry().newXfrAcctIdxKey(); key.setOptionalTransferTenantId(TransferTenantId); key.setOptionalTransferAccountId(TransferAccountId); CFAccAccountEntryBuff[] recArray; if (dictByXfrAcctIdx.containsKey(key)) { SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictXfrAcctIdx = dictByXfrAcctIdx.get(key); recArray = new CFAccAccountEntryBuff[subdictXfrAcctIdx.size()]; Iterator<CFAccAccountEntryBuff> iter = subdictXfrAcctIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAccAccountEntryBuff[0]; } return (recArray); } public CFAccAccountEntryBuff[] readDerivedByDrCcyIdx(CFAccAuthorization Authorization, Short DebitCurrencyId) { final String S_ProcName = "CFAccRamAccountEntry.readDerivedByDrCcyIdx() "; CFAccAccountEntryByDrCcyIdxKey key = schema.getFactoryAccountEntry().newDrCcyIdxKey(); key.setOptionalDebitCurrencyId(DebitCurrencyId); CFAccAccountEntryBuff[] recArray; if (dictByDrCcyIdx.containsKey(key)) { SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictDrCcyIdx = dictByDrCcyIdx.get(key); recArray = new CFAccAccountEntryBuff[subdictDrCcyIdx.size()]; Iterator<CFAccAccountEntryBuff> iter = subdictDrCcyIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAccAccountEntryBuff[0]; } return (recArray); } public CFAccAccountEntryBuff[] readDerivedByCrCcyIdx(CFAccAuthorization Authorization, Short CreditCurrencyId) { final String S_ProcName = "CFAccRamAccountEntry.readDerivedByCrCcyIdx() "; CFAccAccountEntryByCrCcyIdxKey key = schema.getFactoryAccountEntry().newCrCcyIdxKey(); key.setOptionalCreditCurrencyId(CreditCurrencyId); CFAccAccountEntryBuff[] recArray; if (dictByCrCcyIdx.containsKey(key)) { SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictCrCcyIdx = dictByCrCcyIdx.get(key); recArray = new CFAccAccountEntryBuff[subdictCrCcyIdx.size()]; Iterator<CFAccAccountEntryBuff> iter = subdictCrCcyIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAccAccountEntryBuff[0]; } return (recArray); } public CFAccAccountEntryBuff[] readDerivedByCvtCcyIdx(CFAccAuthorization Authorization, short ConvertedCurrencyId) { final String S_ProcName = "CFAccRamAccountEntry.readDerivedByCvtCcyIdx() "; CFAccAccountEntryByCvtCcyIdxKey key = schema.getFactoryAccountEntry().newCvtCcyIdxKey(); key.setRequiredConvertedCurrencyId(ConvertedCurrencyId); CFAccAccountEntryBuff[] recArray; if (dictByCvtCcyIdx.containsKey(key)) { SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictCvtCcyIdx = dictByCvtCcyIdx.get(key); recArray = new CFAccAccountEntryBuff[subdictCvtCcyIdx.size()]; Iterator<CFAccAccountEntryBuff> iter = subdictCvtCcyIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAccAccountEntryBuff[0]; } return (recArray); } public CFAccAccountEntryBuff[] readDerivedByBalCcyIdx(CFAccAuthorization Authorization, short BalanceCurrencyId) { final String S_ProcName = "CFAccRamAccountEntry.readDerivedByBalCcyIdx() "; CFAccAccountEntryByBalCcyIdxKey key = schema.getFactoryAccountEntry().newBalCcyIdxKey(); key.setRequiredBalanceCurrencyId(BalanceCurrencyId); CFAccAccountEntryBuff[] recArray; if (dictByBalCcyIdx.containsKey(key)) { SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictBalCcyIdx = dictByBalCcyIdx.get(key); recArray = new CFAccAccountEntryBuff[subdictBalCcyIdx.size()]; Iterator<CFAccAccountEntryBuff> iter = subdictBalCcyIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAccAccountEntryBuff[0]; } return (recArray); } public CFAccAccountEntryBuff readDerivedByIdIdx(CFAccAuthorization Authorization, long TenantId, long AccountId, UUID EntryId) { final String S_ProcName = "CFAccRamAccountEntry.readDerivedByIdIdx() "; CFAccAccountEntryPKey key = schema.getFactoryAccountEntry().newPKey(); key.setRequiredTenantId(TenantId); key.setRequiredAccountId(AccountId); key.setRequiredEntryId(EntryId); CFAccAccountEntryBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAccAccountEntryBuff readBuff(CFAccAuthorization Authorization, CFAccAccountEntryPKey PKey) { final String S_ProcName = "CFAccRamAccountEntry.readBuff() "; CFAccAccountEntryBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("ACNY"))) { buff = null; } return (buff); } public CFAccAccountEntryBuff lockBuff(CFAccAuthorization Authorization, CFAccAccountEntryPKey PKey) { final String S_ProcName = "CFAccRamAccountEntry.readBuff() "; CFAccAccountEntryBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("ACNY"))) { buff = null; } return (buff); } public CFAccAccountEntryBuff[] readAllBuff(CFAccAuthorization Authorization) { final String S_ProcName = "CFAccRamAccountEntry.readAllBuff() "; CFAccAccountEntryBuff buff; ArrayList<CFAccAccountEntryBuff> filteredList = new ArrayList<CFAccAccountEntryBuff>(); CFAccAccountEntryBuff[] buffList = readAllDerived(Authorization); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ACNY")) { filteredList.add(buff); } } return (filteredList.toArray(new CFAccAccountEntryBuff[0])); } public CFAccAccountEntryBuff readBuffByIdIdx(CFAccAuthorization Authorization, long TenantId, long AccountId, UUID EntryId) { final String S_ProcName = "CFAccRamAccountEntry.readBuffByIdIdx() "; CFAccAccountEntryBuff buff = readDerivedByIdIdx(Authorization, TenantId, AccountId, EntryId); if ((buff != null) && buff.getClassCode().equals("ACNY")) { return ((CFAccAccountEntryBuff) buff); } else { return (null); } } public CFAccAccountEntryBuff readBuffByUEntryIdx(CFAccAuthorization Authorization, UUID EntryId) { final String S_ProcName = "CFAccRamAccountEntry.readBuffByUEntryIdx() "; CFAccAccountEntryBuff buff = readDerivedByUEntryIdx(Authorization, EntryId); if ((buff != null) && buff.getClassCode().equals("ACNY")) { return ((CFAccAccountEntryBuff) buff); } else { return (null); } } public CFAccAccountEntryBuff[] readBuffByAccTsIdx(CFAccAuthorization Authorization, long TenantId, long AccountId, Calendar EntryStamp) { final String S_ProcName = "CFAccRamAccountEntry.readBuffByAccTsIdx() "; CFAccAccountEntryBuff buff; ArrayList<CFAccAccountEntryBuff> filteredList = new ArrayList<CFAccAccountEntryBuff>(); CFAccAccountEntryBuff[] buffList = readDerivedByAccTsIdx(Authorization, TenantId, AccountId, EntryStamp); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ACNY")) { filteredList.add((CFAccAccountEntryBuff) buff); } } return (filteredList.toArray(new CFAccAccountEntryBuff[0])); } public CFAccAccountEntryBuff[] readBuffByEStampIdx(CFAccAuthorization Authorization, Calendar EntryStamp) { final String S_ProcName = "CFAccRamAccountEntry.readBuffByEStampIdx() "; CFAccAccountEntryBuff buff; ArrayList<CFAccAccountEntryBuff> filteredList = new ArrayList<CFAccAccountEntryBuff>(); CFAccAccountEntryBuff[] buffList = readDerivedByEStampIdx(Authorization, EntryStamp); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ACNY")) { filteredList.add((CFAccAccountEntryBuff) buff); } } return (filteredList.toArray(new CFAccAccountEntryBuff[0])); } public CFAccAccountEntryBuff[] readBuffBySplitIdx(CFAccAuthorization Authorization, UUID SplitEntryId) { final String S_ProcName = "CFAccRamAccountEntry.readBuffBySplitIdx() "; CFAccAccountEntryBuff buff; ArrayList<CFAccAccountEntryBuff> filteredList = new ArrayList<CFAccAccountEntryBuff>(); CFAccAccountEntryBuff[] buffList = readDerivedBySplitIdx(Authorization, SplitEntryId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ACNY")) { filteredList.add((CFAccAccountEntryBuff) buff); } } return (filteredList.toArray(new CFAccAccountEntryBuff[0])); } public CFAccAccountEntryBuff[] readBuffByTenantIdx(CFAccAuthorization Authorization, long TenantId) { final String S_ProcName = "CFAccRamAccountEntry.readBuffByTenantIdx() "; CFAccAccountEntryBuff buff; ArrayList<CFAccAccountEntryBuff> filteredList = new ArrayList<CFAccAccountEntryBuff>(); CFAccAccountEntryBuff[] buffList = readDerivedByTenantIdx(Authorization, TenantId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ACNY")) { filteredList.add((CFAccAccountEntryBuff) buff); } } return (filteredList.toArray(new CFAccAccountEntryBuff[0])); } public CFAccAccountEntryBuff[] readBuffByAcctIdx(CFAccAuthorization Authorization, long TenantId, long AccountId) { final String S_ProcName = "CFAccRamAccountEntry.readBuffByAcctIdx() "; CFAccAccountEntryBuff buff; ArrayList<CFAccAccountEntryBuff> filteredList = new ArrayList<CFAccAccountEntryBuff>(); CFAccAccountEntryBuff[] buffList = readDerivedByAcctIdx(Authorization, TenantId, AccountId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ACNY")) { filteredList.add((CFAccAccountEntryBuff) buff); } } return (filteredList.toArray(new CFAccAccountEntryBuff[0])); } public CFAccAccountEntryBuff[] readBuffByXfrAcctIdx(CFAccAuthorization Authorization, Long TransferTenantId, Long TransferAccountId) { final String S_ProcName = "CFAccRamAccountEntry.readBuffByXfrAcctIdx() "; CFAccAccountEntryBuff buff; ArrayList<CFAccAccountEntryBuff> filteredList = new ArrayList<CFAccAccountEntryBuff>(); CFAccAccountEntryBuff[] buffList = readDerivedByXfrAcctIdx(Authorization, TransferTenantId, TransferAccountId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ACNY")) { filteredList.add((CFAccAccountEntryBuff) buff); } } return (filteredList.toArray(new CFAccAccountEntryBuff[0])); } public CFAccAccountEntryBuff[] readBuffByDrCcyIdx(CFAccAuthorization Authorization, Short DebitCurrencyId) { final String S_ProcName = "CFAccRamAccountEntry.readBuffByDrCcyIdx() "; CFAccAccountEntryBuff buff; ArrayList<CFAccAccountEntryBuff> filteredList = new ArrayList<CFAccAccountEntryBuff>(); CFAccAccountEntryBuff[] buffList = readDerivedByDrCcyIdx(Authorization, DebitCurrencyId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ACNY")) { filteredList.add((CFAccAccountEntryBuff) buff); } } return (filteredList.toArray(new CFAccAccountEntryBuff[0])); } public CFAccAccountEntryBuff[] readBuffByCrCcyIdx(CFAccAuthorization Authorization, Short CreditCurrencyId) { final String S_ProcName = "CFAccRamAccountEntry.readBuffByCrCcyIdx() "; CFAccAccountEntryBuff buff; ArrayList<CFAccAccountEntryBuff> filteredList = new ArrayList<CFAccAccountEntryBuff>(); CFAccAccountEntryBuff[] buffList = readDerivedByCrCcyIdx(Authorization, CreditCurrencyId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ACNY")) { filteredList.add((CFAccAccountEntryBuff) buff); } } return (filteredList.toArray(new CFAccAccountEntryBuff[0])); } public CFAccAccountEntryBuff[] readBuffByCvtCcyIdx(CFAccAuthorization Authorization, short ConvertedCurrencyId) { final String S_ProcName = "CFAccRamAccountEntry.readBuffByCvtCcyIdx() "; CFAccAccountEntryBuff buff; ArrayList<CFAccAccountEntryBuff> filteredList = new ArrayList<CFAccAccountEntryBuff>(); CFAccAccountEntryBuff[] buffList = readDerivedByCvtCcyIdx(Authorization, ConvertedCurrencyId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ACNY")) { filteredList.add((CFAccAccountEntryBuff) buff); } } return (filteredList.toArray(new CFAccAccountEntryBuff[0])); } public CFAccAccountEntryBuff[] readBuffByBalCcyIdx(CFAccAuthorization Authorization, short BalanceCurrencyId) { final String S_ProcName = "CFAccRamAccountEntry.readBuffByBalCcyIdx() "; CFAccAccountEntryBuff buff; ArrayList<CFAccAccountEntryBuff> filteredList = new ArrayList<CFAccAccountEntryBuff>(); CFAccAccountEntryBuff[] buffList = readDerivedByBalCcyIdx(Authorization, BalanceCurrencyId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ACNY")) { filteredList.add((CFAccAccountEntryBuff) buff); } } return (filteredList.toArray(new CFAccAccountEntryBuff[0])); } public void updateAccountEntry(CFAccAuthorization Authorization, CFAccAccountEntryBuff Buff) { CFAccAccountEntryPKey pkey = schema.getFactoryAccountEntry().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredAccountId(Buff.getRequiredAccountId()); pkey.setRequiredEntryId(Buff.getRequiredEntryId()); CFAccAccountEntryBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateAccountEntry", "Existing record not found", "AccountEntry", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateAccountEntry", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFAccAccountEntryByUEntryIdxKey existingKeyUEntryIdx = schema.getFactoryAccountEntry().newUEntryIdxKey(); existingKeyUEntryIdx.setRequiredEntryId(existing.getRequiredEntryId()); CFAccAccountEntryByUEntryIdxKey newKeyUEntryIdx = schema.getFactoryAccountEntry().newUEntryIdxKey(); newKeyUEntryIdx.setRequiredEntryId(Buff.getRequiredEntryId()); CFAccAccountEntryByAccTsIdxKey existingKeyAccTsIdx = schema.getFactoryAccountEntry().newAccTsIdxKey(); existingKeyAccTsIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyAccTsIdx.setRequiredAccountId(existing.getRequiredAccountId()); existingKeyAccTsIdx.setRequiredEntryStamp(existing.getRequiredEntryStamp()); CFAccAccountEntryByAccTsIdxKey newKeyAccTsIdx = schema.getFactoryAccountEntry().newAccTsIdxKey(); newKeyAccTsIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyAccTsIdx.setRequiredAccountId(Buff.getRequiredAccountId()); newKeyAccTsIdx.setRequiredEntryStamp(Buff.getRequiredEntryStamp()); CFAccAccountEntryByEStampIdxKey existingKeyEStampIdx = schema.getFactoryAccountEntry().newEStampIdxKey(); existingKeyEStampIdx.setRequiredEntryStamp(existing.getRequiredEntryStamp()); CFAccAccountEntryByEStampIdxKey newKeyEStampIdx = schema.getFactoryAccountEntry().newEStampIdxKey(); newKeyEStampIdx.setRequiredEntryStamp(Buff.getRequiredEntryStamp()); CFAccAccountEntryBySplitIdxKey existingKeySplitIdx = schema.getFactoryAccountEntry().newSplitIdxKey(); existingKeySplitIdx.setOptionalSplitEntryId(existing.getOptionalSplitEntryId()); CFAccAccountEntryBySplitIdxKey newKeySplitIdx = schema.getFactoryAccountEntry().newSplitIdxKey(); newKeySplitIdx.setOptionalSplitEntryId(Buff.getOptionalSplitEntryId()); CFAccAccountEntryByTenantIdxKey existingKeyTenantIdx = schema.getFactoryAccountEntry().newTenantIdxKey(); existingKeyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId()); CFAccAccountEntryByTenantIdxKey newKeyTenantIdx = schema.getFactoryAccountEntry().newTenantIdxKey(); newKeyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId()); CFAccAccountEntryByAcctIdxKey existingKeyAcctIdx = schema.getFactoryAccountEntry().newAcctIdxKey(); existingKeyAcctIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyAcctIdx.setRequiredAccountId(existing.getRequiredAccountId()); CFAccAccountEntryByAcctIdxKey newKeyAcctIdx = schema.getFactoryAccountEntry().newAcctIdxKey(); newKeyAcctIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyAcctIdx.setRequiredAccountId(Buff.getRequiredAccountId()); CFAccAccountEntryByXfrAcctIdxKey existingKeyXfrAcctIdx = schema.getFactoryAccountEntry().newXfrAcctIdxKey(); existingKeyXfrAcctIdx.setOptionalTransferTenantId(existing.getOptionalTransferTenantId()); existingKeyXfrAcctIdx.setOptionalTransferAccountId(existing.getOptionalTransferAccountId()); CFAccAccountEntryByXfrAcctIdxKey newKeyXfrAcctIdx = schema.getFactoryAccountEntry().newXfrAcctIdxKey(); newKeyXfrAcctIdx.setOptionalTransferTenantId(Buff.getOptionalTransferTenantId()); newKeyXfrAcctIdx.setOptionalTransferAccountId(Buff.getOptionalTransferAccountId()); CFAccAccountEntryByDrCcyIdxKey existingKeyDrCcyIdx = schema.getFactoryAccountEntry().newDrCcyIdxKey(); existingKeyDrCcyIdx.setOptionalDebitCurrencyId(existing.getOptionalDebitCurrencyId()); CFAccAccountEntryByDrCcyIdxKey newKeyDrCcyIdx = schema.getFactoryAccountEntry().newDrCcyIdxKey(); newKeyDrCcyIdx.setOptionalDebitCurrencyId(Buff.getOptionalDebitCurrencyId()); CFAccAccountEntryByCrCcyIdxKey existingKeyCrCcyIdx = schema.getFactoryAccountEntry().newCrCcyIdxKey(); existingKeyCrCcyIdx.setOptionalCreditCurrencyId(existing.getOptionalCreditCurrencyId()); CFAccAccountEntryByCrCcyIdxKey newKeyCrCcyIdx = schema.getFactoryAccountEntry().newCrCcyIdxKey(); newKeyCrCcyIdx.setOptionalCreditCurrencyId(Buff.getOptionalCreditCurrencyId()); CFAccAccountEntryByCvtCcyIdxKey existingKeyCvtCcyIdx = schema.getFactoryAccountEntry().newCvtCcyIdxKey(); existingKeyCvtCcyIdx.setRequiredConvertedCurrencyId(existing.getRequiredConvertedCurrencyId()); CFAccAccountEntryByCvtCcyIdxKey newKeyCvtCcyIdx = schema.getFactoryAccountEntry().newCvtCcyIdxKey(); newKeyCvtCcyIdx.setRequiredConvertedCurrencyId(Buff.getRequiredConvertedCurrencyId()); CFAccAccountEntryByBalCcyIdxKey existingKeyBalCcyIdx = schema.getFactoryAccountEntry().newBalCcyIdxKey(); existingKeyBalCcyIdx.setRequiredBalanceCurrencyId(existing.getRequiredBalanceCurrencyId()); CFAccAccountEntryByBalCcyIdxKey newKeyBalCcyIdx = schema.getFactoryAccountEntry().newBalCcyIdxKey(); newKeyBalCcyIdx.setRequiredBalanceCurrencyId(Buff.getRequiredBalanceCurrencyId()); // Check unique indexes if (!existingKeyUEntryIdx.equals(newKeyUEntryIdx)) { if (dictByUEntryIdx.containsKey(newKeyUEntryIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateAccountEntry", "AccountEntryUEntryIdx", newKeyUEntryIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableAccount().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredAccountId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateAccountEntry", "Container", "Account", "Account", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableTenant().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateAccountEntry", "Owner", "Tenant", "Tenant", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableISOCurrency().readDerivedByIdIdx(Authorization, Buff.getRequiredConvertedCurrencyId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateAccountEntry", "Lookup", "ConvertedCurrency", "ISOCurrency", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableISOCurrency().readDerivedByIdIdx(Authorization, Buff.getRequiredBalanceCurrencyId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateAccountEntry", "Lookup", "BalanceCurrency", "ISOCurrency", null); } } } // Update is valid SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); dictByUEntryIdx.remove(existingKeyUEntryIdx); dictByUEntryIdx.put(newKeyUEntryIdx, Buff); subdict = dictByAccTsIdx.get(existingKeyAccTsIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByAccTsIdx.containsKey(newKeyAccTsIdx)) { subdict = dictByAccTsIdx.get(newKeyAccTsIdx); } else { subdict = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByAccTsIdx.put(newKeyAccTsIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByEStampIdx.get(existingKeyEStampIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByEStampIdx.containsKey(newKeyEStampIdx)) { subdict = dictByEStampIdx.get(newKeyEStampIdx); } else { subdict = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByEStampIdx.put(newKeyEStampIdx, subdict); } subdict.put(pkey, Buff); subdict = dictBySplitIdx.get(existingKeySplitIdx); if (subdict != null) { subdict.remove(pkey); } if (dictBySplitIdx.containsKey(newKeySplitIdx)) { subdict = dictBySplitIdx.get(newKeySplitIdx); } else { subdict = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictBySplitIdx.put(newKeySplitIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByTenantIdx.get(existingKeyTenantIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByTenantIdx.containsKey(newKeyTenantIdx)) { subdict = dictByTenantIdx.get(newKeyTenantIdx); } else { subdict = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByTenantIdx.put(newKeyTenantIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByAcctIdx.get(existingKeyAcctIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByAcctIdx.containsKey(newKeyAcctIdx)) { subdict = dictByAcctIdx.get(newKeyAcctIdx); } else { subdict = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByAcctIdx.put(newKeyAcctIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByXfrAcctIdx.get(existingKeyXfrAcctIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByXfrAcctIdx.containsKey(newKeyXfrAcctIdx)) { subdict = dictByXfrAcctIdx.get(newKeyXfrAcctIdx); } else { subdict = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByXfrAcctIdx.put(newKeyXfrAcctIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByDrCcyIdx.get(existingKeyDrCcyIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByDrCcyIdx.containsKey(newKeyDrCcyIdx)) { subdict = dictByDrCcyIdx.get(newKeyDrCcyIdx); } else { subdict = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByDrCcyIdx.put(newKeyDrCcyIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByCrCcyIdx.get(existingKeyCrCcyIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByCrCcyIdx.containsKey(newKeyCrCcyIdx)) { subdict = dictByCrCcyIdx.get(newKeyCrCcyIdx); } else { subdict = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByCrCcyIdx.put(newKeyCrCcyIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByCvtCcyIdx.get(existingKeyCvtCcyIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByCvtCcyIdx.containsKey(newKeyCvtCcyIdx)) { subdict = dictByCvtCcyIdx.get(newKeyCvtCcyIdx); } else { subdict = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByCvtCcyIdx.put(newKeyCvtCcyIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByBalCcyIdx.get(existingKeyBalCcyIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByBalCcyIdx.containsKey(newKeyBalCcyIdx)) { subdict = dictByBalCcyIdx.get(newKeyBalCcyIdx); } else { subdict = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByBalCcyIdx.put(newKeyBalCcyIdx, subdict); } subdict.put(pkey, Buff); } public void deleteAccountEntry(CFAccAuthorization Authorization, CFAccAccountEntryBuff Buff) { final String S_ProcName = "CFAccRamAccountEntryTable.deleteAccountEntry() "; CFAccAccountEntryPKey pkey = schema.getFactoryAccountEntry().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredAccountId(Buff.getRequiredAccountId()); pkey.setRequiredEntryId(Buff.getRequiredEntryId()); CFAccAccountEntryBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteAccountEntry", pkey); } CFAccAccountEntryByUEntryIdxKey keyUEntryIdx = schema.getFactoryAccountEntry().newUEntryIdxKey(); keyUEntryIdx.setRequiredEntryId(existing.getRequiredEntryId()); CFAccAccountEntryByAccTsIdxKey keyAccTsIdx = schema.getFactoryAccountEntry().newAccTsIdxKey(); keyAccTsIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyAccTsIdx.setRequiredAccountId(existing.getRequiredAccountId()); keyAccTsIdx.setRequiredEntryStamp(existing.getRequiredEntryStamp()); CFAccAccountEntryByEStampIdxKey keyEStampIdx = schema.getFactoryAccountEntry().newEStampIdxKey(); keyEStampIdx.setRequiredEntryStamp(existing.getRequiredEntryStamp()); CFAccAccountEntryBySplitIdxKey keySplitIdx = schema.getFactoryAccountEntry().newSplitIdxKey(); keySplitIdx.setOptionalSplitEntryId(existing.getOptionalSplitEntryId()); CFAccAccountEntryByTenantIdxKey keyTenantIdx = schema.getFactoryAccountEntry().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId()); CFAccAccountEntryByAcctIdxKey keyAcctIdx = schema.getFactoryAccountEntry().newAcctIdxKey(); keyAcctIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyAcctIdx.setRequiredAccountId(existing.getRequiredAccountId()); CFAccAccountEntryByXfrAcctIdxKey keyXfrAcctIdx = schema.getFactoryAccountEntry().newXfrAcctIdxKey(); keyXfrAcctIdx.setOptionalTransferTenantId(existing.getOptionalTransferTenantId()); keyXfrAcctIdx.setOptionalTransferAccountId(existing.getOptionalTransferAccountId()); CFAccAccountEntryByDrCcyIdxKey keyDrCcyIdx = schema.getFactoryAccountEntry().newDrCcyIdxKey(); keyDrCcyIdx.setOptionalDebitCurrencyId(existing.getOptionalDebitCurrencyId()); CFAccAccountEntryByCrCcyIdxKey keyCrCcyIdx = schema.getFactoryAccountEntry().newCrCcyIdxKey(); keyCrCcyIdx.setOptionalCreditCurrencyId(existing.getOptionalCreditCurrencyId()); CFAccAccountEntryByCvtCcyIdxKey keyCvtCcyIdx = schema.getFactoryAccountEntry().newCvtCcyIdxKey(); keyCvtCcyIdx.setRequiredConvertedCurrencyId(existing.getRequiredConvertedCurrencyId()); CFAccAccountEntryByBalCcyIdxKey keyBalCcyIdx = schema.getFactoryAccountEntry().newBalCcyIdxKey(); keyBalCcyIdx.setRequiredBalanceCurrencyId(existing.getRequiredBalanceCurrencyId()); // Validate reverse foreign keys // Delete is valid SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdict; dictByPKey.remove(pkey); dictByUEntryIdx.remove(keyUEntryIdx); subdict = dictByAccTsIdx.get(keyAccTsIdx); subdict.remove(pkey); subdict = dictByEStampIdx.get(keyEStampIdx); subdict.remove(pkey); subdict = dictBySplitIdx.get(keySplitIdx); subdict.remove(pkey); subdict = dictByTenantIdx.get(keyTenantIdx); subdict.remove(pkey); subdict = dictByAcctIdx.get(keyAcctIdx); subdict.remove(pkey); subdict = dictByXfrAcctIdx.get(keyXfrAcctIdx); subdict.remove(pkey); subdict = dictByDrCcyIdx.get(keyDrCcyIdx); subdict.remove(pkey); subdict = dictByCrCcyIdx.get(keyCrCcyIdx); subdict.remove(pkey); subdict = dictByCvtCcyIdx.get(keyCvtCcyIdx); subdict.remove(pkey); subdict = dictByBalCcyIdx.get(keyBalCcyIdx); subdict.remove(pkey); } public void deleteAccountEntryByIdIdx(CFAccAuthorization Authorization, long argTenantId, long argAccountId, UUID argEntryId) { CFAccAccountEntryPKey key = schema.getFactoryAccountEntry().newPKey(); key.setRequiredTenantId(argTenantId); key.setRequiredAccountId(argAccountId); key.setRequiredEntryId(argEntryId); deleteAccountEntryByIdIdx(Authorization, key); } public void deleteAccountEntryByIdIdx(CFAccAuthorization Authorization, CFAccAccountEntryPKey argKey) { CFAccAccountEntryBuff cur; LinkedList<CFAccAccountEntryBuff> matchSet = new LinkedList<CFAccAccountEntryBuff>(); Iterator<CFAccAccountEntryBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAccAccountEntryBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteAccountEntry(Authorization, cur); } } public void deleteAccountEntryByUEntryIdx(CFAccAuthorization Authorization, UUID argEntryId) { CFAccAccountEntryByUEntryIdxKey key = schema.getFactoryAccountEntry().newUEntryIdxKey(); key.setRequiredEntryId(argEntryId); deleteAccountEntryByUEntryIdx(Authorization, key); } public void deleteAccountEntryByUEntryIdx(CFAccAuthorization Authorization, CFAccAccountEntryByUEntryIdxKey argKey) { CFAccAccountEntryBuff cur; LinkedList<CFAccAccountEntryBuff> matchSet = new LinkedList<CFAccAccountEntryBuff>(); Iterator<CFAccAccountEntryBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAccAccountEntryBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteAccountEntry(Authorization, cur); } } public void deleteAccountEntryByAccTsIdx(CFAccAuthorization Authorization, long argTenantId, long argAccountId, Calendar argEntryStamp) { CFAccAccountEntryByAccTsIdxKey key = schema.getFactoryAccountEntry().newAccTsIdxKey(); key.setRequiredTenantId(argTenantId); key.setRequiredAccountId(argAccountId); key.setRequiredEntryStamp(argEntryStamp); deleteAccountEntryByAccTsIdx(Authorization, key); } public void deleteAccountEntryByAccTsIdx(CFAccAuthorization Authorization, CFAccAccountEntryByAccTsIdxKey argKey) { CFAccAccountEntryBuff cur; LinkedList<CFAccAccountEntryBuff> matchSet = new LinkedList<CFAccAccountEntryBuff>(); Iterator<CFAccAccountEntryBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAccAccountEntryBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteAccountEntry(Authorization, cur); } } public void deleteAccountEntryByEStampIdx(CFAccAuthorization Authorization, Calendar argEntryStamp) { CFAccAccountEntryByEStampIdxKey key = schema.getFactoryAccountEntry().newEStampIdxKey(); key.setRequiredEntryStamp(argEntryStamp); deleteAccountEntryByEStampIdx(Authorization, key); } public void deleteAccountEntryByEStampIdx(CFAccAuthorization Authorization, CFAccAccountEntryByEStampIdxKey argKey) { CFAccAccountEntryBuff cur; LinkedList<CFAccAccountEntryBuff> matchSet = new LinkedList<CFAccAccountEntryBuff>(); Iterator<CFAccAccountEntryBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAccAccountEntryBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteAccountEntry(Authorization, cur); } } public void deleteAccountEntryBySplitIdx(CFAccAuthorization Authorization, UUID argSplitEntryId) { CFAccAccountEntryBySplitIdxKey key = schema.getFactoryAccountEntry().newSplitIdxKey(); key.setOptionalSplitEntryId(argSplitEntryId); deleteAccountEntryBySplitIdx(Authorization, key); } public void deleteAccountEntryBySplitIdx(CFAccAuthorization Authorization, CFAccAccountEntryBySplitIdxKey argKey) { CFAccAccountEntryBuff cur; LinkedList<CFAccAccountEntryBuff> matchSet = new LinkedList<CFAccAccountEntryBuff>(); Iterator<CFAccAccountEntryBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAccAccountEntryBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteAccountEntry(Authorization, cur); } } public void deleteAccountEntryByTenantIdx(CFAccAuthorization Authorization, long argTenantId) { CFAccAccountEntryByTenantIdxKey key = schema.getFactoryAccountEntry().newTenantIdxKey(); key.setRequiredTenantId(argTenantId); deleteAccountEntryByTenantIdx(Authorization, key); } public void deleteAccountEntryByTenantIdx(CFAccAuthorization Authorization, CFAccAccountEntryByTenantIdxKey argKey) { CFAccAccountEntryBuff cur; LinkedList<CFAccAccountEntryBuff> matchSet = new LinkedList<CFAccAccountEntryBuff>(); Iterator<CFAccAccountEntryBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAccAccountEntryBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteAccountEntry(Authorization, cur); } } public void deleteAccountEntryByAcctIdx(CFAccAuthorization Authorization, long argTenantId, long argAccountId) { CFAccAccountEntryByAcctIdxKey key = schema.getFactoryAccountEntry().newAcctIdxKey(); key.setRequiredTenantId(argTenantId); key.setRequiredAccountId(argAccountId); deleteAccountEntryByAcctIdx(Authorization, key); } public void deleteAccountEntryByAcctIdx(CFAccAuthorization Authorization, CFAccAccountEntryByAcctIdxKey argKey) { CFAccAccountEntryBuff cur; LinkedList<CFAccAccountEntryBuff> matchSet = new LinkedList<CFAccAccountEntryBuff>(); Iterator<CFAccAccountEntryBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAccAccountEntryBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteAccountEntry(Authorization, cur); } } public void deleteAccountEntryByXfrAcctIdx(CFAccAuthorization Authorization, Long argTransferTenantId, Long argTransferAccountId) { CFAccAccountEntryByXfrAcctIdxKey key = schema.getFactoryAccountEntry().newXfrAcctIdxKey(); key.setOptionalTransferTenantId(argTransferTenantId); key.setOptionalTransferAccountId(argTransferAccountId); deleteAccountEntryByXfrAcctIdx(Authorization, key); } public void deleteAccountEntryByXfrAcctIdx(CFAccAuthorization Authorization, CFAccAccountEntryByXfrAcctIdxKey argKey) { CFAccAccountEntryBuff cur; LinkedList<CFAccAccountEntryBuff> matchSet = new LinkedList<CFAccAccountEntryBuff>(); Iterator<CFAccAccountEntryBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAccAccountEntryBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteAccountEntry(Authorization, cur); } } public void deleteAccountEntryByDrCcyIdx(CFAccAuthorization Authorization, Short argDebitCurrencyId) { CFAccAccountEntryByDrCcyIdxKey key = schema.getFactoryAccountEntry().newDrCcyIdxKey(); key.setOptionalDebitCurrencyId(argDebitCurrencyId); deleteAccountEntryByDrCcyIdx(Authorization, key); } public void deleteAccountEntryByDrCcyIdx(CFAccAuthorization Authorization, CFAccAccountEntryByDrCcyIdxKey argKey) { CFAccAccountEntryBuff cur; LinkedList<CFAccAccountEntryBuff> matchSet = new LinkedList<CFAccAccountEntryBuff>(); Iterator<CFAccAccountEntryBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAccAccountEntryBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteAccountEntry(Authorization, cur); } } public void deleteAccountEntryByCrCcyIdx(CFAccAuthorization Authorization, Short argCreditCurrencyId) { CFAccAccountEntryByCrCcyIdxKey key = schema.getFactoryAccountEntry().newCrCcyIdxKey(); key.setOptionalCreditCurrencyId(argCreditCurrencyId); deleteAccountEntryByCrCcyIdx(Authorization, key); } public void deleteAccountEntryByCrCcyIdx(CFAccAuthorization Authorization, CFAccAccountEntryByCrCcyIdxKey argKey) { CFAccAccountEntryBuff cur; LinkedList<CFAccAccountEntryBuff> matchSet = new LinkedList<CFAccAccountEntryBuff>(); Iterator<CFAccAccountEntryBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAccAccountEntryBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteAccountEntry(Authorization, cur); } } public void deleteAccountEntryByCvtCcyIdx(CFAccAuthorization Authorization, short argConvertedCurrencyId) { CFAccAccountEntryByCvtCcyIdxKey key = schema.getFactoryAccountEntry().newCvtCcyIdxKey(); key.setRequiredConvertedCurrencyId(argConvertedCurrencyId); deleteAccountEntryByCvtCcyIdx(Authorization, key); } public void deleteAccountEntryByCvtCcyIdx(CFAccAuthorization Authorization, CFAccAccountEntryByCvtCcyIdxKey argKey) { CFAccAccountEntryBuff cur; LinkedList<CFAccAccountEntryBuff> matchSet = new LinkedList<CFAccAccountEntryBuff>(); Iterator<CFAccAccountEntryBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAccAccountEntryBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteAccountEntry(Authorization, cur); } } public void deleteAccountEntryByBalCcyIdx(CFAccAuthorization Authorization, short argBalanceCurrencyId) { CFAccAccountEntryByBalCcyIdxKey key = schema.getFactoryAccountEntry().newBalCcyIdxKey(); key.setRequiredBalanceCurrencyId(argBalanceCurrencyId); deleteAccountEntryByBalCcyIdx(Authorization, key); } public void deleteAccountEntryByBalCcyIdx(CFAccAuthorization Authorization, CFAccAccountEntryByBalCcyIdxKey argKey) { CFAccAccountEntryBuff cur; LinkedList<CFAccAccountEntryBuff> matchSet = new LinkedList<CFAccAccountEntryBuff>(); Iterator<CFAccAccountEntryBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAccAccountEntryBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteAccountEntry(Authorization, cur); } } public CFAccCursor openAccountEntryCursorAll(CFAccAuthorization Authorization) { CFAccCursor cursor = new CFAccRamAccountEntryCursor(Authorization, schema, dictByPKey.values()); return (cursor); } public CFAccCursor openAccountEntryCursorByAccTsIdx(CFAccAuthorization Authorization, long TenantId, long AccountId, Calendar EntryStamp) { CFAccCursor cursor; CFAccAccountEntryByAccTsIdxKey key = schema.getFactoryAccountEntry().newAccTsIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredAccountId(AccountId); key.setRequiredEntryStamp(EntryStamp); if (dictByAccTsIdx.containsKey(key)) { SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictAccTsIdx = dictByAccTsIdx.get(key); cursor = new CFAccRamAccountEntryCursor(Authorization, schema, subdictAccTsIdx.values()); } else { cursor = new CFAccRamAccountEntryCursor(Authorization, schema, new ArrayList<CFAccAccountEntryBuff>()); } return (cursor); } public CFAccCursor openAccountEntryCursorByEStampIdx(CFAccAuthorization Authorization, Calendar EntryStamp) { CFAccCursor cursor; CFAccAccountEntryByEStampIdxKey key = schema.getFactoryAccountEntry().newEStampIdxKey(); key.setRequiredEntryStamp(EntryStamp); if (dictByEStampIdx.containsKey(key)) { SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictEStampIdx = dictByEStampIdx.get(key); cursor = new CFAccRamAccountEntryCursor(Authorization, schema, subdictEStampIdx.values()); } else { cursor = new CFAccRamAccountEntryCursor(Authorization, schema, new ArrayList<CFAccAccountEntryBuff>()); } return (cursor); } public CFAccCursor openAccountEntryCursorBySplitIdx(CFAccAuthorization Authorization, UUID SplitEntryId) { CFAccCursor cursor; CFAccAccountEntryBySplitIdxKey key = schema.getFactoryAccountEntry().newSplitIdxKey(); key.setOptionalSplitEntryId(SplitEntryId); if (dictBySplitIdx.containsKey(key)) { SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictSplitIdx = dictBySplitIdx.get(key); cursor = new CFAccRamAccountEntryCursor(Authorization, schema, subdictSplitIdx.values()); } else { cursor = new CFAccRamAccountEntryCursor(Authorization, schema, new ArrayList<CFAccAccountEntryBuff>()); } return (cursor); } public CFAccCursor openAccountEntryCursorByTenantIdx(CFAccAuthorization Authorization, long TenantId) { CFAccCursor cursor; CFAccAccountEntryByTenantIdxKey key = schema.getFactoryAccountEntry().newTenantIdxKey(); key.setRequiredTenantId(TenantId); if (dictByTenantIdx.containsKey(key)) { SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictTenantIdx = dictByTenantIdx.get(key); cursor = new CFAccRamAccountEntryCursor(Authorization, schema, subdictTenantIdx.values()); } else { cursor = new CFAccRamAccountEntryCursor(Authorization, schema, new ArrayList<CFAccAccountEntryBuff>()); } return (cursor); } public CFAccCursor openAccountEntryCursorByAcctIdx(CFAccAuthorization Authorization, long TenantId, long AccountId) { CFAccCursor cursor; CFAccAccountEntryByAcctIdxKey key = schema.getFactoryAccountEntry().newAcctIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredAccountId(AccountId); if (dictByAcctIdx.containsKey(key)) { SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictAcctIdx = dictByAcctIdx.get(key); cursor = new CFAccRamAccountEntryCursor(Authorization, schema, subdictAcctIdx.values()); } else { cursor = new CFAccRamAccountEntryCursor(Authorization, schema, new ArrayList<CFAccAccountEntryBuff>()); } return (cursor); } public CFAccCursor openAccountEntryCursorByXfrAcctIdx(CFAccAuthorization Authorization, Long TransferTenantId, Long TransferAccountId) { CFAccCursor cursor; CFAccAccountEntryByXfrAcctIdxKey key = schema.getFactoryAccountEntry().newXfrAcctIdxKey(); key.setOptionalTransferTenantId(TransferTenantId); key.setOptionalTransferAccountId(TransferAccountId); if (dictByXfrAcctIdx.containsKey(key)) { SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictXfrAcctIdx = dictByXfrAcctIdx.get(key); cursor = new CFAccRamAccountEntryCursor(Authorization, schema, subdictXfrAcctIdx.values()); } else { cursor = new CFAccRamAccountEntryCursor(Authorization, schema, new ArrayList<CFAccAccountEntryBuff>()); } return (cursor); } public CFAccCursor openAccountEntryCursorByDrCcyIdx(CFAccAuthorization Authorization, Short DebitCurrencyId) { CFAccCursor cursor; CFAccAccountEntryByDrCcyIdxKey key = schema.getFactoryAccountEntry().newDrCcyIdxKey(); key.setOptionalDebitCurrencyId(DebitCurrencyId); if (dictByDrCcyIdx.containsKey(key)) { SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictDrCcyIdx = dictByDrCcyIdx.get(key); cursor = new CFAccRamAccountEntryCursor(Authorization, schema, subdictDrCcyIdx.values()); } else { cursor = new CFAccRamAccountEntryCursor(Authorization, schema, new ArrayList<CFAccAccountEntryBuff>()); } return (cursor); } public CFAccCursor openAccountEntryCursorByCrCcyIdx(CFAccAuthorization Authorization, Short CreditCurrencyId) { CFAccCursor cursor; CFAccAccountEntryByCrCcyIdxKey key = schema.getFactoryAccountEntry().newCrCcyIdxKey(); key.setOptionalCreditCurrencyId(CreditCurrencyId); if (dictByCrCcyIdx.containsKey(key)) { SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictCrCcyIdx = dictByCrCcyIdx.get(key); cursor = new CFAccRamAccountEntryCursor(Authorization, schema, subdictCrCcyIdx.values()); } else { cursor = new CFAccRamAccountEntryCursor(Authorization, schema, new ArrayList<CFAccAccountEntryBuff>()); } return (cursor); } public CFAccCursor openAccountEntryCursorByCvtCcyIdx(CFAccAuthorization Authorization, short ConvertedCurrencyId) { CFAccCursor cursor; CFAccAccountEntryByCvtCcyIdxKey key = schema.getFactoryAccountEntry().newCvtCcyIdxKey(); key.setRequiredConvertedCurrencyId(ConvertedCurrencyId); if (dictByCvtCcyIdx.containsKey(key)) { SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictCvtCcyIdx = dictByCvtCcyIdx.get(key); cursor = new CFAccRamAccountEntryCursor(Authorization, schema, subdictCvtCcyIdx.values()); } else { cursor = new CFAccRamAccountEntryCursor(Authorization, schema, new ArrayList<CFAccAccountEntryBuff>()); } return (cursor); } public CFAccCursor openAccountEntryCursorByBalCcyIdx(CFAccAuthorization Authorization, short BalanceCurrencyId) { CFAccCursor cursor; CFAccAccountEntryByBalCcyIdxKey key = schema.getFactoryAccountEntry().newBalCcyIdxKey(); key.setRequiredBalanceCurrencyId(BalanceCurrencyId); if (dictByBalCcyIdx.containsKey(key)) { SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdictBalCcyIdx = dictByBalCcyIdx.get(key); cursor = new CFAccRamAccountEntryCursor(Authorization, schema, subdictBalCcyIdx.values()); } else { cursor = new CFAccRamAccountEntryCursor(Authorization, schema, new ArrayList<CFAccAccountEntryBuff>()); } return (cursor); } public void closeAccountEntryCursor(CFAccCursor Cursor) { // Cursor.DataReader.Close(); } public CFAccAccountEntryBuff nextAccountEntryCursor(CFAccCursor Cursor) { CFAccRamAccountEntryCursor cursor = (CFAccRamAccountEntryCursor) Cursor; CFAccAccountEntryBuff rec = cursor.getCursor().next(); cursor.setRowIdx(cursor.getRowIdx() + 1); return (rec); } public CFAccAccountEntryBuff prevAccountEntryCursor(CFAccCursor Cursor) { int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1; CFAccAccountEntryBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextAccountEntryCursor(Cursor); } return (rec); } public CFAccAccountEntryBuff firstAccountEntryCursor(CFAccCursor Cursor) { int targetRowIdx = 1; CFAccAccountEntryBuff rec = null; Cursor.reset(); while (Cursor.getRowIdx() < targetRowIdx) { rec = nextAccountEntryCursor(Cursor); } return (rec); } public CFAccAccountEntryBuff lastAccountEntryCursor(CFAccCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastAccountEntryCursor"); } public CFAccAccountEntryBuff nthAccountEntryCursor(CFAccCursor Cursor, int Idx) { int targetRowIdx = Idx; CFAccAccountEntryBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextAccountEntryCursor(Cursor); } return (rec); } public void releasePreparedStatements() { } }