Example usage for java.sql CallableStatement setShort

List of usage examples for java.sql CallableStatement setShort

Introduction

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

Prototype

void setShort(String parameterName, short x) throws SQLException;

Source Link

Document

Sets the designated parameter to the given Java short value.

Usage

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

public void updateFSSFProfile(CFFswAuthorization Authorization, CFFswFSSFProfileBuff Buff) {
    final String S_ProcName = "updateFSSFProfile";
    ResultSet resultSet = null;/*from  www .j  av  a2 s  .c  o m*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFFswFSSFProfileBuff> buffList = new LinkedList<CFFswFSSFProfileBuff>();
    try {
        long TenantId = Buff.getRequiredTenantId();
        long FSSFProfileId = Buff.getRequiredFSSFProfileId();
        long FSSofiaId = Buff.getRequiredFSSofiaId();
        String Name = Buff.getRequiredName();
        short Debug = Buff.getRequiredDebug();
        boolean SipTrace = Buff.getRequiredSipTrace();
        short SipPort = Buff.getRequiredSipPort();
        String Dialplan = Buff.getRequiredDialplan();
        String Context = Buff.getRequiredContext();
        int DTMFDuration = Buff.getRequiredDTMFDuration();
        String CodecPrefs = Buff.getRequiredCodecPrefs();
        String HoldMusic = Buff.getRequiredHoldMusic();
        String RTPTimerName = Buff.getRequiredRTPTimerName();
        boolean Enable100Rel = Buff.getRequiredEnable100Rel();
        boolean ManagePresence = Buff.getRequiredManagePresence();
        String DbName = Buff.getOptionalDbName();
        String PresenceHosts = Buff.getRequiredPresenceHosts();
        String ForceRegisterDomain = Buff.getRequiredForceRegisterDomain();
        String ForceRegisterDbDomain = Buff.getOptionalForceRegisterDbDomain();
        boolean AggressiveNATDetection = Buff.getRequiredAggressiveNATDetection();
        String InboundCodecNegotiation = Buff.getRequiredInboundCodecNegotiation();
        short NonCETTL = Buff.getRequiredNonCETTL();
        boolean AuthCalls = Buff.getRequiredAuthCalls();
        int RtpTimeoutSec = Buff.getRequiredRtpTimeoutSec();
        String RtpIP = Buff.getRequiredRtpIP();
        String SipIP = Buff.getRequiredSipIP();
        String ExtRtpIP = Buff.getRequiredExtRtpIP();
        String ExtSipIP = Buff.getRequiredExtSipIP();
        boolean Enable3PCC = Buff.getRequiredEnable3PCC();
        String TlsBindParams = Buff.getRequiredTlsBindParams();
        short TlsSipPort = Buff.getRequiredTlsSipPort();
        String TlsCertDir = Buff.getRequiredTlsCertDir();
        String TlsVersion = Buff.getRequiredTlsVersion();
        boolean RtpAutoflushDuringBridge = Buff.getRequiredRtpAutoflushDuringBridge();
        boolean RtpRewriteTimestamp = Buff.getRequiredRtpRewriteTimestamp();
        boolean PassRFC2833 = Buff.getRequiredPassRFC2833();
        String OdbcDSN = Buff.getOptionalOdbcDSN();
        boolean InboundBypassMedia = Buff.getRequiredInboundBypassMedia();
        boolean InboundProxyMedia = Buff.getRequiredInboundProxyMedia();
        boolean InboundLateNegotiation = Buff.getRequiredInboundLateNegotiation();
        boolean AcceptBlindReg = Buff.getRequiredAcceptBlindReg();
        boolean AcceptBlindAuth = Buff.getRequiredAcceptBlindAuth();
        boolean SuppressCNG = Buff.getRequiredSuppressCNG();
        boolean DisableTranscoding = Buff.getRequiredDisableTranscoding();
        boolean DisableTransfer = Buff.getRequiredDisableTransfer();
        boolean NDLBBrokenAuthHash = Buff.getRequiredNDLBBrokenAuthHash();
        boolean NDLBReceivedInNATRegContact = Buff.getRequiredNDLBReceivedInNATRegContact();
        boolean InboundRegForceMatchingUsername = Buff.getRequiredInboundRegForceMatchingUsername();
        boolean AuthAllPackets = Buff.getRequiredAuthAllPackets();
        String Vad = Buff.getRequiredVad();
        String Alias = Buff.getRequiredAlias();
        int ForceSubscriptionExpires = Buff.getRequiredForceSubscriptionExpires();
        boolean DisableRegister = Buff.getRequiredDisableRegister();
        boolean NDLBForceReport = Buff.getRequiredNDLBForceReport();
        String ChallengeRealm = Buff.getRequiredChallengeRealm();
        boolean DisableRtpAutoAdjust = Buff.getRequiredDisableRtpAutoAdjust();
        boolean InboundUseCallIdAsUUID = Buff.getRequiredInboundUseCallIdAsUUID();
        boolean OutboundUseUUIDAsCallId = Buff.getRequiredOutboundUseUUIDAsCallId();
        boolean RtpAutofixTiming = Buff.getRequiredRtpAutofixTiming();
        String AutoRtpBugs = Buff.getRequiredAutoRtpBugs();
        boolean DisableSrv = Buff.getRequiredDisableSrv();
        boolean DisableNAPtr = Buff.getRequiredDisableNAPtr();
        int TimerT1 = Buff.getRequiredTimerT1();
        int TimerT1X64 = Buff.getRequiredTimerT1X64();
        int TimerT2 = Buff.getRequiredTimerT2();
        int TimerT4 = Buff.getRequiredTimerT4();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".upd_fssfprofile( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                + "? ); 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++, "FSPF");
        stmtUpdateByPKey.setLong(argIdx++, TenantId);
        stmtUpdateByPKey.setLong(argIdx++, FSSFProfileId);
        stmtUpdateByPKey.setLong(argIdx++, FSSofiaId);
        stmtUpdateByPKey.setString(argIdx++, Name);
        stmtUpdateByPKey.setShort(argIdx++, Debug);
        if (SipTrace) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        stmtUpdateByPKey.setShort(argIdx++, SipPort);
        stmtUpdateByPKey.setString(argIdx++, Dialplan);
        stmtUpdateByPKey.setString(argIdx++, Context);
        stmtUpdateByPKey.setInt(argIdx++, DTMFDuration);
        stmtUpdateByPKey.setString(argIdx++, CodecPrefs);
        stmtUpdateByPKey.setString(argIdx++, HoldMusic);
        stmtUpdateByPKey.setString(argIdx++, RTPTimerName);
        if (Enable100Rel) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (ManagePresence) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (DbName != null) {
            stmtUpdateByPKey.setString(argIdx++, DbName);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtUpdateByPKey.setString(argIdx++, PresenceHosts);
        stmtUpdateByPKey.setString(argIdx++, ForceRegisterDomain);
        if (ForceRegisterDbDomain != null) {
            stmtUpdateByPKey.setString(argIdx++, ForceRegisterDbDomain);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (AggressiveNATDetection) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        stmtUpdateByPKey.setString(argIdx++, InboundCodecNegotiation);
        stmtUpdateByPKey.setShort(argIdx++, NonCETTL);
        if (AuthCalls) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        stmtUpdateByPKey.setInt(argIdx++, RtpTimeoutSec);
        stmtUpdateByPKey.setString(argIdx++, RtpIP);
        stmtUpdateByPKey.setString(argIdx++, SipIP);
        stmtUpdateByPKey.setString(argIdx++, ExtRtpIP);
        stmtUpdateByPKey.setString(argIdx++, ExtSipIP);
        if (Enable3PCC) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        stmtUpdateByPKey.setString(argIdx++, TlsBindParams);
        stmtUpdateByPKey.setShort(argIdx++, TlsSipPort);
        stmtUpdateByPKey.setString(argIdx++, TlsCertDir);
        stmtUpdateByPKey.setString(argIdx++, TlsVersion);
        if (RtpAutoflushDuringBridge) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (RtpRewriteTimestamp) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (PassRFC2833) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (OdbcDSN != null) {
            stmtUpdateByPKey.setString(argIdx++, OdbcDSN);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (InboundBypassMedia) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (InboundProxyMedia) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (InboundLateNegotiation) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (AcceptBlindReg) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (AcceptBlindAuth) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (SuppressCNG) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (DisableTranscoding) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (DisableTransfer) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (NDLBBrokenAuthHash) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (NDLBReceivedInNATRegContact) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (InboundRegForceMatchingUsername) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (AuthAllPackets) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        stmtUpdateByPKey.setString(argIdx++, Vad);
        stmtUpdateByPKey.setString(argIdx++, Alias);
        stmtUpdateByPKey.setInt(argIdx++, ForceSubscriptionExpires);
        if (DisableRegister) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (NDLBForceReport) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        stmtUpdateByPKey.setString(argIdx++, ChallengeRealm);
        if (DisableRtpAutoAdjust) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (InboundUseCallIdAsUUID) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (OutboundUseUUIDAsCallId) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (RtpAutofixTiming) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        stmtUpdateByPKey.setString(argIdx++, AutoRtpBugs);
        if (DisableSrv) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        if (DisableNAPtr) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        stmtUpdateByPKey.setInt(argIdx++, TimerT1);
        stmtUpdateByPKey.setInt(argIdx++, TimerT1X64);
        stmtUpdateByPKey.setInt(argIdx++, TimerT2);
        stmtUpdateByPKey.setInt(argIdx++, TimerT4);
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
        if (resultSet != null) {
            try {
                if (resultSet.next()) {
                    CFFswFSSFProfileBuff updatedBuff = unpackFSSFProfileResultSetToBuff(resultSet);
                    if (resultSet.next()) {
                        resultSet.last();
                        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                                "Did not expect multi-record response, " + resultSet.getRow()
                                        + " rows selected");
                    }
                    Buff.setRequiredFSSofiaId(updatedBuff.getRequiredFSSofiaId());
                    Buff.setRequiredName(updatedBuff.getRequiredName());
                    Buff.setRequiredDebug(updatedBuff.getRequiredDebug());
                    Buff.setRequiredSipTrace(updatedBuff.getRequiredSipTrace());
                    Buff.setRequiredSipPort(updatedBuff.getRequiredSipPort());
                    Buff.setRequiredDialplan(updatedBuff.getRequiredDialplan());
                    Buff.setRequiredContext(updatedBuff.getRequiredContext());
                    Buff.setRequiredDTMFDuration(updatedBuff.getRequiredDTMFDuration());
                    Buff.setRequiredCodecPrefs(updatedBuff.getRequiredCodecPrefs());
                    Buff.setRequiredHoldMusic(updatedBuff.getRequiredHoldMusic());
                    Buff.setRequiredRTPTimerName(updatedBuff.getRequiredRTPTimerName());
                    Buff.setRequiredEnable100Rel(updatedBuff.getRequiredEnable100Rel());
                    Buff.setRequiredManagePresence(updatedBuff.getRequiredManagePresence());
                    Buff.setOptionalDbName(updatedBuff.getOptionalDbName());
                    Buff.setRequiredPresenceHosts(updatedBuff.getRequiredPresenceHosts());
                    Buff.setRequiredForceRegisterDomain(updatedBuff.getRequiredForceRegisterDomain());
                    Buff.setOptionalForceRegisterDbDomain(updatedBuff.getOptionalForceRegisterDbDomain());
                    Buff.setRequiredAggressiveNATDetection(updatedBuff.getRequiredAggressiveNATDetection());
                    Buff.setRequiredInboundCodecNegotiation(updatedBuff.getRequiredInboundCodecNegotiation());
                    Buff.setRequiredNonCETTL(updatedBuff.getRequiredNonCETTL());
                    Buff.setRequiredAuthCalls(updatedBuff.getRequiredAuthCalls());
                    Buff.setRequiredRtpTimeoutSec(updatedBuff.getRequiredRtpTimeoutSec());
                    Buff.setRequiredRtpIP(updatedBuff.getRequiredRtpIP());
                    Buff.setRequiredSipIP(updatedBuff.getRequiredSipIP());
                    Buff.setRequiredExtRtpIP(updatedBuff.getRequiredExtRtpIP());
                    Buff.setRequiredExtSipIP(updatedBuff.getRequiredExtSipIP());
                    Buff.setRequiredEnable3PCC(updatedBuff.getRequiredEnable3PCC());
                    Buff.setRequiredTlsBindParams(updatedBuff.getRequiredTlsBindParams());
                    Buff.setRequiredTlsSipPort(updatedBuff.getRequiredTlsSipPort());
                    Buff.setRequiredTlsCertDir(updatedBuff.getRequiredTlsCertDir());
                    Buff.setRequiredTlsVersion(updatedBuff.getRequiredTlsVersion());
                    Buff.setRequiredRtpAutoflushDuringBridge(updatedBuff.getRequiredRtpAutoflushDuringBridge());
                    Buff.setRequiredRtpRewriteTimestamp(updatedBuff.getRequiredRtpRewriteTimestamp());
                    Buff.setRequiredPassRFC2833(updatedBuff.getRequiredPassRFC2833());
                    Buff.setOptionalOdbcDSN(updatedBuff.getOptionalOdbcDSN());
                    Buff.setRequiredInboundBypassMedia(updatedBuff.getRequiredInboundBypassMedia());
                    Buff.setRequiredInboundProxyMedia(updatedBuff.getRequiredInboundProxyMedia());
                    Buff.setRequiredInboundLateNegotiation(updatedBuff.getRequiredInboundLateNegotiation());
                    Buff.setRequiredAcceptBlindReg(updatedBuff.getRequiredAcceptBlindReg());
                    Buff.setRequiredAcceptBlindAuth(updatedBuff.getRequiredAcceptBlindAuth());
                    Buff.setRequiredSuppressCNG(updatedBuff.getRequiredSuppressCNG());
                    Buff.setRequiredDisableTranscoding(updatedBuff.getRequiredDisableTranscoding());
                    Buff.setRequiredDisableTransfer(updatedBuff.getRequiredDisableTransfer());
                    Buff.setRequiredNDLBBrokenAuthHash(updatedBuff.getRequiredNDLBBrokenAuthHash());
                    Buff.setRequiredNDLBReceivedInNATRegContact(
                            updatedBuff.getRequiredNDLBReceivedInNATRegContact());
                    Buff.setRequiredInboundRegForceMatchingUsername(
                            updatedBuff.getRequiredInboundRegForceMatchingUsername());
                    Buff.setRequiredAuthAllPackets(updatedBuff.getRequiredAuthAllPackets());
                    Buff.setRequiredVad(updatedBuff.getRequiredVad());
                    Buff.setRequiredAlias(updatedBuff.getRequiredAlias());
                    Buff.setRequiredForceSubscriptionExpires(updatedBuff.getRequiredForceSubscriptionExpires());
                    Buff.setRequiredDisableRegister(updatedBuff.getRequiredDisableRegister());
                    Buff.setRequiredNDLBForceReport(updatedBuff.getRequiredNDLBForceReport());
                    Buff.setRequiredChallengeRealm(updatedBuff.getRequiredChallengeRealm());
                    Buff.setRequiredDisableRtpAutoAdjust(updatedBuff.getRequiredDisableRtpAutoAdjust());
                    Buff.setRequiredInboundUseCallIdAsUUID(updatedBuff.getRequiredInboundUseCallIdAsUUID());
                    Buff.setRequiredOutboundUseUUIDAsCallId(updatedBuff.getRequiredOutboundUseUUIDAsCallId());
                    Buff.setRequiredRtpAutofixTiming(updatedBuff.getRequiredRtpAutofixTiming());
                    Buff.setRequiredAutoRtpBugs(updatedBuff.getRequiredAutoRtpBugs());
                    Buff.setRequiredDisableSrv(updatedBuff.getRequiredDisableSrv());
                    Buff.setRequiredDisableNAPtr(updatedBuff.getRequiredDisableNAPtr());
                    Buff.setRequiredTimerT1(updatedBuff.getRequiredTimerT1());
                    Buff.setRequiredTimerT1X64(updatedBuff.getRequiredTimerT1X64());
                    Buff.setRequiredTimerT2(updatedBuff.getRequiredTimerT2());
                    Buff.setRequiredTimerT4(updatedBuff.getRequiredTimerT4());
                    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_fssfprofile() 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_fssfprofile() 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.cfcrm.v2_0.CFCrmOracle.CFCrmOracleAddressTable.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");
    }//from  ww  w  . jav a  2 s  . c om
    ResultSet resultSet = null;
    CallableStatement stmtCreateByPKey = 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();
        stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".crt_address( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); 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++, "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);
        }
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_address() did not return a result set");
        }
        try {
            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().newRuntimeException(getClass(), S_ProcName,
                    "crt_address() 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.cfcrm.v2_0.CFCrmOracle.CFCrmOracleAddressTable.java

public CFCrmAddressBuff[] readBuffByCountryIdx(CFCrmAuthorization Authorization, Short CountryId) {
    final String S_ProcName = "readBuffByCountryIdx";
    ResultSet resultSet = null;/* ww  w.  j ava 2  s. c  om*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByCountryIdx = null;
    List<CFCrmAddressBuff> buffList = new LinkedList<CFCrmAddressBuff>();
    try {
        stmtReadBuffByCountryIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_addressbycountryidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByCountryIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByCountryIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByCountryIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByCountryIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByCountryIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByCountryIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (CountryId != null) {
            stmtReadBuffByCountryIdx.setShort(argIdx++, CountryId.shortValue());
        } else {
            stmtReadBuffByCountryIdx.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        stmtReadBuffByCountryIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByCountryIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFCrmAddressBuff buff = unpackAddressResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFCrmAddressBuff[] retBuff = new CFCrmAddressBuff[buffList.size()];
        Iterator<CFCrmAddressBuff> 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 (stmtReadBuffByCountryIdx != null) {
            try {
                stmtReadBuffByCountryIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByCountryIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmOracle.CFCrmOracleAddressTable.java

public void updateAddress(CFCrmAuthorization Authorization, CFCrmAddressBuff Buff) {
    final String S_ProcName = "updateAddress";
    ResultSet resultSet = null;//from   w w  w.  j  a  v a  2s .c om
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFCrmAddressBuff> buffList = new LinkedList<CFCrmAddressBuff>();
    try {
        long TenantId = Buff.getRequiredTenantId();
        long AddressId = Buff.getRequiredAddressId();
        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();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".upd_address( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); 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++, "ADR");
        stmtUpdateByPKey.setLong(argIdx++, TenantId);
        stmtUpdateByPKey.setLong(argIdx++, AddressId);
        stmtUpdateByPKey.setLong(argIdx++, ContactId);
        stmtUpdateByPKey.setString(argIdx++, Description);
        if (AddrLine1 != null) {
            stmtUpdateByPKey.setString(argIdx++, AddrLine1);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (AddrLine2 != null) {
            stmtUpdateByPKey.setString(argIdx++, AddrLine2);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (City != null) {
            stmtUpdateByPKey.setString(argIdx++, City);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (State != null) {
            stmtUpdateByPKey.setString(argIdx++, State);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (CountryId != null) {
            stmtUpdateByPKey.setShort(argIdx++, CountryId.shortValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        if (Zip != null) {
            stmtUpdateByPKey.setString(argIdx++, Zip);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
        if (resultSet != null) {
            try {
                if (resultSet.next()) {
                    CFCrmAddressBuff updatedBuff = 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.setRequiredContactId(updatedBuff.getRequiredContactId());
                    Buff.setRequiredDescription(updatedBuff.getRequiredDescription());
                    Buff.setOptionalAddrLine1(updatedBuff.getOptionalAddrLine1());
                    Buff.setOptionalAddrLine2(updatedBuff.getOptionalAddrLine2());
                    Buff.setOptionalCity(updatedBuff.getOptionalCity());
                    Buff.setOptionalState(updatedBuff.getOptionalState());
                    Buff.setOptionalCountryId(updatedBuff.getOptionalCountryId());
                    Buff.setOptionalZip(updatedBuff.getOptionalZip());
                    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_address() 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_address() 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.cfinternet.v2_1.CFInternetOracle.CFInternetOracleAuditActionTable.java

public void createAuditAction(CFInternetAuthorization Authorization, CFInternetAuditActionBuff Buff) {
    final String S_ProcName = "createAuditAction";
    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 {
        short AuditActionId = Buff.getRequiredAuditActionId();
        String Description = Buff.getRequiredDescription();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".crt_auditaction( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); 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++, "AUDT");
        stmtCreateByPKey.setShort(argIdx++, AuditActionId);
        stmtCreateByPKey.setString(argIdx++, Description);
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_auditaction() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFInternetAuditActionBuff createdBuff = unpackAuditActionResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                Buff.setRequiredAuditActionId(createdBuff.getRequiredAuditActionId());
                Buff.setRequiredDescription(createdBuff.getRequiredDescription());
                Buff.setRequiredRevision(createdBuff.getRequiredRevision());
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Expected a single-record response, " + resultSet.getRow() + " rows selected");
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_auditaction() 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.cfinternet.v2_1.CFInternetOracle.CFInternetOracleAuditActionTable.java

public CFInternetAuditActionBuff readBuff(CFInternetAuthorization Authorization,
        CFInternetAuditActionPKey PKey) {
    final String S_ProcName = "readBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//from   www.  java 2 s .  com
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByPKey = null;
    try {
        short AuditActionId = PKey.getRequiredAuditActionId();

        stmtReadBuffByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_auditaction( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByPKey.setShort(argIdx++, AuditActionId);
        stmtReadBuffByPKey.execute();
        resultSet = (ResultSet) stmtReadBuffByPKey.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFInternetAuditActionBuff buff = unpackAuditActionResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByPKey != null) {
            try {
                stmtReadBuffByPKey.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByPKey = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetOracle.CFInternetOracleAuditActionTable.java

public CFInternetAuditActionBuff lockBuff(CFInternetAuthorization Authorization,
        CFInternetAuditActionPKey PKey) {
    final String S_ProcName = "lockBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }// w  w w.j a  v  a 2  s. co m
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtLockBuffByPKey = null;
    try {
        short AuditActionId = PKey.getRequiredAuditActionId();

        stmtLockBuffByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".lck_auditaction( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtLockBuffByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtLockBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtLockBuffByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtLockBuffByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtLockBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtLockBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtLockBuffByPKey.setShort(argIdx++, AuditActionId);
        stmtLockBuffByPKey.execute();
        resultSet = (ResultSet) stmtLockBuffByPKey.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFInternetAuditActionBuff buff = unpackAuditActionResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtLockBuffByPKey != null) {
            try {
                stmtLockBuffByPKey.close();
            } catch (SQLException e) {
            }
            stmtLockBuffByPKey = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetOracle.CFInternetOracleAuditActionTable.java

public CFInternetAuditActionBuff readBuffByIdIdx(CFInternetAuthorization Authorization, short AuditActionId) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;//from  w w w.  j a v  a 2s.c  om
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByIdIdx = null;
    try {
        stmtReadBuffByIdIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_auditactionbyididx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByIdIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByIdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByIdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByIdIdx.setShort(argIdx++, AuditActionId);
        stmtReadBuffByIdIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByIdIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFInternetAuditActionBuff buff = unpackAuditActionResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByIdIdx != null) {
            try {
                stmtReadBuffByIdIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByIdIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetOracle.CFInternetOracleAuditActionTable.java

public void updateAuditAction(CFInternetAuthorization Authorization, CFInternetAuditActionBuff Buff) {
    final String S_ProcName = "updateAuditAction";
    ResultSet resultSet = null;//from  w ww .  ja  va  2 s.com
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFInternetAuditActionBuff> buffList = new LinkedList<CFInternetAuditActionBuff>();
    try {
        short AuditActionId = Buff.getRequiredAuditActionId();
        String Description = Buff.getRequiredDescription();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".upd_auditaction( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "? ); 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++, "AUDT");
        stmtUpdateByPKey.setShort(argIdx++, AuditActionId);
        stmtUpdateByPKey.setString(argIdx++, Description);
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
        if (resultSet != null) {
            try {
                if (resultSet.next()) {
                    CFInternetAuditActionBuff updatedBuff = unpackAuditActionResultSetToBuff(resultSet);
                    if (resultSet.next()) {
                        resultSet.last();
                        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                                "Did not expect multi-record response, " + resultSet.getRow()
                                        + " rows selected");
                    }
                    Buff.setRequiredDescription(updatedBuff.getRequiredDescription());
                    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_auditaction() 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_auditaction() 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.cfinternet.v2_1.CFInternetOracle.CFInternetOracleAuditActionTable.java

public void deleteAuditAction(CFInternetAuthorization Authorization, CFInternetAuditActionBuff Buff) {
    final String S_ProcName = "deleteAuditAction";
    Connection cnx = schema.getCnx();
    CallableStatement stmtDeleteByPKey = null;
    try {/* ww  w.  j  a v a 2  s  . com*/
        short AuditActionId = Buff.getRequiredAuditActionId();
        stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".dl_auditaction( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByPKey.setShort(argIdx++, AuditActionId);
        stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision());
        ;
        stmtDeleteByPKey.execute();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (stmtDeleteByPKey != null) {
            try {
                stmtDeleteByPKey.close();
            } catch (SQLException e) {
            }
            stmtDeleteByPKey = null;
        }
    }
}