Example usage for java.lang Short shortValue

List of usage examples for java.lang Short shortValue

Introduction

In this page you can find the example usage for java.lang Short shortValue.

Prototype

@HotSpotIntrinsicCandidate
public short shortValue() 

Source Link

Document

Returns the value of this Short as a short .

Usage

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWAccountEntryTable.java

public void deleteAccountEntryByCrCcyIdx(CFAccAuthorization Authorization, Short argCreditCurrencyId) {
    final String S_ProcName = "deleteAccountEntryByCrCcyIdx";
    ResultSet resultSet = null;/*from  w  ww  .j a v a2 s  . c  o m*/
    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;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMySql.CFAccMySqlAccountEntryTable.java

public void deleteAccountEntryByDrCcyIdx(CFAccAuthorization Authorization, Short argDebitCurrencyId) {
    final String S_ProcName = "deleteAccountEntryByDrCcyIdx";
    ResultSet resultSet = null;/* ww  w .  java 2s  .  c  om*/
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerSchemaDbName() + ".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);
        }
        stmtDeleteByDrCcyIdx.executeUpdate();
    } 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.CFAccMySql.CFAccMySqlAccountEntryTable.java

public void deleteAccountEntryByCrCcyIdx(CFAccAuthorization Authorization, Short argCreditCurrencyId) {
    final String S_ProcName = "deleteAccountEntryByCrCcyIdx";
    ResultSet resultSet = null;//  w  ww. j ava2s.c  o  m
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerSchemaDbName() + ".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);
        }
        stmtDeleteByCrCcyIdx.executeUpdate();
    } 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.CFAccMySql.CFAccMySqlAccountEntryTable.java

