Example usage for java.sql CallableStatement setNull

List of usage examples for java.sql CallableStatement setNull

Introduction

In this page you can find the example usage for java.sql CallableStatement setNull.

Prototype

void setNull(String parameterName, int sqlType) throws SQLException;

Source Link

Document

Sets the designated parameter to SQL NULL.

Usage

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleAccountEntryTable.java

public CFAccAccountEntryBuff[] readBuffBySplitIdx(CFAccAuthorization Authorization, UUID SplitEntryId) {
    final String S_ProcName = "readBuffBySplitIdx";
    ResultSet resultSet = null;/*w w w  .  java2  s .  c  o  m*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffBySplitIdx = null;
    List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>();
    try {
        stmtReadBuffBySplitIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_ac_entrybysplitidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffBySplitIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        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);
        }
        stmtReadBuffBySplitIdx.execute();
        resultSet = (ResultSet) stmtReadBuffBySplitIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        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;
        }
        if (stmtReadBuffBySplitIdx != null) {
            try {
                stmtReadBuffBySplitIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffBySplitIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleAccountEntryTable.java

public CFAccAccountEntryBuff[] readBuffByDrCcyIdx(CFAccAuthorization Authorization, Short DebitCurrencyId) {
    final String S_ProcName = "readBuffByDrCcyIdx";
    ResultSet resultSet = null;//from w w  w . ja va2 s  . c o m
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByDrCcyIdx = null;
    List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>();
    try {
        stmtReadBuffByDrCcyIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_ac_entrybydrccyidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByDrCcyIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        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);
        }
        stmtReadBuffByDrCcyIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByDrCcyIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        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;
        }
        if (stmtReadBuffByDrCcyIdx != null) {
            try {
                stmtReadBuffByDrCcyIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByDrCcyIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleAccountEntryTable.java

public CFAccAccountEntryBuff[] readBuffByCrCcyIdx(CFAccAuthorization Authorization, Short CreditCurrencyId) {
    final String S_ProcName = "readBuffByCrCcyIdx";
    ResultSet resultSet = null;/*from   w  ww  .java2 s.c  o m*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByCrCcyIdx = null;
    List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>();
    try {
        stmtReadBuffByCrCcyIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_ac_entrybycrccyidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByCrCcyIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        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);
        }
        stmtReadBuffByCrCcyIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByCrCcyIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        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;
        }
        if (stmtReadBuffByCrCcyIdx != null) {
            try {
                stmtReadBuffByCrCcyIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByCrCcyIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleAccountConfigTable.java

public void updateAccountConfig(CFAccAuthorization Authorization, CFAccAccountConfigBuff Buff) {
    final String S_ProcName = "updateAccountConfig";
    ResultSet resultSet = null;// w  w w .  j a  v  a2 s. co  m
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFAccAccountConfigBuff> buffList = new LinkedList<CFAccAccountConfigBuff>();
    try {
        long TenantId = Buff.getRequiredTenantId();
        short DefaultCurrencyId = Buff.getRequiredDefaultCurrencyId();
        Long CustContactListTenantId = Buff.getOptionalCustContactListTenantId();
        Long CustContactListId = Buff.getOptionalCustContactListId();
        Long EmpContactListTenantId = Buff.getOptionalEmpContactListTenantId();
        Long EmpContactListId = Buff.getOptionalEmpContactListId();
        Long VendContactListTenantId = Buff.getOptionalVendContactListTenantId();
        Long VendContactListId = Buff.getOptionalVendContactListId();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".upd_acct_cfg( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); 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++, "ACFG");
        stmtUpdateByPKey.setLong(argIdx++, TenantId);
        stmtUpdateByPKey.setShort(argIdx++, DefaultCurrencyId);
        if (CustContactListTenantId != null) {
            stmtUpdateByPKey.setLong(argIdx++, CustContactListTenantId.longValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        if (CustContactListId != null) {
            stmtUpdateByPKey.setLong(argIdx++, CustContactListId.longValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        if (EmpContactListTenantId != null) {
            stmtUpdateByPKey.setLong(argIdx++, EmpContactListTenantId.longValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        if (EmpContactListId != null) {
            stmtUpdateByPKey.setLong(argIdx++, EmpContactListId.longValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        if (VendContactListTenantId != null) {
            stmtUpdateByPKey.setLong(argIdx++, VendContactListTenantId.longValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        if (VendContactListId != null) {
            stmtUpdateByPKey.setLong(argIdx++, VendContactListId.longValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
        if (resultSet != null) {
            try {
                if (resultSet.next()) {
                    CFAccAccountConfigBuff updatedBuff = unpackAccountConfigResultSetToBuff(resultSet);
                    if (resultSet.next()) {
                        resultSet.last();
                        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                                "Did not expect multi-record response, " + resultSet.getRow()
                                        + " rows selected");
                    }
                    Buff.setRequiredDefaultCurrencyId(updatedBuff.getRequiredDefaultCurrencyId());
                    Buff.setOptionalCustContactListTenantId(updatedBuff.getOptionalCustContactListTenantId());
                    Buff.setOptionalCustContactListId(updatedBuff.getOptionalCustContactListId());
                    Buff.setOptionalEmpContactListTenantId(updatedBuff.getOptionalEmpContactListTenantId());
                    Buff.setOptionalEmpContactListId(updatedBuff.getOptionalEmpContactListId());
                    Buff.setOptionalVendContactListTenantId(updatedBuff.getOptionalVendContactListTenantId());
                    Buff.setOptionalVendContactListId(updatedBuff.getOptionalVendContactListId());
                    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_acct_cfg() 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_acct_cfg() 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 CFAccAccountEntryBuff[] readBuffByXfrAcctIdx(CFAccAuthorization Authorization, Long TransferTenantId,
        Long TransferAccountId) {
    final String S_ProcName = "readBuffByXfrAcctIdx";
    ResultSet resultSet = null;//from www.j a  v  a2s .co m
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByXfrAcctIdx = null;
    List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>();
    try {
        stmtReadBuffByXfrAcctIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_ac_entrybyxfracctidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByXfrAcctIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        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);
        }
        stmtReadBuffByXfrAcctIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByXfrAcctIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        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;
        }
        if (stmtReadBuffByXfrAcctIdx != null) {
            try {
                stmtReadBuffByXfrAcctIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByXfrAcctIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswOracle.CFFswOracleFSSFExtensionTable.java

public void createFSSFExtension(CFFswAuthorization Authorization, CFFswFSSFExtensionBuff Buff) {
    final String S_ProcName = "createFSSFExtension";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/* w  ww . j a v  a  2s.  co m*/
    ResultSet resultSet = null;
    CallableStatement stmtCreateByPKey = null;
    try {
        long TenantId = Buff.getRequiredTenantId();
        long FSSFExtensionId = Buff.getRequiredFSSFExtensionId();
        long FSSFDirectoryId = Buff.getRequiredFSSFDirectoryId();
        String Name = Buff.getRequiredName();
        String Password = Buff.getRequiredPassword();
        String TollAllow = Buff.getRequiredTollAllow();
        String AccountCode = Buff.getOptionalAccountCode();
        String UserContext = Buff.getRequiredUserContext();
        String EffectiveCallerIdName = Buff.getRequiredEffectiveCallerIdName();
        String EffectiveCallerIdNumber = Buff.getRequiredEffectiveCallerIdNumber();
        String OutboundCallerIdName = Buff.getRequiredOutboundCallerIdName();
        String OutboundCallerIdNumber = Buff.getRequiredOutboundCallerIdNumber();
        String CallGroup = Buff.getRequiredCallGroup();
        int VMDiskQuota = Buff.getRequiredVMDiskQuota();
        String VMMailTo = Buff.getRequiredVMMailTo();
        String VMNotifyMailTo = Buff.getRequiredVMNotifyMailTo();
        String VMPassword = Buff.getRequiredVMPassword();
        boolean VMEmailAllMessages = Buff.getRequiredVMEmailAllMessages();
        boolean VMNotifyEmailAllMessages = Buff.getRequiredVMNotifyEmailAllMessages();
        boolean VMKeepLocalAfterEMail = Buff.getRequiredVMKeepLocalAfterEMail();
        boolean VMAttachFile = Buff.getRequiredVMAttachFile();
        String EMailEMailFrom = Buff.getRequiredEMailEMailFrom();
        String VMMessageExt = Buff.getRequiredVMMessageExt();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".crt_fssfext( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); 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++, "FSEX");
        stmtCreateByPKey.setLong(argIdx++, TenantId);
        stmtCreateByPKey.setLong(argIdx++, FSSFExtensionId);
        stmtCreateByPKey.setLong(argIdx++, FSSFDirectoryId);
        stmtCreateByPKey.setString(argIdx++, Name);
        stmtCreateByPKey.setString(argIdx++, Password);
        stmtCreateByPKey.setString(argIdx++, TollAllow);
        if (AccountCode != null) {
            stmtCreateByPKey.setString(argIdx++, AccountCode);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtCreateByPKey.setString(argIdx++, UserContext);
        stmtCreateByPKey.setString(argIdx++, EffectiveCallerIdName);
        stmtCreateByPKey.setString(argIdx++, EffectiveCallerIdNumber);
        stmtCreateByPKey.setString(argIdx++, OutboundCallerIdName);
        stmtCreateByPKey.setString(argIdx++, OutboundCallerIdNumber);
        stmtCreateByPKey.setString(argIdx++, CallGroup);
        stmtCreateByPKey.setInt(argIdx++, VMDiskQuota);
        stmtCreateByPKey.setString(argIdx++, VMMailTo);
        stmtCreateByPKey.setString(argIdx++, VMNotifyMailTo);
        stmtCreateByPKey.setString(argIdx++, VMPassword);
        if (VMEmailAllMessages) {
            stmtCreateByPKey.setString(argIdx++, "Y");
        } else {
            stmtCreateByPKey.setString(argIdx++, "N");
        }
        if (VMNotifyEmailAllMessages) {
            stmtCreateByPKey.setString(argIdx++, "Y");
        } else {
            stmtCreateByPKey.setString(argIdx++, "N");
        }
        if (VMKeepLocalAfterEMail) {
            stmtCreateByPKey.setString(argIdx++, "Y");
        } else {
            stmtCreateByPKey.setString(argIdx++, "N");
        }
        if (VMAttachFile) {
            stmtCreateByPKey.setString(argIdx++, "Y");
        } else {
            stmtCreateByPKey.setString(argIdx++, "N");
        }
        stmtCreateByPKey.setString(argIdx++, EMailEMailFrom);
        stmtCreateByPKey.setString(argIdx++, VMMessageExt);
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_fssfext() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFFswFSSFExtensionBuff createdBuff = unpackFSSFExtensionResultSetToBuff(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.setRequiredFSSFExtensionId(createdBuff.getRequiredFSSFExtensionId());
                Buff.setRequiredFSSFDirectoryId(createdBuff.getRequiredFSSFDirectoryId());
                Buff.setRequiredName(createdBuff.getRequiredName());
                Buff.setRequiredPassword(createdBuff.getRequiredPassword());
                Buff.setRequiredTollAllow(createdBuff.getRequiredTollAllow());
                Buff.setOptionalAccountCode(createdBuff.getOptionalAccountCode());
                Buff.setRequiredUserContext(createdBuff.getRequiredUserContext());
                Buff.setRequiredEffectiveCallerIdName(createdBuff.getRequiredEffectiveCallerIdName());
                Buff.setRequiredEffectiveCallerIdNumber(createdBuff.getRequiredEffectiveCallerIdNumber());
                Buff.setRequiredOutboundCallerIdName(createdBuff.getRequiredOutboundCallerIdName());
                Buff.setRequiredOutboundCallerIdNumber(createdBuff.getRequiredOutboundCallerIdNumber());
                Buff.setRequiredCallGroup(createdBuff.getRequiredCallGroup());
                Buff.setRequiredVMDiskQuota(createdBuff.getRequiredVMDiskQuota());
                Buff.setRequiredVMMailTo(createdBuff.getRequiredVMMailTo());
                Buff.setRequiredVMNotifyMailTo(createdBuff.getRequiredVMNotifyMailTo());
                Buff.setRequiredVMPassword(createdBuff.getRequiredVMPassword());
                Buff.setRequiredVMEmailAllMessages(createdBuff.getRequiredVMEmailAllMessages());
                Buff.setRequiredVMNotifyEmailAllMessages(createdBuff.getRequiredVMNotifyEmailAllMessages());
                Buff.setRequiredVMKeepLocalAfterEMail(createdBuff.getRequiredVMKeepLocalAfterEMail());
                Buff.setRequiredVMAttachFile(createdBuff.getRequiredVMAttachFile());
                Buff.setRequiredEMailEMailFrom(createdBuff.getRequiredEMailEMailFrom());
                Buff.setRequiredVMMessageExt(createdBuff.getRequiredVMMessageExt());
                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_fssfext() 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.cffreeswitch.v2_1.CFFswOracle.CFFswOracleFSSFExtensionTable.java

public void updateFSSFExtension(CFFswAuthorization Authorization, CFFswFSSFExtensionBuff Buff) {
    final String S_ProcName = "updateFSSFExtension";
    ResultSet resultSet = null;/*w  w w .j  a v a2 s .  co m*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFFswFSSFExtensionBuff> buffList = new LinkedList<CFFswFSSFExtensionBuff>();
    try {
        long TenantId = Buff.getRequiredTenantId();
        long FSSFExtensionId = Buff.getRequiredFSSFExtensionId();
        long FSSFDirectoryId = Buff.getRequiredFSSFDirectoryId();
        String Name = Buff.getRequiredName();
        String Password = Buff.getRequiredPassword();
        String TollAllow = Buff.getRequiredTollAllow();
        String AccountCode = Buff.getOptionalAccountCode();
        String UserContext = Buff.getRequiredUserContext();
        String EffectiveCallerIdName = Buff.getRequiredEffectiveCallerIdName();
        String EffectiveCallerIdNumber = Buff.getRequiredEffectiveCallerIdNumber();
        String OutboundCallerIdName = Buff.getRequiredOutboundCallerIdName();
        String OutboundCallerIdNumber = Buff.getRequiredOutboundCallerIdNumber();
        String CallGroup = Buff.getRequiredCallGroup();
        int VMDiskQuota = Buff.getRequiredVMDiskQuota();
        String VMMailTo = Buff.getRequiredVMMailTo();
        String VMNotifyMailTo = Buff.getRequiredVMNotifyMailTo();
        String VMPassword = Buff.getRequiredVMPassword();
        boolean VMEmailAllMessages = Buff.getRequiredVMEmailAllMessages();
        boolean VMNotifyEmailAllMessages = Buff.getRequiredVMNotifyEmailAllMessages();
        boolean VMKeepLocalAfterEMail = Buff.getRequiredVMKeepLocalAfterEMail();
        boolean VMAttachFile = Buff.getRequiredVMAttachFile();
        String EMailEMailFrom = Buff.getRequiredEMailEMailFrom();
        String VMMessageExt = Buff.getRequiredVMMessageExt();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".upd_fssfext( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); 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++, "FSEX");
        stmtUpdateByPKey.setLong(argIdx++, TenantId);
        stmtUpdateByPKey.setLong(argIdx++, FSSFExtensionId);
        stmtUpdateByPKey.setLong(argIdx++, FSSFDirectoryId);
        stmtUpdateByPKey.setString(argIdx++, Name);
        stmtUpdateByPKey.setString(argIdx++, Password);
        stmtUpdateByPKey.setString(argIdx++, TollAllow);
        if (AccountCode != null) {
            stmtUpdateByPKey.setString(argIdx++, AccountCode);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtUpdateByPKey.setString(argIdx++, UserContext);
        stmtUpdateByPKey.setString(argIdx++, EffectiveCallerIdName);
        stmtUpdateByPKey.setString(argIdx++, EffectiveCallerIdNumber);
        stmtUpdateByPKey.setString(argIdx++, OutboundCallerIdName);
        stmtUpdateByPKey.setString(argIdx++, OutboundCallerIdNumber);
        stmtUpdateByPKey.setString(argIdx++, CallGroup);
        stmtUpdateByPKey.setInt(argIdx++, VMDiskQuota);
        stmtUpdateByPKey.setString(argIdx++, VMMailTo);
        stmtUpdateByPKey.setString(argIdx++, VMNotifyMailTo);
        stmtUpdateByPKey.setString(argIdx++, VMPassword);
        if (VMEmailAllMessages) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (VMNotifyEmailAllMessages) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (VMKeepLocalAfterEMail) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (VMAttachFile) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        stmtUpdateByPKey.setString(argIdx++, EMailEMailFrom);
        stmtUpdateByPKey.setString(argIdx++, VMMessageExt);
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
        if (resultSet != null) {
            try {
                if (resultSet.next()) {
                    CFFswFSSFExtensionBuff updatedBuff = unpackFSSFExtensionResultSetToBuff(resultSet);
                    if (resultSet.next()) {
                        resultSet.last();
                        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                                "Did not expect multi-record response, " + resultSet.getRow()
                                        + " rows selected");
                    }
                    Buff.setRequiredFSSFDirectoryId(updatedBuff.getRequiredFSSFDirectoryId());
                    Buff.setRequiredName(updatedBuff.getRequiredName());
                    Buff.setRequiredPassword(updatedBuff.getRequiredPassword());
                    Buff.setRequiredTollAllow(updatedBuff.getRequiredTollAllow());
                    Buff.setOptionalAccountCode(updatedBuff.getOptionalAccountCode());
                    Buff.setRequiredUserContext(updatedBuff.getRequiredUserContext());
                    Buff.setRequiredEffectiveCallerIdName(updatedBuff.getRequiredEffectiveCallerIdName());
                    Buff.setRequiredEffectiveCallerIdNumber(updatedBuff.getRequiredEffectiveCallerIdNumber());
                    Buff.setRequiredOutboundCallerIdName(updatedBuff.getRequiredOutboundCallerIdName());
                    Buff.setRequiredOutboundCallerIdNumber(updatedBuff.getRequiredOutboundCallerIdNumber());
                    Buff.setRequiredCallGroup(updatedBuff.getRequiredCallGroup());
                    Buff.setRequiredVMDiskQuota(updatedBuff.getRequiredVMDiskQuota());
                    Buff.setRequiredVMMailTo(updatedBuff.getRequiredVMMailTo());
                    Buff.setRequiredVMNotifyMailTo(updatedBuff.getRequiredVMNotifyMailTo());
                    Buff.setRequiredVMPassword(updatedBuff.getRequiredVMPassword());
                    Buff.setRequiredVMEmailAllMessages(updatedBuff.getRequiredVMEmailAllMessages());
                    Buff.setRequiredVMNotifyEmailAllMessages(updatedBuff.getRequiredVMNotifyEmailAllMessages());
                    Buff.setRequiredVMKeepLocalAfterEMail(updatedBuff.getRequiredVMKeepLocalAfterEMail());
                    Buff.setRequiredVMAttachFile(updatedBuff.getRequiredVMAttachFile());
                    Buff.setRequiredEMailEMailFrom(updatedBuff.getRequiredEMailEMailFrom());
                    Buff.setRequiredVMMessageExt(updatedBuff.getRequiredVMMessageExt());
                    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_fssfext() 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_fssfext() 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 ww .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.cfacc.v2_0.CFAccOracle.CFAccOracleAccountEntryTable.java

public void updateAccountEntry(CFAccAuthorization Authorization, CFAccAccountEntryBuff Buff) {
    final String S_ProcName = "updateAccountEntry";
    ResultSet resultSet = null;/*from  w  w  w.j ava2 s .c om*/
    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.cffreeswitch.v2_1.CFFswOracle.CFFswOracleFSSFConferenceProfileTable.java

public void createFSSFConferenceProfile(CFFswAuthorization Authorization, CFFswFSSFConferenceProfileBuff Buff) {
    final String S_ProcName = "createFSSFConferenceProfile";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//from  w ww . j a  v  a2 s. c  o  m
    ResultSet resultSet = null;
    CallableStatement stmtCreateByPKey = null;
    try {
        long TenantId = Buff.getRequiredTenantId();
        long FSSFConferenceProfileId = Buff.getRequiredFSSFConferenceProfileId();
        long FSSFConferenceId = Buff.getRequiredFSSFConferenceId();
        String Name = Buff.getRequiredName();
        String SoundPrefix = Buff.getRequiredSoundPrefix();
        String AckSound = Buff.getOptionalAckSound();
        String AloneSound = Buff.getOptionalAloneSound();
        String BadPinSound = Buff.getOptionalBadPinSound();
        String EnterSound = Buff.getOptionalEnterSound();
        String ExitSound = Buff.getOptionalExitSound();
        String IsLockedSound = Buff.getOptionalIsLockedSound();
        String KickedSound = Buff.getOptionalKickedSound();
        String LockedSound = Buff.getOptionalLockedSound();
        String MaxMembersSound = Buff.getOptionalMaxMembersSound();
        String MOHSound = Buff.getOptionalMOHSound();
        String MuteDetectSound = Buff.getOptionalMuteDetectSound();
        String MutedSound = Buff.getOptionalMutedSound();
        String NackSound = Buff.getOptionalNackSound();
        String PerpetualSound = Buff.getOptionalPerpetualSound();
        String PinSound = Buff.getOptionalPinSound();
        String Pin = Buff.getOptionalPin();
        String UnmutedSound = Buff.getOptionalUnmutedSound();
        int Rate = Buff.getRequiredRate();
        String AutoRecord = Buff.getRequiredAutoRecord();
        int ValInterval = Buff.getRequiredValInterval();
        int EnergyLevel = Buff.getRequiredEnergyLevel();
        String MemberFlags = Buff.getRequiredMemberFlags();
        String ConferenceFlags = Buff.getRequiredConferenceFlags();
        String CallerControls = Buff.getRequiredCallerControls();
        String TTSEngine = Buff.getRequiredTTSEngine();
        String TTSVoice = Buff.getRequiredTTSVoice();
        int MaxMembers = Buff.getRequiredMaxMembers();
        int ComfortNoise = Buff.getRequiredComfortNoise();
        int AnnounceCount = Buff.getRequiredAnnounceCount();
        String SuppressEvents = Buff.getRequiredSuppressEvents();
        String VerboseEvents = Buff.getRequiredVerboseEvents();
        String CallerIdName = Buff.getOptionalCallerIdName();
        String CallerIdNumber = Buff.getOptionalCallerIdNumber();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".crt_fssfcnfprf( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); 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++, "FSCP");
        stmtCreateByPKey.setLong(argIdx++, TenantId);
        stmtCreateByPKey.setLong(argIdx++, FSSFConferenceProfileId);
        stmtCreateByPKey.setLong(argIdx++, FSSFConferenceId);
        stmtCreateByPKey.setString(argIdx++, Name);
        stmtCreateByPKey.setString(argIdx++, SoundPrefix);
        if (AckSound != null) {
            stmtCreateByPKey.setString(argIdx++, AckSound);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (AloneSound != null) {
            stmtCreateByPKey.setString(argIdx++, AloneSound);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (BadPinSound != null) {
            stmtCreateByPKey.setString(argIdx++, BadPinSound);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (EnterSound != null) {
            stmtCreateByPKey.setString(argIdx++, EnterSound);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (ExitSound != null) {
            stmtCreateByPKey.setString(argIdx++, ExitSound);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (IsLockedSound != null) {
            stmtCreateByPKey.setString(argIdx++, IsLockedSound);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (KickedSound != null) {
            stmtCreateByPKey.setString(argIdx++, KickedSound);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (LockedSound != null) {
            stmtCreateByPKey.setString(argIdx++, LockedSound);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (MaxMembersSound != null) {
            stmtCreateByPKey.setString(argIdx++, MaxMembersSound);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (MOHSound != null) {
            stmtCreateByPKey.setString(argIdx++, MOHSound);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (MuteDetectSound != null) {
            stmtCreateByPKey.setString(argIdx++, MuteDetectSound);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (MutedSound != null) {
            stmtCreateByPKey.setString(argIdx++, MutedSound);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (NackSound != null) {
            stmtCreateByPKey.setString(argIdx++, NackSound);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (PerpetualSound != null) {
            stmtCreateByPKey.setString(argIdx++, PerpetualSound);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (PinSound != null) {
            stmtCreateByPKey.setString(argIdx++, PinSound);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (Pin != null) {
            stmtCreateByPKey.setString(argIdx++, Pin);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (UnmutedSound != null) {
            stmtCreateByPKey.setString(argIdx++, UnmutedSound);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtCreateByPKey.setInt(argIdx++, Rate);
        stmtCreateByPKey.setString(argIdx++, AutoRecord);
        stmtCreateByPKey.setInt(argIdx++, ValInterval);
        stmtCreateByPKey.setInt(argIdx++, EnergyLevel);
        stmtCreateByPKey.setString(argIdx++, MemberFlags);
        stmtCreateByPKey.setString(argIdx++, ConferenceFlags);
        stmtCreateByPKey.setString(argIdx++, CallerControls);
        stmtCreateByPKey.setString(argIdx++, TTSEngine);
        stmtCreateByPKey.setString(argIdx++, TTSVoice);
        stmtCreateByPKey.setInt(argIdx++, MaxMembers);
        stmtCreateByPKey.setInt(argIdx++, ComfortNoise);
        stmtCreateByPKey.setInt(argIdx++, AnnounceCount);
        stmtCreateByPKey.setString(argIdx++, SuppressEvents);
        stmtCreateByPKey.setString(argIdx++, VerboseEvents);
        if (CallerIdName != null) {
            stmtCreateByPKey.setString(argIdx++, CallerIdName);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (CallerIdNumber != null) {
            stmtCreateByPKey.setString(argIdx++, CallerIdNumber);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_fssfcnfprf() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFFswFSSFConferenceProfileBuff createdBuff = unpackFSSFConferenceProfileResultSetToBuff(
                        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.setRequiredFSSFConferenceProfileId(createdBuff.getRequiredFSSFConferenceProfileId());
                Buff.setRequiredFSSFConferenceId(createdBuff.getRequiredFSSFConferenceId());
                Buff.setRequiredName(createdBuff.getRequiredName());
                Buff.setRequiredSoundPrefix(createdBuff.getRequiredSoundPrefix());
                Buff.setOptionalAckSound(createdBuff.getOptionalAckSound());
                Buff.setOptionalAloneSound(createdBuff.getOptionalAloneSound());
                Buff.setOptionalBadPinSound(createdBuff.getOptionalBadPinSound());
                Buff.setOptionalEnterSound(createdBuff.getOptionalEnterSound());
                Buff.setOptionalExitSound(createdBuff.getOptionalExitSound());
                Buff.setOptionalIsLockedSound(createdBuff.getOptionalIsLockedSound());
                Buff.setOptionalKickedSound(createdBuff.getOptionalKickedSound());
                Buff.setOptionalLockedSound(createdBuff.getOptionalLockedSound());
                Buff.setOptionalMaxMembersSound(createdBuff.getOptionalMaxMembersSound());
                Buff.setOptionalMOHSound(createdBuff.getOptionalMOHSound());
                Buff.setOptionalMuteDetectSound(createdBuff.getOptionalMuteDetectSound());
                Buff.setOptionalMutedSound(createdBuff.getOptionalMutedSound());
                Buff.setOptionalNackSound(createdBuff.getOptionalNackSound());
                Buff.setOptionalPerpetualSound(createdBuff.getOptionalPerpetualSound());
                Buff.setOptionalPinSound(createdBuff.getOptionalPinSound());
                Buff.setOptionalPin(createdBuff.getOptionalPin());
                Buff.setOptionalUnmutedSound(createdBuff.getOptionalUnmutedSound());
                Buff.setRequiredRate(createdBuff.getRequiredRate());
                Buff.setRequiredAutoRecord(createdBuff.getRequiredAutoRecord());
                Buff.setRequiredValInterval(createdBuff.getRequiredValInterval());
                Buff.setRequiredEnergyLevel(createdBuff.getRequiredEnergyLevel());
                Buff.setRequiredMemberFlags(createdBuff.getRequiredMemberFlags());
                Buff.setRequiredConferenceFlags(createdBuff.getRequiredConferenceFlags());
                Buff.setRequiredCallerControls(createdBuff.getRequiredCallerControls());
                Buff.setRequiredTTSEngine(createdBuff.getRequiredTTSEngine());
                Buff.setRequiredTTSVoice(createdBuff.getRequiredTTSVoice());
                Buff.setRequiredMaxMembers(createdBuff.getRequiredMaxMembers());
                Buff.setRequiredComfortNoise(createdBuff.getRequiredComfortNoise());
                Buff.setRequiredAnnounceCount(createdBuff.getRequiredAnnounceCount());
                Buff.setRequiredSuppressEvents(createdBuff.getRequiredSuppressEvents());
                Buff.setRequiredVerboseEvents(createdBuff.getRequiredVerboseEvents());
                Buff.setOptionalCallerIdName(createdBuff.getOptionalCallerIdName());
                Buff.setOptionalCallerIdNumber(createdBuff.getOptionalCallerIdNumber());
                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_fssfcnfprf() 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;
        }
    }
}