Java tutorial
// Description: Java 7 DB/2 LUW 10.5 Jdbc 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.CFAccDb2LUW; import java.math.*; import java.sql.*; import java.text.*; 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.*; /* * CFAccDb2LUWAccountEntryTable DB/2 LUW 10.5 Jdbc DbIO implementation * for AccountEntry. */ public class CFAccDb2LUWAccountEntryTable implements ICFAccAccountEntryTable { private CFAccDb2LUWSchema schema; protected PreparedStatement stmtReadBuffByPKey = null; protected PreparedStatement stmtLockBuffByPKey = null; protected PreparedStatement stmtCreateByPKey = null; protected PreparedStatement stmtUpdateByPKey = null; protected PreparedStatement stmtDeleteByPKey = null; protected PreparedStatement stmtReadAllBuff = null; protected PreparedStatement stmtReadBuffByIdIdx = null; protected PreparedStatement stmtReadBuffByUEntryIdx = null; protected PreparedStatement stmtReadBuffByAccTsIdx = null; protected PreparedStatement stmtReadBuffByEStampIdx = null; protected PreparedStatement stmtReadBuffBySplitIdx = null; protected PreparedStatement stmtReadBuffByTenantIdx = null; protected PreparedStatement stmtReadBuffByAcctIdx = null; protected PreparedStatement stmtReadBuffByXfrAcctIdx = null; protected PreparedStatement stmtReadBuffByDrCcyIdx = null; protected PreparedStatement stmtReadBuffByCrCcyIdx = null; protected PreparedStatement stmtReadBuffByCvtCcyIdx = null; protected PreparedStatement stmtReadBuffByBalCcyIdx = null; protected PreparedStatement stmtDeleteByIdIdx = null; protected PreparedStatement stmtDeleteByUEntryIdx = null; protected PreparedStatement stmtDeleteByAccTsIdx = null; protected PreparedStatement stmtDeleteByEStampIdx = null; protected PreparedStatement stmtDeleteBySplitIdx = null; protected PreparedStatement stmtDeleteByTenantIdx = null; protected PreparedStatement stmtDeleteByAcctIdx = null; protected PreparedStatement stmtDeleteByXfrAcctIdx = null; protected PreparedStatement stmtDeleteByDrCcyIdx = null; protected PreparedStatement stmtDeleteByCrCcyIdx = null; protected PreparedStatement stmtDeleteByCvtCcyIdx = null; protected PreparedStatement stmtDeleteByBalCcyIdx = null; public CFAccDb2LUWAccountEntryTable(CFAccDb2LUWSchema argSchema) { schema = argSchema; } public void createAccountEntry(CFAccAuthorization Authorization, CFAccAccountEntryBuff Buff) { final String S_ProcName = "createAccountEntry"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); } ResultSet resultSet = null; try { long TenantId = Buff.getRequiredTenantId(); long AccountId = Buff.getRequiredAccountId(); UUID SplitEntryId = Buff.getOptionalSplitEntryId(); Calendar EntryStamp = Buff.getRequiredEntryStamp(); String Description = Buff.getRequiredDescription(); Long TransferTenantId = Buff.getOptionalTransferTenantId(); Long TransferAccountId = Buff.getOptionalTransferAccountId(); Short DebitCurrencyId = Buff.getOptionalDebitCurrencyId(); BigDecimal Debit = Buff.getOptionalDebit(); Short CreditCurrencyId = Buff.getOptionalCreditCurrencyId(); BigDecimal Credit = Buff.getOptionalCredit(); short ConvertedCurrencyId = Buff.getRequiredConvertedCurrencyId(); BigDecimal ConvertedAmount = Buff.getRequiredConvertedAmount(); short BalanceCurrencyId = Buff.getRequiredBalanceCurrencyId(); BigDecimal Balance = Buff.getRequiredBalance(); UUID EntryId = UUID.randomUUID(); Connection cnx = schema.getCnx(); final String sql = "CALL sp_create_ac_entry( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "TIMESTAMP_FORMAT( ?, 'YYYY-MM-DD-HH24.MI.SS' )" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtCreateByPKey == null) { stmtCreateByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtCreateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtCreateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtCreateByPKey.setString(argIdx++, "ACNY"); stmtCreateByPKey.setLong(argIdx++, TenantId); stmtCreateByPKey.setLong(argIdx++, AccountId); stmtCreateByPKey.setString(argIdx++, EntryId.toString()); if (SplitEntryId != null) { stmtCreateByPKey.setString(argIdx++, SplitEntryId.toString()); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } stmtCreateByPKey.setString(argIdx++, CFAccDb2LUWSchema.getTimestampString(EntryStamp)); stmtCreateByPKey.setString(argIdx++, Description); if (TransferTenantId != null) { stmtCreateByPKey.setLong(argIdx++, TransferTenantId.longValue()); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } if (TransferAccountId != null) { stmtCreateByPKey.setLong(argIdx++, TransferAccountId.longValue()); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } if (DebitCurrencyId != null) { stmtCreateByPKey.setShort(argIdx++, DebitCurrencyId.shortValue()); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } if (Debit != null) { stmtCreateByPKey.setBigDecimal(argIdx++, Debit); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.NUMERIC); } if (CreditCurrencyId != null) { stmtCreateByPKey.setShort(argIdx++, CreditCurrencyId.shortValue()); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } if (Credit != null) { stmtCreateByPKey.setBigDecimal(argIdx++, Credit); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.NUMERIC); } stmtCreateByPKey.setShort(argIdx++, ConvertedCurrencyId); stmtCreateByPKey.setBigDecimal(argIdx++, ConvertedAmount); stmtCreateByPKey.setShort(argIdx++, BalanceCurrencyId); stmtCreateByPKey.setBigDecimal(argIdx++, Balance); resultSet = stmtCreateByPKey.executeQuery(); if (resultSet.next()) { CFAccAccountEntryBuff createdBuff = unpackAccountEntryResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setRequiredTenantId(createdBuff.getRequiredTenantId()); Buff.setRequiredAccountId(createdBuff.getRequiredAccountId()); Buff.setRequiredEntryId(createdBuff.getRequiredEntryId()); Buff.setOptionalSplitEntryId(createdBuff.getOptionalSplitEntryId()); Buff.setRequiredEntryStamp(createdBuff.getRequiredEntryStamp()); Buff.setRequiredDescription(createdBuff.getRequiredDescription()); Buff.setOptionalTransferTenantId(createdBuff.getOptionalTransferTenantId()); Buff.setOptionalTransferAccountId(createdBuff.getOptionalTransferAccountId()); Buff.setOptionalDebitCurrencyId(createdBuff.getOptionalDebitCurrencyId()); Buff.setOptionalDebit(createdBuff.getOptionalDebit()); Buff.setOptionalCreditCurrencyId(createdBuff.getOptionalCreditCurrencyId()); Buff.setOptionalCredit(createdBuff.getOptionalCredit()); Buff.setRequiredConvertedCurrencyId(createdBuff.getRequiredConvertedCurrencyId()); Buff.setRequiredConvertedAmount(createdBuff.getRequiredConvertedAmount()); Buff.setRequiredBalanceCurrencyId(createdBuff.getRequiredBalanceCurrencyId()); Buff.setRequiredBalance(createdBuff.getRequiredBalance()); Buff.setRequiredRevision(createdBuff.getRequiredRevision()); Buff.setCreatedByUserId(createdBuff.getCreatedByUserId()); Buff.setCreatedAt(createdBuff.getCreatedAt()); Buff.setUpdatedByUserId(createdBuff.getUpdatedByUserId()); Buff.setUpdatedAt(createdBuff.getUpdatedAt()); } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected a single-record response, " + resultSet.getRow() + " rows selected"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } protected static String S_sqlSelectAccountEntryDistinctClassCode = null; public String getSqlSelectAccountEntryDistinctClassCode() { if (S_sqlSelectAccountEntryDistinctClassCode == null) { S_sqlSelectAccountEntryDistinctClassCode = "SELECT " + "DISTINCT acny.ClassCode " + "FROM " + schema.getLowerSchemaDbName() + ".ac_entry AS acny "; } return (S_sqlSelectAccountEntryDistinctClassCode); } protected static String S_sqlSelectAccountEntryBuff = null; public String getSqlSelectAccountEntryBuff() { if (S_sqlSelectAccountEntryBuff == null) { S_sqlSelectAccountEntryBuff = "SELECT " + "acny.TenantId, " + "acny.AccountId, " + "acny.EntryId, " + "acny.SplitEntryId, " + "TO_CHAR( acny.EntryStamp, 'YYYY-MM-DD-HH24.MI.SS' ) AS EntryStamp, " + "acny.Description, " + "acny.XfrTentId, " + "acny.XfrAcctId, " + "acny.debit_ccyid, " + "acny.Debit, " + "acny.credit_ccyid, " + "acny.Credit, " + "acny.cvt_ccyid, " + "acny.cvt_amt, " + "acny.bal_ccyid, " + "acny.Balance, " + "acny.Revision " + "FROM " + schema.getLowerSchemaDbName() + ".ac_entry AS acny "; } return (S_sqlSelectAccountEntryBuff); } protected CFAccAccountEntryBuff unpackAccountEntryResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackAccountEntryResultSetToBuff"; int idxcol = 1; CFAccAccountEntryBuff buff = schema.getFactoryAccountEntry().newBuff(); { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedByUserId(null); } else { buff.setCreatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedAt(null); } else { buff.setCreatedAt(CFAccDb2LUWSchema.convertTimestampString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedByUserId(null); } else { buff.setUpdatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedAt(null); } else { buff.setUpdatedAt(CFAccDb2LUWSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredTenantId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredAccountId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredEntryId(CFAccDb2LUWSchema.convertUuidString(resultSet.getString(idxcol))); idxcol++; { UUID colVal = CFAccDb2LUWSchema.convertUuidString(resultSet.getString(idxcol)); if (resultSet.wasNull()) { buff.setOptionalSplitEntryId(null); } else { buff.setOptionalSplitEntryId(colVal); } } idxcol++; buff.setRequiredEntryStamp(CFAccDb2LUWSchema.convertTimestampString(resultSet.getString(idxcol))); idxcol++; buff.setRequiredDescription(resultSet.getString(idxcol)); idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalTransferTenantId(null); } else { buff.setOptionalTransferTenantId(colVal); } } idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalTransferAccountId(null); } else { buff.setOptionalTransferAccountId(colVal); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalDebitCurrencyId(null); } else { buff.setOptionalDebitCurrencyId(colVal); } } idxcol++; { BigDecimal bival = resultSet.getBigDecimal(idxcol); if (resultSet.wasNull()) { buff.setOptionalDebit(null); } else { buff.setOptionalDebit(bival); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalCreditCurrencyId(null); } else { buff.setOptionalCreditCurrencyId(colVal); } } idxcol++; { BigDecimal bival = resultSet.getBigDecimal(idxcol); if (resultSet.wasNull()) { buff.setOptionalCredit(null); } else { buff.setOptionalCredit(bival); } } idxcol++; buff.setRequiredConvertedCurrencyId(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredConvertedAmount(resultSet.getBigDecimal(idxcol)); idxcol++; buff.setRequiredBalanceCurrencyId(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredBalance(resultSet.getBigDecimal(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); } public CFAccAccountEntryBuff readDerived(CFAccAuthorization Authorization, CFAccAccountEntryPKey PKey) { final String S_ProcName = "readDerived"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); } CFAccAccountEntryBuff buff; buff = readBuff(Authorization, PKey); return (buff); } public CFAccAccountEntryBuff lockDerived(CFAccAuthorization Authorization, CFAccAccountEntryPKey PKey) { final String S_ProcName = "lockDerived"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); } CFAccAccountEntryBuff buff; buff = lockBuff(Authorization, PKey); return (buff); } public CFAccAccountEntryBuff[] readAllDerived(CFAccAuthorization Authorization) { final String S_ProcName = "readAllDerived"; CFAccAccountEntryBuff[] buffArray; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); } buffArray = readAllBuff(Authorization); return (buffArray); } public CFAccAccountEntryBuff readDerivedByIdIdx(CFAccAuthorization Authorization, long TenantId, long AccountId, UUID EntryId) { final String S_ProcName = "CFAccDb2LUWAccountEntryTable.readDerivedByIdIdx() "; CFAccAccountEntryBuff buff; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); } buff = readBuffByIdIdx(Authorization, TenantId, AccountId, EntryId); return (buff); } public CFAccAccountEntryBuff readDerivedByUEntryIdx(CFAccAuthorization Authorization, UUID EntryId) { final String S_ProcName = "CFAccDb2LUWAccountEntryTable.readDerivedByUEntryIdx() "; CFAccAccountEntryBuff buff; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); } buff = readBuffByUEntryIdx(Authorization, EntryId); return (buff); } public CFAccAccountEntryBuff[] readDerivedByAccTsIdx(CFAccAuthorization Authorization, long TenantId, long AccountId, Calendar EntryStamp) { final String S_ProcName = "readDerivedByAccTsIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); } CFAccAccountEntryBuff[] buffList = readBuffByAccTsIdx(Authorization, TenantId, AccountId, EntryStamp); return (buffList); } public CFAccAccountEntryBuff[] readDerivedByEStampIdx(CFAccAuthorization Authorization, Calendar EntryStamp) { final String S_ProcName = "readDerivedByEStampIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); } CFAccAccountEntryBuff[] buffList = readBuffByEStampIdx(Authorization, EntryStamp); return (buffList); } public CFAccAccountEntryBuff[] readDerivedBySplitIdx(CFAccAuthorization Authorization, UUID SplitEntryId) { final String S_ProcName = "readDerivedBySplitIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); } CFAccAccountEntryBuff[] buffList = readBuffBySplitIdx(Authorization, SplitEntryId); return (buffList); } public CFAccAccountEntryBuff[] readDerivedByTenantIdx(CFAccAuthorization Authorization, long TenantId) { final String S_ProcName = "readDerivedByTenantIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); } CFAccAccountEntryBuff[] buffList = readBuffByTenantIdx(Authorization, TenantId); return (buffList); } public CFAccAccountEntryBuff[] readDerivedByAcctIdx(CFAccAuthorization Authorization, long TenantId, long AccountId) { final String S_ProcName = "readDerivedByAcctIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); } CFAccAccountEntryBuff[] buffList = readBuffByAcctIdx(Authorization, TenantId, AccountId); return (buffList); } public CFAccAccountEntryBuff[] readDerivedByXfrAcctIdx(CFAccAuthorization Authorization, Long TransferTenantId, Long TransferAccountId) { final String S_ProcName = "readDerivedByXfrAcctIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); } CFAccAccountEntryBuff[] buffList = readBuffByXfrAcctIdx(Authorization, TransferTenantId, TransferAccountId); return (buffList); } public CFAccAccountEntryBuff[] readDerivedByDrCcyIdx(CFAccAuthorization Authorization, Short DebitCurrencyId) { final String S_ProcName = "readDerivedByDrCcyIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); } CFAccAccountEntryBuff[] buffList = readBuffByDrCcyIdx(Authorization, DebitCurrencyId); return (buffList); } public CFAccAccountEntryBuff[] readDerivedByCrCcyIdx(CFAccAuthorization Authorization, Short CreditCurrencyId) { final String S_ProcName = "readDerivedByCrCcyIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); } CFAccAccountEntryBuff[] buffList = readBuffByCrCcyIdx(Authorization, CreditCurrencyId); return (buffList); } public CFAccAccountEntryBuff[] readDerivedByCvtCcyIdx(CFAccAuthorization Authorization, short ConvertedCurrencyId) { final String S_ProcName = "readDerivedByCvtCcyIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); } CFAccAccountEntryBuff[] buffList = readBuffByCvtCcyIdx(Authorization, ConvertedCurrencyId); return (buffList); } public CFAccAccountEntryBuff[] readDerivedByBalCcyIdx(CFAccAuthorization Authorization, short BalanceCurrencyId) { final String S_ProcName = "readDerivedByBalCcyIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); } CFAccAccountEntryBuff[] buffList = readBuffByBalCcyIdx(Authorization, BalanceCurrencyId); return (buffList); } public CFAccAccountEntryBuff readBuff(CFAccAuthorization Authorization, CFAccAccountEntryPKey PKey) { final String S_ProcName = "readBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); } ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); long TenantId = PKey.getRequiredTenantId(); long AccountId = PKey.getRequiredAccountId(); UUID EntryId = PKey.getRequiredEntryId(); final String sql = "CALL sp_read_ac_entry( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtReadBuffByPKey == null) { stmtReadBuffByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadBuffByPKey.setLong(argIdx++, TenantId); stmtReadBuffByPKey.setLong(argIdx++, AccountId); stmtReadBuffByPKey.setString(argIdx++, EntryId.toString()); resultSet = stmtReadBuffByPKey.executeQuery(); if (resultSet.next()) { CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } return (buff); } else { return (null); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public CFAccAccountEntryBuff lockBuff(CFAccAuthorization Authorization, CFAccAccountEntryPKey PKey) { final String S_ProcName = "lockBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); } ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); long TenantId = PKey.getRequiredTenantId(); long AccountId = PKey.getRequiredAccountId(); UUID EntryId = PKey.getRequiredEntryId(); final String sql = "CALL sp_lock_ac_entry( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtLockBuffByPKey == null) { stmtLockBuffByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtLockBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtLockBuffByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtLockBuffByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtLockBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtLockBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtLockBuffByPKey.setLong(argIdx++, TenantId); stmtLockBuffByPKey.setLong(argIdx++, AccountId); stmtLockBuffByPKey.setString(argIdx++, EntryId.toString()); resultSet = stmtLockBuffByPKey.executeQuery(); if (resultSet.next()) { CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } return (buff); } else { return (null); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public CFAccAccountEntryBuff[] readAllBuff(CFAccAuthorization Authorization) { final String S_ProcName = "readAllBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); } ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_read_ac_entry_all( ?, ?, ?, ?, ? )"; if (stmtReadAllBuff == null) { stmtReadAllBuff = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadAllBuff.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadAllBuff.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); resultSet = stmtReadAllBuff.executeQuery(); List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>(); while (resultSet.next()) { CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFAccAccountEntryBuff[] retBuff = new CFAccAccountEntryBuff[buffList.size()]; Iterator<CFAccAccountEntryBuff> iter = buffList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public CFAccAccountEntryBuff readBuffByIdIdx(CFAccAuthorization Authorization, long TenantId, long AccountId, UUID EntryId) { final String S_ProcName = "readBuffByIdIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_read_ac_entry_by_ididx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtReadBuffByIdIdx == null) { stmtReadBuffByIdIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByIdIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByIdIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadBuffByIdIdx.setLong(argIdx++, TenantId); stmtReadBuffByIdIdx.setLong(argIdx++, AccountId); stmtReadBuffByIdIdx.setString(argIdx++, EntryId.toString()); resultSet = stmtReadBuffByIdIdx.executeQuery(); if (resultSet.next()) { CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } return (buff); } else { return (null); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public CFAccAccountEntryBuff readBuffByUEntryIdx(CFAccAuthorization Authorization, UUID EntryId) { final String S_ProcName = "readBuffByUEntryIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_read_ac_entry_by_uentryidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtReadBuffByUEntryIdx == null) { stmtReadBuffByUEntryIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByUEntryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByUEntryIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByUEntryIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByUEntryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByUEntryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadBuffByUEntryIdx.setString(argIdx++, EntryId.toString()); resultSet = stmtReadBuffByUEntryIdx.executeQuery(); if (resultSet.next()) { CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } return (buff); } else { return (null); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public CFAccAccountEntryBuff[] readBuffByAccTsIdx(CFAccAuthorization Authorization, long TenantId, long AccountId, Calendar EntryStamp) { final String S_ProcName = "readBuffByAccTsIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_read_ac_entry_by_acctsidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "TIMESTAMP_FORMAT( ?, 'YYYY-MM-DD-HH24.MI.SS' )" + " )"; if (stmtReadBuffByAccTsIdx == null) { stmtReadBuffByAccTsIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByAccTsIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByAccTsIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByAccTsIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByAccTsIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByAccTsIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadBuffByAccTsIdx.setLong(argIdx++, TenantId); stmtReadBuffByAccTsIdx.setLong(argIdx++, AccountId); stmtReadBuffByAccTsIdx.setString(argIdx++, CFAccDb2LUWSchema.getTimestampString(EntryStamp)); resultSet = stmtReadBuffByAccTsIdx.executeQuery(); List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>(); while (resultSet.next()) { CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFAccAccountEntryBuff[] retBuff = new CFAccAccountEntryBuff[buffList.size()]; Iterator<CFAccAccountEntryBuff> iter = buffList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public CFAccAccountEntryBuff[] readBuffByEStampIdx(CFAccAuthorization Authorization, Calendar EntryStamp) { final String S_ProcName = "readBuffByEStampIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_read_ac_entry_by_estampidx( ?, ?, ?, ?, ?" + ", " + "TIMESTAMP_FORMAT( ?, 'YYYY-MM-DD-HH24.MI.SS' )" + " )"; if (stmtReadBuffByEStampIdx == null) { stmtReadBuffByEStampIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByEStampIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByEStampIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByEStampIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByEStampIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByEStampIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadBuffByEStampIdx.setString(argIdx++, CFAccDb2LUWSchema.getTimestampString(EntryStamp)); resultSet = stmtReadBuffByEStampIdx.executeQuery(); List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>(); while (resultSet.next()) { CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFAccAccountEntryBuff[] retBuff = new CFAccAccountEntryBuff[buffList.size()]; Iterator<CFAccAccountEntryBuff> iter = buffList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public CFAccAccountEntryBuff[] readBuffBySplitIdx(CFAccAuthorization Authorization, UUID SplitEntryId) { final String S_ProcName = "readBuffBySplitIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_read_ac_entry_by_splitidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtReadBuffBySplitIdx == null) { stmtReadBuffBySplitIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffBySplitIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffBySplitIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffBySplitIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffBySplitIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffBySplitIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (SplitEntryId != null) { stmtReadBuffBySplitIdx.setString(argIdx++, SplitEntryId.toString()); } else { stmtReadBuffBySplitIdx.setNull(argIdx++, java.sql.Types.VARCHAR); } resultSet = stmtReadBuffBySplitIdx.executeQuery(); List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>(); while (resultSet.next()) { CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFAccAccountEntryBuff[] retBuff = new CFAccAccountEntryBuff[buffList.size()]; Iterator<CFAccAccountEntryBuff> iter = buffList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public CFAccAccountEntryBuff[] readBuffByTenantIdx(CFAccAuthorization Authorization, long TenantId) { final String S_ProcName = "readBuffByTenantIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_read_ac_entry_by_tenantidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtReadBuffByTenantIdx == null) { stmtReadBuffByTenantIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadBuffByTenantIdx.setLong(argIdx++, TenantId); resultSet = stmtReadBuffByTenantIdx.executeQuery(); List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>(); while (resultSet.next()) { CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFAccAccountEntryBuff[] retBuff = new CFAccAccountEntryBuff[buffList.size()]; Iterator<CFAccAccountEntryBuff> iter = buffList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public CFAccAccountEntryBuff[] readBuffByAcctIdx(CFAccAuthorization Authorization, long TenantId, long AccountId) { final String S_ProcName = "readBuffByAcctIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_read_ac_entry_by_acctidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )"; if (stmtReadBuffByAcctIdx == null) { stmtReadBuffByAcctIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByAcctIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByAcctIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadBuffByAcctIdx.setLong(argIdx++, TenantId); stmtReadBuffByAcctIdx.setLong(argIdx++, AccountId); resultSet = stmtReadBuffByAcctIdx.executeQuery(); List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>(); while (resultSet.next()) { CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFAccAccountEntryBuff[] retBuff = new CFAccAccountEntryBuff[buffList.size()]; Iterator<CFAccAccountEntryBuff> iter = buffList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public CFAccAccountEntryBuff[] readBuffByXfrAcctIdx(CFAccAuthorization Authorization, Long TransferTenantId, Long TransferAccountId) { final String S_ProcName = "readBuffByXfrAcctIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_read_ac_entry_by_xfracctidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )"; if (stmtReadBuffByXfrAcctIdx == null) { stmtReadBuffByXfrAcctIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByXfrAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByXfrAcctIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByXfrAcctIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByXfrAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByXfrAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (TransferTenantId != null) { stmtReadBuffByXfrAcctIdx.setLong(argIdx++, TransferTenantId.longValue()); } else { stmtReadBuffByXfrAcctIdx.setNull(argIdx++, java.sql.Types.BIGINT); } if (TransferAccountId != null) { stmtReadBuffByXfrAcctIdx.setLong(argIdx++, TransferAccountId.longValue()); } else { stmtReadBuffByXfrAcctIdx.setNull(argIdx++, java.sql.Types.BIGINT); } resultSet = stmtReadBuffByXfrAcctIdx.executeQuery(); List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>(); while (resultSet.next()) { CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFAccAccountEntryBuff[] retBuff = new CFAccAccountEntryBuff[buffList.size()]; Iterator<CFAccAccountEntryBuff> iter = buffList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public CFAccAccountEntryBuff[] readBuffByDrCcyIdx(CFAccAuthorization Authorization, Short DebitCurrencyId) { final String S_ProcName = "readBuffByDrCcyIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_read_ac_entry_by_drccyidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtReadBuffByDrCcyIdx == null) { stmtReadBuffByDrCcyIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByDrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByDrCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByDrCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByDrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByDrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (DebitCurrencyId != null) { stmtReadBuffByDrCcyIdx.setShort(argIdx++, DebitCurrencyId.shortValue()); } else { stmtReadBuffByDrCcyIdx.setNull(argIdx++, java.sql.Types.SMALLINT); } resultSet = stmtReadBuffByDrCcyIdx.executeQuery(); List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>(); while (resultSet.next()) { CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFAccAccountEntryBuff[] retBuff = new CFAccAccountEntryBuff[buffList.size()]; Iterator<CFAccAccountEntryBuff> iter = buffList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public CFAccAccountEntryBuff[] readBuffByCrCcyIdx(CFAccAuthorization Authorization, Short CreditCurrencyId) { final String S_ProcName = "readBuffByCrCcyIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_read_ac_entry_by_crccyidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtReadBuffByCrCcyIdx == null) { stmtReadBuffByCrCcyIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByCrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByCrCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByCrCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByCrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByCrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (CreditCurrencyId != null) { stmtReadBuffByCrCcyIdx.setShort(argIdx++, CreditCurrencyId.shortValue()); } else { stmtReadBuffByCrCcyIdx.setNull(argIdx++, java.sql.Types.SMALLINT); } resultSet = stmtReadBuffByCrCcyIdx.executeQuery(); List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>(); while (resultSet.next()) { CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFAccAccountEntryBuff[] retBuff = new CFAccAccountEntryBuff[buffList.size()]; Iterator<CFAccAccountEntryBuff> iter = buffList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public CFAccAccountEntryBuff[] readBuffByCvtCcyIdx(CFAccAuthorization Authorization, short ConvertedCurrencyId) { final String S_ProcName = "readBuffByCvtCcyIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_read_ac_entry_by_cvtccyidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtReadBuffByCvtCcyIdx == null) { stmtReadBuffByCvtCcyIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByCvtCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByCvtCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByCvtCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByCvtCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByCvtCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadBuffByCvtCcyIdx.setShort(argIdx++, ConvertedCurrencyId); resultSet = stmtReadBuffByCvtCcyIdx.executeQuery(); List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>(); while (resultSet.next()) { CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFAccAccountEntryBuff[] retBuff = new CFAccAccountEntryBuff[buffList.size()]; Iterator<CFAccAccountEntryBuff> iter = buffList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public CFAccAccountEntryBuff[] readBuffByBalCcyIdx(CFAccAuthorization Authorization, short BalanceCurrencyId) { final String S_ProcName = "readBuffByBalCcyIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_read_ac_entry_by_balccyidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtReadBuffByBalCcyIdx == null) { stmtReadBuffByBalCcyIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByBalCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByBalCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByBalCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByBalCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByBalCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadBuffByBalCcyIdx.setShort(argIdx++, BalanceCurrencyId); resultSet = stmtReadBuffByBalCcyIdx.executeQuery(); List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>(); while (resultSet.next()) { CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFAccAccountEntryBuff[] retBuff = new CFAccAccountEntryBuff[buffList.size()]; Iterator<CFAccAccountEntryBuff> iter = buffList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public void updateAccountEntry(CFAccAuthorization Authorization, CFAccAccountEntryBuff Buff) { final String S_ProcName = "updateAccountEntry"; if ("ACNY".equals(Buff.getClassCode()) && (!schema.isTenantUser(Authorization, Buff.getRequiredTenantId(), "UpdateAccountEntry"))) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Permission denied -- User not part of TSecGroup UpdateAccountEntry"); } ResultSet resultSet = null; try { long TenantId = Buff.getRequiredTenantId(); long AccountId = Buff.getRequiredAccountId(); UUID EntryId = Buff.getRequiredEntryId(); UUID SplitEntryId = Buff.getOptionalSplitEntryId(); Calendar EntryStamp = Buff.getRequiredEntryStamp(); String Description = Buff.getRequiredDescription(); Long TransferTenantId = Buff.getOptionalTransferTenantId(); Long TransferAccountId = Buff.getOptionalTransferAccountId(); Short DebitCurrencyId = Buff.getOptionalDebitCurrencyId(); BigDecimal Debit = Buff.getOptionalDebit(); Short CreditCurrencyId = Buff.getOptionalCreditCurrencyId(); BigDecimal Credit = Buff.getOptionalCredit(); short ConvertedCurrencyId = Buff.getRequiredConvertedCurrencyId(); BigDecimal ConvertedAmount = Buff.getRequiredConvertedAmount(); short BalanceCurrencyId = Buff.getRequiredBalanceCurrencyId(); BigDecimal Balance = Buff.getRequiredBalance(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); final String sql = "CALL sp_update_ac_entry( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "TIMESTAMP_FORMAT( ?, 'YYYY-MM-DD-HH24.MI.SS' )" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtUpdateByPKey == null) { stmtUpdateByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtUpdateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtUpdateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtUpdateByPKey.setString(argIdx++, "ACNY"); stmtUpdateByPKey.setLong(argIdx++, TenantId); stmtUpdateByPKey.setLong(argIdx++, AccountId); stmtUpdateByPKey.setString(argIdx++, EntryId.toString()); if (SplitEntryId != null) { stmtUpdateByPKey.setString(argIdx++, SplitEntryId.toString()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } stmtUpdateByPKey.setString(argIdx++, CFAccDb2LUWSchema.getTimestampString(EntryStamp)); stmtUpdateByPKey.setString(argIdx++, Description); if (TransferTenantId != null) { stmtUpdateByPKey.setLong(argIdx++, TransferTenantId.longValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } if (TransferAccountId != null) { stmtUpdateByPKey.setLong(argIdx++, TransferAccountId.longValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } if (DebitCurrencyId != null) { stmtUpdateByPKey.setShort(argIdx++, DebitCurrencyId.shortValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } if (Debit != null) { stmtUpdateByPKey.setBigDecimal(argIdx++, Debit); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.NUMERIC); } if (CreditCurrencyId != null) { stmtUpdateByPKey.setShort(argIdx++, CreditCurrencyId.shortValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } if (Credit != null) { stmtUpdateByPKey.setBigDecimal(argIdx++, Credit); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.NUMERIC); } stmtUpdateByPKey.setShort(argIdx++, ConvertedCurrencyId); stmtUpdateByPKey.setBigDecimal(argIdx++, ConvertedAmount); stmtUpdateByPKey.setShort(argIdx++, BalanceCurrencyId); stmtUpdateByPKey.setBigDecimal(argIdx++, Balance); stmtUpdateByPKey.setInt(argIdx++, Revision); resultSet = stmtUpdateByPKey.executeQuery(); if (resultSet.next()) { CFAccAccountEntryBuff updatedBuff = unpackAccountEntryResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setOptionalSplitEntryId(updatedBuff.getOptionalSplitEntryId()); Buff.setRequiredEntryStamp(updatedBuff.getRequiredEntryStamp()); Buff.setRequiredDescription(updatedBuff.getRequiredDescription()); Buff.setOptionalTransferTenantId(updatedBuff.getOptionalTransferTenantId()); Buff.setOptionalTransferAccountId(updatedBuff.getOptionalTransferAccountId()); Buff.setOptionalDebitCurrencyId(updatedBuff.getOptionalDebitCurrencyId()); Buff.setOptionalDebit(updatedBuff.getOptionalDebit()); Buff.setOptionalCreditCurrencyId(updatedBuff.getOptionalCreditCurrencyId()); Buff.setOptionalCredit(updatedBuff.getOptionalCredit()); Buff.setRequiredConvertedCurrencyId(updatedBuff.getRequiredConvertedCurrencyId()); Buff.setRequiredConvertedAmount(updatedBuff.getRequiredConvertedAmount()); Buff.setRequiredBalanceCurrencyId(updatedBuff.getRequiredBalanceCurrencyId()); Buff.setRequiredBalance(updatedBuff.getRequiredBalance()); Buff.setRequiredRevision(updatedBuff.getRequiredRevision()); } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected a single-record response, " + resultSet.getRow() + " rows selected"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public void deleteAccountEntry(CFAccAuthorization Authorization, CFAccAccountEntryBuff Buff) { final String S_ProcName = "deleteAccountEntry"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); long TenantId = Buff.getRequiredTenantId(); long AccountId = Buff.getRequiredAccountId(); UUID EntryId = Buff.getRequiredEntryId(); final String sql = "CALL sp_delete_ac_entry( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtDeleteByPKey == null) { stmtDeleteByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByPKey.setLong(argIdx++, TenantId); stmtDeleteByPKey.setLong(argIdx++, AccountId); stmtDeleteByPKey.setString(argIdx++, EntryId.toString()); stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision()); ; resultSet = stmtDeleteByPKey.executeQuery(); if (resultSet.next()) { int deleteFlag = resultSet.getInt(1); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected 1 record result set to be returned by delete, not 0 rows"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public void deleteAccountEntryByIdIdx(CFAccAuthorization Authorization, long argTenantId, long argAccountId, UUID argEntryId) { final String S_ProcName = "deleteAccountEntryByIdIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_ac_entry_by_ididx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtDeleteByIdIdx == null) { stmtDeleteByIdIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByIdIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByIdIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByIdIdx.setLong(argIdx++, argTenantId); stmtDeleteByIdIdx.setLong(argIdx++, argAccountId); stmtDeleteByIdIdx.setString(argIdx++, argEntryId.toString()); resultSet = stmtDeleteByIdIdx.executeQuery(); if (resultSet.next()) { int deleteFlag = resultSet.getInt(1); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected 1 record result set to be returned by delete, not 0 rows"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public void deleteAccountEntryByIdIdx(CFAccAuthorization Authorization, CFAccAccountEntryPKey argKey) { deleteAccountEntryByIdIdx(Authorization, argKey.getRequiredTenantId(), argKey.getRequiredAccountId(), argKey.getRequiredEntryId()); } public void deleteAccountEntryByUEntryIdx(CFAccAuthorization Authorization, UUID argEntryId) { final String S_ProcName = "deleteAccountEntryByUEntryIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_ac_entry_by_uentryidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtDeleteByUEntryIdx == null) { stmtDeleteByUEntryIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByUEntryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByUEntryIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByUEntryIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByUEntryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByUEntryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByUEntryIdx.setString(argIdx++, argEntryId.toString()); resultSet = stmtDeleteByUEntryIdx.executeQuery(); if (resultSet.next()) { int deleteFlag = resultSet.getInt(1); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected 1 record result set to be returned by delete, not 0 rows"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public void deleteAccountEntryByUEntryIdx(CFAccAuthorization Authorization, CFAccAccountEntryByUEntryIdxKey argKey) { deleteAccountEntryByUEntryIdx(Authorization, argKey.getRequiredEntryId()); } public void deleteAccountEntryByAccTsIdx(CFAccAuthorization Authorization, long argTenantId, long argAccountId, Calendar argEntryStamp) { final String S_ProcName = "deleteAccountEntryByAccTsIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_ac_entry_by_acctsidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "TIMESTAMP_FORMAT( ?, 'YYYY-MM-DD-HH24.MI.SS' )" + " )"; if (stmtDeleteByAccTsIdx == null) { stmtDeleteByAccTsIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByAccTsIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByAccTsIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByAccTsIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByAccTsIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByAccTsIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByAccTsIdx.setLong(argIdx++, argTenantId); stmtDeleteByAccTsIdx.setLong(argIdx++, argAccountId); stmtDeleteByAccTsIdx.setString(argIdx++, CFAccDb2LUWSchema.getTimestampString(argEntryStamp)); resultSet = stmtDeleteByAccTsIdx.executeQuery(); if (resultSet.next()) { int deleteFlag = resultSet.getInt(1); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected 1 record result set to be returned by delete, not 0 rows"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public void deleteAccountEntryByAccTsIdx(CFAccAuthorization Authorization, CFAccAccountEntryByAccTsIdxKey argKey) { deleteAccountEntryByAccTsIdx(Authorization, argKey.getRequiredTenantId(), argKey.getRequiredAccountId(), argKey.getRequiredEntryStamp()); } public void deleteAccountEntryByEStampIdx(CFAccAuthorization Authorization, Calendar argEntryStamp) { final String S_ProcName = "deleteAccountEntryByEStampIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_ac_entry_by_estampidx( ?, ?, ?, ?, ?" + ", " + "TIMESTAMP_FORMAT( ?, 'YYYY-MM-DD-HH24.MI.SS' )" + " )"; if (stmtDeleteByEStampIdx == null) { stmtDeleteByEStampIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByEStampIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByEStampIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByEStampIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByEStampIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByEStampIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByEStampIdx.setString(argIdx++, CFAccDb2LUWSchema.getTimestampString(argEntryStamp)); resultSet = stmtDeleteByEStampIdx.executeQuery(); if (resultSet.next()) { int deleteFlag = resultSet.getInt(1); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected 1 record result set to be returned by delete, not 0 rows"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public void deleteAccountEntryByEStampIdx(CFAccAuthorization Authorization, CFAccAccountEntryByEStampIdxKey argKey) { deleteAccountEntryByEStampIdx(Authorization, argKey.getRequiredEntryStamp()); } public void deleteAccountEntryBySplitIdx(CFAccAuthorization Authorization, UUID argSplitEntryId) { final String S_ProcName = "deleteAccountEntryBySplitIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_ac_entry_by_splitidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtDeleteBySplitIdx == null) { stmtDeleteBySplitIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteBySplitIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteBySplitIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteBySplitIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteBySplitIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteBySplitIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argSplitEntryId != null) { stmtDeleteBySplitIdx.setString(argIdx++, argSplitEntryId.toString()); } else { stmtDeleteBySplitIdx.setNull(argIdx++, java.sql.Types.VARCHAR); } resultSet = stmtDeleteBySplitIdx.executeQuery(); if (resultSet.next()) { int deleteFlag = resultSet.getInt(1); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected 1 record result set to be returned by delete, not 0 rows"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public void deleteAccountEntryBySplitIdx(CFAccAuthorization Authorization, CFAccAccountEntryBySplitIdxKey argKey) { deleteAccountEntryBySplitIdx(Authorization, argKey.getOptionalSplitEntryId()); } public void deleteAccountEntryByTenantIdx(CFAccAuthorization Authorization, long argTenantId) { final String S_ProcName = "deleteAccountEntryByTenantIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_ac_entry_by_tenantidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtDeleteByTenantIdx == null) { stmtDeleteByTenantIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByTenantIdx.setLong(argIdx++, argTenantId); resultSet = stmtDeleteByTenantIdx.executeQuery(); if (resultSet.next()) { int deleteFlag = resultSet.getInt(1); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected 1 record result set to be returned by delete, not 0 rows"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public void deleteAccountEntryByTenantIdx(CFAccAuthorization Authorization, CFAccAccountEntryByTenantIdxKey argKey) { deleteAccountEntryByTenantIdx(Authorization, argKey.getRequiredTenantId()); } public void deleteAccountEntryByAcctIdx(CFAccAuthorization Authorization, long argTenantId, long argAccountId) { final String S_ProcName = "deleteAccountEntryByAcctIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_ac_entry_by_acctidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )"; if (stmtDeleteByAcctIdx == null) { stmtDeleteByAcctIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByAcctIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByAcctIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByAcctIdx.setLong(argIdx++, argTenantId); stmtDeleteByAcctIdx.setLong(argIdx++, argAccountId); resultSet = stmtDeleteByAcctIdx.executeQuery(); if (resultSet.next()) { int deleteFlag = resultSet.getInt(1); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected 1 record result set to be returned by delete, not 0 rows"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public void deleteAccountEntryByAcctIdx(CFAccAuthorization Authorization, CFAccAccountEntryByAcctIdxKey argKey) { deleteAccountEntryByAcctIdx(Authorization, argKey.getRequiredTenantId(), argKey.getRequiredAccountId()); } public void deleteAccountEntryByXfrAcctIdx(CFAccAuthorization Authorization, Long argTransferTenantId, Long argTransferAccountId) { final String S_ProcName = "deleteAccountEntryByXfrAcctIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_ac_entry_by_xfracctidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )"; if (stmtDeleteByXfrAcctIdx == null) { stmtDeleteByXfrAcctIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByXfrAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByXfrAcctIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByXfrAcctIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByXfrAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByXfrAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argTransferTenantId != null) { stmtDeleteByXfrAcctIdx.setLong(argIdx++, argTransferTenantId.longValue()); } else { stmtDeleteByXfrAcctIdx.setNull(argIdx++, java.sql.Types.BIGINT); } if (argTransferAccountId != null) { stmtDeleteByXfrAcctIdx.setLong(argIdx++, argTransferAccountId.longValue()); } else { stmtDeleteByXfrAcctIdx.setNull(argIdx++, java.sql.Types.BIGINT); } resultSet = stmtDeleteByXfrAcctIdx.executeQuery(); if (resultSet.next()) { int deleteFlag = resultSet.getInt(1); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected 1 record result set to be returned by delete, not 0 rows"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public void deleteAccountEntryByXfrAcctIdx(CFAccAuthorization Authorization, CFAccAccountEntryByXfrAcctIdxKey argKey) { deleteAccountEntryByXfrAcctIdx(Authorization, argKey.getOptionalTransferTenantId(), argKey.getOptionalTransferAccountId()); } public void deleteAccountEntryByDrCcyIdx(CFAccAuthorization Authorization, Short argDebitCurrencyId) { final String S_ProcName = "deleteAccountEntryByDrCcyIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_ac_entry_by_drccyidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtDeleteByDrCcyIdx == null) { stmtDeleteByDrCcyIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByDrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByDrCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByDrCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByDrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByDrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argDebitCurrencyId != null) { stmtDeleteByDrCcyIdx.setShort(argIdx++, argDebitCurrencyId.shortValue()); } else { stmtDeleteByDrCcyIdx.setNull(argIdx++, java.sql.Types.SMALLINT); } resultSet = stmtDeleteByDrCcyIdx.executeQuery(); if (resultSet.next()) { int deleteFlag = resultSet.getInt(1); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected 1 record result set to be returned by delete, not 0 rows"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public void deleteAccountEntryByDrCcyIdx(CFAccAuthorization Authorization, CFAccAccountEntryByDrCcyIdxKey argKey) { deleteAccountEntryByDrCcyIdx(Authorization, argKey.getOptionalDebitCurrencyId()); } public void deleteAccountEntryByCrCcyIdx(CFAccAuthorization Authorization, Short argCreditCurrencyId) { final String S_ProcName = "deleteAccountEntryByCrCcyIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_ac_entry_by_crccyidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtDeleteByCrCcyIdx == null) { stmtDeleteByCrCcyIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByCrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByCrCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByCrCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByCrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByCrCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argCreditCurrencyId != null) { stmtDeleteByCrCcyIdx.setShort(argIdx++, argCreditCurrencyId.shortValue()); } else { stmtDeleteByCrCcyIdx.setNull(argIdx++, java.sql.Types.SMALLINT); } resultSet = stmtDeleteByCrCcyIdx.executeQuery(); if (resultSet.next()) { int deleteFlag = resultSet.getInt(1); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected 1 record result set to be returned by delete, not 0 rows"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public void deleteAccountEntryByCrCcyIdx(CFAccAuthorization Authorization, CFAccAccountEntryByCrCcyIdxKey argKey) { deleteAccountEntryByCrCcyIdx(Authorization, argKey.getOptionalCreditCurrencyId()); } public void deleteAccountEntryByCvtCcyIdx(CFAccAuthorization Authorization, short argConvertedCurrencyId) { final String S_ProcName = "deleteAccountEntryByCvtCcyIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_ac_entry_by_cvtccyidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtDeleteByCvtCcyIdx == null) { stmtDeleteByCvtCcyIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByCvtCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByCvtCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByCvtCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByCvtCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByCvtCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByCvtCcyIdx.setShort(argIdx++, argConvertedCurrencyId); resultSet = stmtDeleteByCvtCcyIdx.executeQuery(); if (resultSet.next()) { int deleteFlag = resultSet.getInt(1); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected 1 record result set to be returned by delete, not 0 rows"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public void deleteAccountEntryByCvtCcyIdx(CFAccAuthorization Authorization, CFAccAccountEntryByCvtCcyIdxKey argKey) { deleteAccountEntryByCvtCcyIdx(Authorization, argKey.getRequiredConvertedCurrencyId()); } public void deleteAccountEntryByBalCcyIdx(CFAccAuthorization Authorization, short argBalanceCurrencyId) { final String S_ProcName = "deleteAccountEntryByBalCcyIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_ac_entry_by_balccyidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtDeleteByBalCcyIdx == null) { stmtDeleteByBalCcyIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByBalCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByBalCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByBalCcyIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByBalCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByBalCcyIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByBalCcyIdx.setShort(argIdx++, argBalanceCurrencyId); resultSet = stmtDeleteByBalCcyIdx.executeQuery(); if (resultSet.next()) { int deleteFlag = resultSet.getInt(1); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected 1 record result set to be returned by delete, not 0 rows"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } public void deleteAccountEntryByBalCcyIdx(CFAccAuthorization Authorization, CFAccAccountEntryByBalCcyIdxKey argKey) { deleteAccountEntryByBalCcyIdx(Authorization, argKey.getRequiredBalanceCurrencyId()); } public CFAccCursor openAccountEntryCursorAll(CFAccAuthorization Authorization) { String sql = getSqlSelectAccountEntryBuff() + "ORDER BY " + "acny.TenantId ASC" + ", " + "acny.AccountId ASC" + ", " + "acny.EntryId ASC"; CFAccCursor cursor = new CFAccDb2LUWCursor(Authorization, schema, sql); return (cursor); } public CFAccCursor openAccountEntryCursorByAccTsIdx(CFAccAuthorization Authorization, long TenantId, long AccountId, Calendar EntryStamp) { String sql = getSqlSelectAccountEntryBuff() + "WHERE " + "acny.TenantId = " + Long.toString(TenantId) + " " + "AND " + "acny.AccountId = " + Long.toString(AccountId) + " " + "AND " + "TIMESTAMP_FORMAT( " + CFAccDb2LUWSchema.getTimestampString(EntryStamp) + ", 'YYYY-MM-DD-HH24.MI.SS' ) " + "ORDER BY " + "acny.TenantId ASC" + ", " + "acny.AccountId ASC" + ", " + "acny.EntryId ASC"; CFAccCursor cursor = new CFAccDb2LUWCursor(Authorization, schema, sql); return (cursor); } public CFAccCursor openAccountEntryCursorByEStampIdx(CFAccAuthorization Authorization, Calendar EntryStamp) { String sql = getSqlSelectAccountEntryBuff() + "WHERE " + "TIMESTAMP_FORMAT( " + CFAccDb2LUWSchema.getTimestampString(EntryStamp) + ", 'YYYY-MM-DD-HH24.MI.SS' ) " + "ORDER BY " + "acny.TenantId ASC" + ", " + "acny.AccountId ASC" + ", " + "acny.EntryId ASC"; CFAccCursor cursor = new CFAccDb2LUWCursor(Authorization, schema, sql); return (cursor); } public CFAccCursor openAccountEntryCursorBySplitIdx(CFAccAuthorization Authorization, UUID SplitEntryId) { String sql = getSqlSelectAccountEntryBuff() + "WHERE " + ((SplitEntryId == null) ? "acny.SplitEntryId is null " : "acny.SplitEntryId = '" + SplitEntryId.toString() + "' ") + "ORDER BY " + "acny.TenantId ASC" + ", " + "acny.AccountId ASC" + ", " + "acny.EntryId ASC"; CFAccCursor cursor = new CFAccDb2LUWCursor(Authorization, schema, sql); return (cursor); } public CFAccCursor openAccountEntryCursorByTenantIdx(CFAccAuthorization Authorization, long TenantId) { String sql = getSqlSelectAccountEntryBuff() + "WHERE " + "acny.TenantId = " + Long.toString(TenantId) + " " + "ORDER BY " + "acny.TenantId ASC" + ", " + "acny.AccountId ASC" + ", " + "acny.EntryId ASC"; CFAccCursor cursor = new CFAccDb2LUWCursor(Authorization, schema, sql); return (cursor); } public CFAccCursor openAccountEntryCursorByAcctIdx(CFAccAuthorization Authorization, long TenantId, long AccountId) { String sql = getSqlSelectAccountEntryBuff() + "WHERE " + "acny.TenantId = " + Long.toString(TenantId) + " " + "AND " + "acny.AccountId = " + Long.toString(AccountId) + " " + "ORDER BY " + "acny.TenantId ASC" + ", " + "acny.AccountId ASC" + ", " + "acny.EntryId ASC"; CFAccCursor cursor = new CFAccDb2LUWCursor(Authorization, schema, sql); return (cursor); } public CFAccCursor openAccountEntryCursorByXfrAcctIdx(CFAccAuthorization Authorization, Long TransferTenantId, Long TransferAccountId) { String sql = getSqlSelectAccountEntryBuff() + "WHERE " + ((TransferTenantId == null) ? "acny.XfrTentId is null " : "acny.XfrTentId = " + TransferTenantId.toString() + " ") + "AND " + ((TransferAccountId == null) ? "acny.XfrAcctId is null " : "acny.XfrAcctId = " + TransferAccountId.toString() + " ") + "ORDER BY " + "acny.TenantId ASC" + ", " + "acny.AccountId ASC" + ", " + "acny.EntryId ASC"; CFAccCursor cursor = new CFAccDb2LUWCursor(Authorization, schema, sql); return (cursor); } public CFAccCursor openAccountEntryCursorByDrCcyIdx(CFAccAuthorization Authorization, Short DebitCurrencyId) { String sql = getSqlSelectAccountEntryBuff() + "WHERE " + ((DebitCurrencyId == null) ? "acny.debit_ccyid is null " : "acny.debit_ccyid = " + DebitCurrencyId.toString() + " ") + "ORDER BY " + "acny.TenantId ASC" + ", " + "acny.AccountId ASC" + ", " + "acny.EntryId ASC"; CFAccCursor cursor = new CFAccDb2LUWCursor(Authorization, schema, sql); return (cursor); } public CFAccCursor openAccountEntryCursorByCrCcyIdx(CFAccAuthorization Authorization, Short CreditCurrencyId) { String sql = getSqlSelectAccountEntryBuff() + "WHERE " + ((CreditCurrencyId == null) ? "acny.credit_ccyid is null " : "acny.credit_ccyid = " + CreditCurrencyId.toString() + " ") + "ORDER BY " + "acny.TenantId ASC" + ", " + "acny.AccountId ASC" + ", " + "acny.EntryId ASC"; CFAccCursor cursor = new CFAccDb2LUWCursor(Authorization, schema, sql); return (cursor); } public CFAccCursor openAccountEntryCursorByCvtCcyIdx(CFAccAuthorization Authorization, short ConvertedCurrencyId) { String sql = getSqlSelectAccountEntryBuff() + "WHERE " + "acny.cvt_ccyid = " + Short.toString(ConvertedCurrencyId) + " " + "ORDER BY " + "acny.TenantId ASC" + ", " + "acny.AccountId ASC" + ", " + "acny.EntryId ASC"; CFAccCursor cursor = new CFAccDb2LUWCursor(Authorization, schema, sql); return (cursor); } public CFAccCursor openAccountEntryCursorByBalCcyIdx(CFAccAuthorization Authorization, short BalanceCurrencyId) { String sql = getSqlSelectAccountEntryBuff() + "WHERE " + "acny.bal_ccyid = " + Short.toString(BalanceCurrencyId) + " " + "ORDER BY " + "acny.TenantId ASC" + ", " + "acny.AccountId ASC" + ", " + "acny.EntryId ASC"; CFAccCursor cursor = new CFAccDb2LUWCursor(Authorization, schema, sql); return (cursor); } public void closeAccountEntryCursor(CFAccCursor Cursor) { try { Cursor.getResultSet().close(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), "closeAccountEntryCursor", e); } } public CFAccAccountEntryBuff nextAccountEntryCursor(CFAccCursor Cursor) { final String S_ProcName = "nextAccountEntryCursor"; try { ResultSet resultSet = Cursor.getResultSet(); if (!resultSet.next()) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "No more results available"); } CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); return (buff); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } } public CFAccAccountEntryBuff prevAccountEntryCursor(CFAccCursor Cursor) { int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1; CFAccAccountEntryBuff buff = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { buff = nextAccountEntryCursor(Cursor); } return (buff); } public CFAccAccountEntryBuff firstAccountEntryCursor(CFAccCursor Cursor) { int targetRowIdx = 1; CFAccAccountEntryBuff buff = null; Cursor.reset(); while (Cursor.getRowIdx() < targetRowIdx) { buff = nextAccountEntryCursor(Cursor); } return (buff); } public CFAccAccountEntryBuff lastAccountEntryCursor(CFAccCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastAccountEntryCursor"); } public CFAccAccountEntryBuff nthAccountEntryCursor(CFAccCursor Cursor, int Idx) { int targetRowIdx = Idx; CFAccAccountEntryBuff buff = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { buff = nextAccountEntryCursor(Cursor); } return (buff); } /** * Release the prepared statements. * <p> * When the schema changes connections, the prepared statements * have to be released because they contain connection-specific * information for most databases. */ public void releasePreparedStatements() { final String S_ProcName = "releasePreparedStatements"; S_sqlSelectAccountEntryDistinctClassCode = null; S_sqlSelectAccountEntryBuff = null; if (stmtReadBuffByPKey != null) { try { stmtReadBuffByPKey.close(); } catch (SQLException e) { } stmtReadBuffByPKey = null; } if (stmtReadAllBuff != null) { try { stmtReadAllBuff.close(); } catch (SQLException e) { } stmtReadAllBuff = null; } if (stmtLockBuffByPKey != null) { try { stmtLockBuffByPKey.close(); } catch (SQLException e) { } stmtLockBuffByPKey = null; } if (stmtCreateByPKey != null) { try { stmtCreateByPKey.close(); } catch (SQLException e) { } stmtCreateByPKey = null; } if (stmtUpdateByPKey != null) { try { stmtUpdateByPKey.close(); } catch (SQLException e) { } stmtUpdateByPKey = null; } if (stmtDeleteByPKey != null) { try { stmtDeleteByPKey.close(); } catch (SQLException e) { } stmtDeleteByPKey = null; } if (stmtDeleteByIdIdx != null) { try { stmtDeleteByIdIdx.close(); } catch (SQLException e) { } stmtDeleteByIdIdx = null; } if (stmtDeleteByUEntryIdx != null) { try { stmtDeleteByUEntryIdx.close(); } catch (SQLException e) { } stmtDeleteByUEntryIdx = null; } if (stmtDeleteByAccTsIdx != null) { try { stmtDeleteByAccTsIdx.close(); } catch (SQLException e) { } stmtDeleteByAccTsIdx = null; } if (stmtDeleteByEStampIdx != null) { try { stmtDeleteByEStampIdx.close(); } catch (SQLException e) { } stmtDeleteByEStampIdx = null; } if (stmtDeleteBySplitIdx != null) { try { stmtDeleteBySplitIdx.close(); } catch (SQLException e) { } stmtDeleteBySplitIdx = null; } if (stmtDeleteByTenantIdx != null) { try { stmtDeleteByTenantIdx.close(); } catch (SQLException e) { } stmtDeleteByTenantIdx = null; } if (stmtDeleteByAcctIdx != null) { try { stmtDeleteByAcctIdx.close(); } catch (SQLException e) { } stmtDeleteByAcctIdx = null; } if (stmtDeleteByXfrAcctIdx != null) { try { stmtDeleteByXfrAcctIdx.close(); } catch (SQLException e) { } stmtDeleteByXfrAcctIdx = null; } if (stmtDeleteByDrCcyIdx != null) { try { stmtDeleteByDrCcyIdx.close(); } catch (SQLException e) { } stmtDeleteByDrCcyIdx = null; } if (stmtDeleteByCrCcyIdx != null) { try { stmtDeleteByCrCcyIdx.close(); } catch (SQLException e) { } stmtDeleteByCrCcyIdx = null; } if (stmtDeleteByCvtCcyIdx != null) { try { stmtDeleteByCvtCcyIdx.close(); } catch (SQLException e) { } stmtDeleteByCvtCcyIdx = null; } if (stmtDeleteByBalCcyIdx != null) { try { stmtDeleteByBalCcyIdx.close(); } catch (SQLException e) { } stmtDeleteByBalCcyIdx = null; } if (stmtReadAllBuff != null) { try { stmtReadAllBuff.close(); } catch (SQLException e) { } stmtReadAllBuff = null; } if (stmtReadBuffByIdIdx != null) { try { stmtReadBuffByIdIdx.close(); } catch (SQLException e) { } stmtReadBuffByIdIdx = null; } if (stmtReadBuffByUEntryIdx != null) { try { stmtReadBuffByUEntryIdx.close(); } catch (SQLException e) { } stmtReadBuffByUEntryIdx = null; } if (stmtReadBuffByAccTsIdx != null) { try { stmtReadBuffByAccTsIdx.close(); } catch (SQLException e) { } stmtReadBuffByAccTsIdx = null; } if (stmtReadBuffByEStampIdx != null) { try { stmtReadBuffByEStampIdx.close(); } catch (SQLException e) { } stmtReadBuffByEStampIdx = null; } if (stmtReadBuffBySplitIdx != null) { try { stmtReadBuffBySplitIdx.close(); } catch (SQLException e) { } stmtReadBuffBySplitIdx = null; } if (stmtReadBuffByTenantIdx != null) { try { stmtReadBuffByTenantIdx.close(); } catch (SQLException e) { } stmtReadBuffByTenantIdx = null; } if (stmtReadBuffByAcctIdx != null) { try { stmtReadBuffByAcctIdx.close(); } catch (SQLException e) { } stmtReadBuffByAcctIdx = null; } if (stmtReadBuffByXfrAcctIdx != null) { try { stmtReadBuffByXfrAcctIdx.close(); } catch (SQLException e) { } stmtReadBuffByXfrAcctIdx = null; } if (stmtReadBuffByDrCcyIdx != null) { try { stmtReadBuffByDrCcyIdx.close(); } catch (SQLException e) { } stmtReadBuffByDrCcyIdx = null; } if (stmtReadBuffByCrCcyIdx != null) { try { stmtReadBuffByCrCcyIdx.close(); } catch (SQLException e) { } stmtReadBuffByCrCcyIdx = null; } if (stmtReadBuffByCvtCcyIdx != null) { try { stmtReadBuffByCvtCcyIdx.close(); } catch (SQLException e) { } stmtReadBuffByCvtCcyIdx = null; } if (stmtReadBuffByBalCcyIdx != null) { try { stmtReadBuffByBalCcyIdx.close(); } catch (SQLException e) { } stmtReadBuffByBalCcyIdx = null; } } }