public CFAccAccountEntryBuff[] readBuffByDrCcyIdx(CFAccAuthorization Authorization, Short DebitCurrencyId) {
    final String S_ProcName = "readBuffByDrCcyIdx";
    ResultSet resultSet = null;// w w w  .  j  a  v  a  2  s  .  c  om
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerSchemaDbName() + ".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);
        }
        try {
            resultSet = stmtReadBuffByDrCcyIdx.executeQuery();
        } catch (SQLException e) {
            if (e.getErrorCode() != 1329) {
                throw e;
            }
            resultSet = null;
        }
        List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>();
        while ((resultSet != null) && 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;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMySql.CFAccMySqlAccountEntryTable.java

public CFAccAccountEntryBuff[] readBuffByCrCcyIdx(CFAccAuthorization Authorization, Short CreditCurrencyId) {
    final String S_ProcName = "readBuffByCrCcyIdx";
    ResultSet resultSet = null;/*from w w  w. j av a 2  s  .  c o m*/
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerSchemaDbName() + ".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);
        }
        try {
            resultSet = stmtReadBuffByCrCcyIdx.executeQuery();
        } catch (SQLException e) {
            if (e.getErrorCode() != 1329) {
                throw e;
            }
            resultSet = null;
        }
        List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>();
        while ((resultSet != null) && 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;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbPgSql.CFGenKbPgSqlNmTokenFormatterTable.java

public void updateNmTokenFormatter(CFGenKbAuthorization Authorization, CFGenKbNmTokenFormatterBuff Buff) {
    final String S_ProcName = "updateNmTokenFormatter";
    ResultSet resultSet = null;//ww  w.j a  v a  2s. c o  m
    try {
        String ClassCode = Buff.getClassCode();
        long TenantId = Buff.getRequiredTenantId();
        long CartridgeId = Buff.getRequiredCartridgeId();
        int ItemId = Buff.getRequiredItemId();
        short RuleTypeId = Buff.getRequiredRuleTypeId();
        String Name = Buff.getRequiredName();
        short ToolSetId = Buff.getRequiredToolSetId();
        Short ScopeDefId = Buff.getOptionalScopeDefId();
        short GenDefId = Buff.getRequiredGenDefId();
        Integer GelExecutableId = Buff.getOptionalGelExecutableId();
        int Revision = Buff.getRequiredRevision();
        Connection cnx = schema.getCnx();
        String sql = "select * from " + schema.getLowerSchemaDbName()
                + ".sp_update_kbnmtokenfmt( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )";
        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++, ClassCode);
        stmtUpdateByPKey.setLong(argIdx++, TenantId);
        stmtUpdateByPKey.setLong(argIdx++, CartridgeId);
        stmtUpdateByPKey.setInt(argIdx++, ItemId);
        stmtUpdateByPKey.setShort(argIdx++, RuleTypeId);
        stmtUpdateByPKey.setString(argIdx++, Name);
        stmtUpdateByPKey.setShort(argIdx++, ToolSetId);
        if (ScopeDefId != null) {
            stmtUpdateByPKey.setShort(argIdx++, ScopeDefId.shortValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        stmtUpdateByPKey.setShort(argIdx++, GenDefId);
        if (GelExecutableId != null) {
            stmtUpdateByPKey.setInt(argIdx++, GelExecutableId.intValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.INTEGER);
        }
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        resultSet = stmtUpdateByPKey.executeQuery();
        if (resultSet.next()) {
            CFGenKbNmTokenFormatterBuff updatedBuff = unpackNmTokenFormatterResultSetToBuff(resultSet);
            if (resultSet.next()) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response");
            }
            Buff.setRequiredRuleTypeId(updatedBuff.getRequiredRuleTypeId());
            Buff.setRequiredName(updatedBuff.getRequiredName());
            Buff.setRequiredToolSetId(updatedBuff.getRequiredToolSetId());
            Buff.setOptionalScopeDefId(updatedBuff.getOptionalScopeDefId());
            Buff.setRequiredGenDefId(updatedBuff.getRequiredGenDefId());
            Buff.setOptionalGelExecutableId(updatedBuff.getOptionalGelExecutableId());
            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 CFAccAccountEntryBuff[] readBuffByDrCcyIdx(CFAccAuthorization Authorization, Short DebitCurrencyId) {
    final String S_ProcName = "readBuffByDrCcyIdx";
    ResultSet resultSet = null;//w  w w  .ja va  2  s .co m
    try {
        Connection cnx = schema.getCnx();
        String sql = "SELECT * FROM " + schema.getLowerSchemaDbName()
                + ".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;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccPgSql.CFAccPgSqlAccountEntryTable.java

public CFAccAccountEntryBuff[] readBuffByCrCcyIdx(CFAccAuthorization Authorization, Short CreditCurrencyId) {
    final String S_ProcName = "readBuffByCrCcyIdx";
    ResultSet resultSet = null;/*w  w  w  .  j a  v  a 2 s .c om*/
    try {
        Connection cnx = schema.getCnx();
        String sql = "SELECT * FROM " + schema.getLowerSchemaDbName()
                + ".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;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmDb2LUW.CFCrmDb2LUWAddressTable.java

public void createAddress(CFCrmAuthorization Authorization, CFCrmAddressBuff Buff) {
    final String S_ProcName = "createAddress";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//  ww  w .j  av  a2s . c  om
    ResultSet resultSet = null;
    try {
        long TenantId = Buff.getRequiredTenantId();
        long ContactId = Buff.getRequiredContactId();
        String Description = Buff.getRequiredDescription();
        String AddrLine1 = Buff.getOptionalAddrLine1();
        String AddrLine2 = Buff.getOptionalAddrLine2();
        String City = Buff.getOptionalCity();
        String State = Buff.getOptionalState();
        Short CountryId = Buff.getOptionalCountryId();
        String Zip = Buff.getOptionalZip();
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_create_address( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )";
        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++, "ADR");
        stmtCreateByPKey.setLong(argIdx++, TenantId);
        stmtCreateByPKey.setLong(argIdx++, ContactId);
        stmtCreateByPKey.setString(argIdx++, Description);
        if (AddrLine1 != null) {
            stmtCreateByPKey.setString(argIdx++, AddrLine1);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (AddrLine2 != null) {
            stmtCreateByPKey.setString(argIdx++, AddrLine2);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (City != null) {
            stmtCreateByPKey.setString(argIdx++, City);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (State != null) {
            stmtCreateByPKey.setString(argIdx++, State);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (CountryId != null) {
            stmtCreateByPKey.setShort(argIdx++, CountryId.shortValue());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        if (Zip != null) {
            stmtCreateByPKey.setString(argIdx++, Zip);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        resultSet = stmtCreateByPKey.executeQuery();
        if (resultSet.next()) {
            CFCrmAddressBuff createdBuff = unpackAddressResultSetToBuff(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.setRequiredAddressId(createdBuff.getRequiredAddressId());
            Buff.setRequiredContactId(createdBuff.getRequiredContactId());
            Buff.setRequiredDescription(createdBuff.getRequiredDescription());
            Buff.setOptionalAddrLine1(createdBuff.getOptionalAddrLine1());
            Buff.setOptionalAddrLine2(createdBuff.getOptionalAddrLine2());
            Buff.setOptionalCity(createdBuff.getOptionalCity());
            Buff.setOptionalState(createdBuff.getOptionalState());
            Buff.setOptionalCountryId(createdBuff.getOptionalCountryId());
            Buff.setOptionalZip(createdBuff.getOptionalZip());
            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 deleteAccountEntryByDrCcyIdx(CFAccAuthorization Authorization, Short argDebitCurrencyId) {
    final String S_ProcName = "deleteAccountEntryByDrCcyIdx";
    ResultSet resultSet = null;// www . j a  va  2  s.  co  m
    try {
        Connection cnx = schema.getCnx();
        String sql = "SELECT " + schema.getLowerSchemaDbName()
                + ".sp_delete_ac_entry_by_drccyidx( ?, ?, ?, ?, ?" + ", " + "?" + " ) as DeletedFlag";
        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()) {
            boolean deleteFlag = resultSet.getBoolean(1);
            if (resultSet.next()) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response");
            }
        } 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;
        }
    }
}