List of usage examples for java.lang Short shortValue
@HotSpotIntrinsicCandidate public short shortValue()
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMySql.CFAccMySqlAccountEntryTable.java
public void updateAccountEntry(CFAccAuthorization Authorization, CFAccAccountEntryBuff Buff) { final String S_ProcName = "updateAccountEntry"; ResultSet resultSet = null;//from ww w. ja v a 2s . co m 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(); String sql = "call " + schema.getLowerSchemaDbName() + ".sp_update_ac_entry( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "timestamp( ? )" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; 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++, CFAccMySqlSchema.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); try { resultSet = stmtUpdateByPKey.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } if ((resultSet != null) && resultSet.next()) { CFAccAccountEntryBuff updatedBuff = unpackAccountEntryResultSetToBuff(resultSet); if ((resultSet != null) && 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; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWAccountEntryTable.java
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"); }//from w w w . j a va 2 s . co m 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; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMSSql.CFAccMSSqlAccountEntryTable.java
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"); }//from w ww . ja v a 2 s.c o m 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(); String sql = "exec sp_create_ac_entry ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"; 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++, CFAccMSSqlSchema.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); stmtCreateByPKey.execute(); boolean moreResults = true; resultSet = null; while (resultSet == null) { try { moreResults = stmtCreateByPKey.getMoreResults(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } if (moreResults) { try { resultSet = stmtCreateByPKey.getResultSet(); } catch (SQLException e) { } } else if (-1 == stmtCreateByPKey.getUpdateCount()) { break; } } if (resultSet == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "resultSet"); } 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; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccPgSql.CFAccPgSqlAccountEntryTable.java
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"); }// w ww . j a v a2 s .c o m 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(); String sql = "select * from " + schema.getLowerSchemaDbName() + ".sp_create_ac_entry( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "cast( to_timestamp( ?, 'YYYY-MM-DD HH24:MI:SS' ) as timestamp )" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; 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++, CFAccPgSqlSchema.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()) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response"); } 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; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMSSql.CFAccMSSqlAccountEntryTable.java
public void updateAccountEntry(CFAccAuthorization Authorization, CFAccAccountEntryBuff Buff) { final String S_ProcName = "updateAccountEntry"; ResultSet resultSet = null;/*from w ww. j a v a 2 s . c o m*/ 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(); String sql = "exec sp_update_ac_entry ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"; 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++, CFAccMSSqlSchema.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); stmtUpdateByPKey.execute(); boolean moreResults = true; resultSet = null; while (resultSet == null) { try { moreResults = stmtUpdateByPKey.getMoreResults(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } if (moreResults) { try { resultSet = stmtUpdateByPKey.getResultSet(); } catch (SQLException e) { } } else if (-1 == stmtUpdateByPKey.getUpdateCount()) { break; } } if (resultSet == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "resultSet"); } 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; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccPgSql.CFAccPgSqlAccountEntryTable.java
public void updateAccountEntry(CFAccAuthorization Authorization, CFAccAccountEntryBuff Buff) { final String S_ProcName = "updateAccountEntry"; ResultSet resultSet = null;//w ww. ja va 2s . com 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(); String sql = "select * from " + schema.getLowerSchemaDbName() + ".sp_update_ac_entry( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "cast( to_timestamp( ?, 'YYYY-MM-DD HH24:MI:SS' ) as timestamp )" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; 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++, CFAccPgSqlSchema.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()) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response"); } 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; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleAccountEntryTable.java
public void updateAccountEntry(CFAccAuthorization Authorization, CFAccAccountEntryBuff Buff) { final String S_ProcName = "updateAccountEntry"; ResultSet resultSet = null;/*w w w . ja v a 2 s . c o m*/ Connection cnx = schema.getCnx(); CallableStatement stmtUpdateByPKey = null; List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>(); 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(); stmtUpdateByPKey = cnx.prepareCall("begin " + schema.getLowerSchemaDbName() + ".upd_ac_entry( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "to_timestamp( ?, 'YYYY-MM-DD HH24:MI:SS' )" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); end;"); int argIdx = 1; stmtUpdateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR); 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++, CFAccOracleSchema.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); stmtUpdateByPKey.execute(); resultSet = (ResultSet) stmtUpdateByPKey.getObject(1); if (resultSet != null) { try { 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().newRuntimeException(getClass(), S_ProcName, "upd_ac_entry() did not return a valid result cursor"); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "upd_ac_entry() did not return a result cursor"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } if (stmtUpdateByPKey != null) { try { stmtUpdateByPKey.close(); } catch (SQLException e) { } stmtUpdateByPKey = null; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleAccountEntryTable.java
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"); }//from w w w . j a va2 s .c o m ResultSet resultSet = null; CallableStatement stmtCreateByPKey = 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(); stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerSchemaDbName() + ".crt_ac_entry( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "to_timestamp( ?, 'YYYY-MM-DD HH24:MI:SS' )" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtCreateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR); 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++, CFAccOracleSchema.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); stmtCreateByPKey.execute(); resultSet = (ResultSet) stmtCreateByPKey.getObject(1); if (resultSet == null) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "crt_ac_entry() did not return a result set"); } try { 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().newRuntimeException(getClass(), S_ProcName, "crt_ac_entry() did not return a valid result set"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } if (stmtCreateByPKey != null) { try { stmtCreateByPKey.close(); } catch (SQLException e) { } stmtCreateByPKey = null; } } }
From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbPgSql.CFGenKbPgSqlNmTokenFormatterTable.java
public void createNmTokenFormatter(CFGenKbAuthorization Authorization, CFGenKbNmTokenFormatterBuff Buff) { final String S_ProcName = "createNmTokenFormatter"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }//from w w w. j ava 2 s. c o m ResultSet resultSet = null; try { String ClassCode = Buff.getClassCode(); long TenantId = Buff.getRequiredTenantId(); long CartridgeId = Buff.getRequiredCartridgeId(); short RuleTypeId = Buff.getRequiredRuleTypeId(); String Name = Buff.getRequiredName(); short ToolSetId = Buff.getRequiredToolSetId(); Short ScopeDefId = Buff.getOptionalScopeDefId(); short GenDefId = Buff.getRequiredGenDefId(); Integer GelExecutableId = Buff.getOptionalGelExecutableId(); Connection cnx = schema.getCnx(); String sql = "select * from " + schema.getLowerSchemaDbName() + ".sp_create_kbnmtokenfmt( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; 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++, ClassCode); stmtCreateByPKey.setLong(argIdx++, TenantId); stmtCreateByPKey.setLong(argIdx++, CartridgeId); stmtCreateByPKey.setShort(argIdx++, RuleTypeId); stmtCreateByPKey.setString(argIdx++, Name); stmtCreateByPKey.setShort(argIdx++, ToolSetId); if (ScopeDefId != null) { stmtCreateByPKey.setShort(argIdx++, ScopeDefId.shortValue()); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } stmtCreateByPKey.setShort(argIdx++, GenDefId); if (GelExecutableId != null) { stmtCreateByPKey.setInt(argIdx++, GelExecutableId.intValue()); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.INTEGER); } resultSet = stmtCreateByPKey.executeQuery(); if (resultSet.next()) { CFGenKbNmTokenFormatterBuff createdBuff = unpackNmTokenFormatterResultSetToBuff(resultSet); if (resultSet.next()) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response"); } Buff.setRequiredTenantId(createdBuff.getRequiredTenantId()); Buff.setRequiredCartridgeId(createdBuff.getRequiredCartridgeId()); Buff.setRequiredItemId(createdBuff.getRequiredItemId()); Buff.setRequiredRuleTypeId(createdBuff.getRequiredRuleTypeId()); Buff.setRequiredName(createdBuff.getRequiredName()); Buff.setRequiredToolSetId(createdBuff.getRequiredToolSetId()); Buff.setOptionalScopeDefId(createdBuff.getOptionalScopeDefId()); Buff.setRequiredGenDefId(createdBuff.getRequiredGenDefId()); Buff.setOptionalGelExecutableId(createdBuff.getOptionalGelExecutableId()); Buff.setRequiredRevision(createdBuff.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; } } }
From source file:com.ah.ui.actions.hiveap.HiveApUpdateAction.java
/** * * @param initIds -/*w w w . j a va2 s.c o m*/ * @param supportPlatforms - * @param supportVer - */ private void generateFilteredMessage(Set<Long> initIds, short[] supportPlatforms, String supportVer) { boolean hasUnsupportVer = false; boolean hasUnsupportPlat = false; String query = "select softVer, hiveApModel from " + HiveAp.class.getCanonicalName(); List<?> list = QueryUtil.executeQuery(query, null, new FilterParams("id", initIds)); Arrays.sort(supportPlatforms); for (Object object : list) { Object[] objects = (Object[]) object; String deviceVer = (String) objects[0]; Short platform = (Short) objects[1]; if (NmsUtil.compareSoftwareVersion(deviceVer, supportVer) < 0) { hasUnsupportVer = true; break; } if (null != platform) { int pos = Arrays.binarySearch(supportPlatforms, platform.shortValue()); if (pos < 0) { hasUnsupportPlat = true; break; } } } if (hasUnsupportVer) { unsupportedApsMessage = MgrUtil.getUserMessage("error.hiveAp.feature.discard.unsupport.version", supportVer); } if (hasUnsupportPlat) { addActionPermanentErrorMsg(MgrUtil.getUserMessage("error.hiveAp.feature.discard.unsupport.model", LSevenSignatures.getAllSupportedPlatformsString())); } }