net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswMySql.CFFswMySqlFSSFProfileTable.java Source code

Java tutorial

Introduction

Here is the source code for net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswMySql.CFFswMySqlFSSFProfileTable.java

Source

// Description: Java 7 MySQL Jdbc DbIO implementation for FSSFProfile.

/*
 *   CF FreeSwitch Configuration Model
 *
 *   Copyright (c) 2014 Mark Sobkow
 *   
 *   This program is available as free software under the GNU GPL v3, or
 *   under a commercial license from Mark Sobkow.  For commercial licensing
 *   details, please contact msobkow@sasktel.net.
 *   
 *   Under the terms of the GPL:
 *   
 *      This program is free software: you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation, either version 3 of the License, or
 *      (at your option) any later version.
 *     
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *     
 *      You should have received a copy of the GNU General Public License
 *      along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *   
 *      This source code incorporates modified modules originally licensed
 *      under the Apache 2.0 license by MSS Code Factory including CFSecurity
 *      (net-sourceforge-msscodefactory-2.1-cfsecurity.xml),
 *      CFInternet (net-sourceforge-msscodefactory-2.1-cfinternet.xml), and
 *      CFCrm 2.1 (net-sourceforge-msscodefactory-2.1-cfcrm.xml), with all of the
 *      required models being available as part of the MSS Code Factory 2.0
 *      distribution source and install zips.
 *   
 *      You can download installations of MSS Code Factory 2.0 from
 *      http://msscodefactory.sourceforge.net/
 *   
 * ***********************************************************************
 *
 *   Code manufactured by MSS Code Factory
 */

package net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswMySql;

import java.math.*;
import java.sql.*;
import java.text.*;
import java.util.*;
import net.sourceforge.msscodefactory.cflib.v2_1.CFLib.*;
import org.apache.commons.codec.binary.Base64;
import net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFsw.*;

/*
 *   CFFswMySqlFSSFProfileTable MySQL Jdbc DbIO implementation
 *   for FSSFProfile.
 */
public class CFFswMySqlFSSFProfileTable implements ICFFswFSSFProfileTable {
    private CFFswMySqlSchema schema;
    protected PreparedStatement stmtReadBuffByPKey = null;
    protected PreparedStatement stmtLockBuffByPKey = null;
    protected PreparedStatement stmtCreateByPKey = null;
    protected PreparedStatement stmtUpdateByPKey = null;
    protected PreparedStatement stmtDeleteByPKey = null;
    protected PreparedStatement stmtReadAllBuff = null;
    protected PreparedStatement stmtReadBuffByIdIdx = null;
    protected PreparedStatement stmtReadBuffByTenantIdx = null;
    protected PreparedStatement stmtReadBuffBySofiaIdx = null;
    protected PreparedStatement stmtReadBuffByUNameIdx = null;
    protected PreparedStatement stmtDeleteByIdIdx = null;
    protected PreparedStatement stmtDeleteByTenantIdx = null;
    protected PreparedStatement stmtDeleteBySofiaIdx = null;
    protected PreparedStatement stmtDeleteByUNameIdx = null;

    public CFFswMySqlFSSFProfileTable(CFFswMySqlSchema argSchema) {
        schema = argSchema;
    }

    public void createFSSFProfile(CFFswAuthorization Authorization, CFFswFSSFProfileBuff Buff) {
        final String S_ProcName = "createFSSFProfile";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        ResultSet resultSet = null;
        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();
            Connection cnx = schema.getCnx();
            String sql = "call " + schema.getLowerDbSchemaName() + ".sp_create_fssfprofile( ?, ?, ?, ?, ?, ?" + ", "
                    + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                    + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                    + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                    + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                    + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                    + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                    + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                    + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                    + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                    + ", " + "?" + ", " + "?" + " )";
            if (stmtCreateByPKey == null) {
                stmtCreateByPKey = cnx.prepareStatement(sql);
            }
            int argIdx = 1;
            stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
            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++, "FSPF");
            stmtCreateByPKey.setLong(argIdx++, TenantId);
            stmtCreateByPKey.setLong(argIdx++, FSSFProfileId);
            stmtCreateByPKey.setLong(argIdx++, FSSofiaId);
            stmtCreateByPKey.setString(argIdx++, Name);
            stmtCreateByPKey.setShort(argIdx++, Debug);
            stmtCreateByPKey.setBoolean(argIdx++, SipTrace);
            stmtCreateByPKey.setShort(argIdx++, SipPort);
            stmtCreateByPKey.setString(argIdx++, Dialplan);
            stmtCreateByPKey.setString(argIdx++, Context);
            stmtCreateByPKey.setInt(argIdx++, DTMFDuration);
            stmtCreateByPKey.setString(argIdx++, CodecPrefs);
            stmtCreateByPKey.setString(argIdx++, HoldMusic);
            stmtCreateByPKey.setString(argIdx++, RTPTimerName);
            stmtCreateByPKey.setBoolean(argIdx++, Enable100Rel);
            stmtCreateByPKey.setBoolean(argIdx++, ManagePresence);
            if (DbName != null) {
                stmtCreateByPKey.setString(argIdx++, DbName);
            } else {
                stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
            }
            stmtCreateByPKey.setString(argIdx++, PresenceHosts);
            stmtCreateByPKey.setString(argIdx++, ForceRegisterDomain);
            if (ForceRegisterDbDomain != null) {
                stmtCreateByPKey.setString(argIdx++, ForceRegisterDbDomain);
            } else {
                stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
            }
            stmtCreateByPKey.setBoolean(argIdx++, AggressiveNATDetection);
            stmtCreateByPKey.setString(argIdx++, InboundCodecNegotiation);
            stmtCreateByPKey.setShort(argIdx++, NonCETTL);
            stmtCreateByPKey.setBoolean(argIdx++, AuthCalls);
            stmtCreateByPKey.setInt(argIdx++, RtpTimeoutSec);
            stmtCreateByPKey.setString(argIdx++, RtpIP);
            stmtCreateByPKey.setString(argIdx++, SipIP);
            stmtCreateByPKey.setString(argIdx++, ExtRtpIP);
            stmtCreateByPKey.setString(argIdx++, ExtSipIP);
            stmtCreateByPKey.setBoolean(argIdx++, Enable3PCC);
            stmtCreateByPKey.setString(argIdx++, TlsBindParams);
            stmtCreateByPKey.setShort(argIdx++, TlsSipPort);
            stmtCreateByPKey.setString(argIdx++, TlsCertDir);
            stmtCreateByPKey.setString(argIdx++, TlsVersion);
            stmtCreateByPKey.setBoolean(argIdx++, RtpAutoflushDuringBridge);
            stmtCreateByPKey.setBoolean(argIdx++, RtpRewriteTimestamp);
            stmtCreateByPKey.setBoolean(argIdx++, PassRFC2833);
            if (OdbcDSN != null) {
                stmtCreateByPKey.setString(argIdx++, OdbcDSN);
            } else {
                stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
            }
            stmtCreateByPKey.setBoolean(argIdx++, InboundBypassMedia);
            stmtCreateByPKey.setBoolean(argIdx++, InboundProxyMedia);
            stmtCreateByPKey.setBoolean(argIdx++, InboundLateNegotiation);
            stmtCreateByPKey.setBoolean(argIdx++, AcceptBlindReg);
            stmtCreateByPKey.setBoolean(argIdx++, AcceptBlindAuth);
            stmtCreateByPKey.setBoolean(argIdx++, SuppressCNG);
            stmtCreateByPKey.setBoolean(argIdx++, DisableTranscoding);
            stmtCreateByPKey.setBoolean(argIdx++, DisableTransfer);
            stmtCreateByPKey.setBoolean(argIdx++, NDLBBrokenAuthHash);
            stmtCreateByPKey.setBoolean(argIdx++, NDLBReceivedInNATRegContact);
            stmtCreateByPKey.setBoolean(argIdx++, InboundRegForceMatchingUsername);
            stmtCreateByPKey.setBoolean(argIdx++, AuthAllPackets);
            stmtCreateByPKey.setString(argIdx++, Vad);
            stmtCreateByPKey.setString(argIdx++, Alias);
            stmtCreateByPKey.setInt(argIdx++, ForceSubscriptionExpires);
            stmtCreateByPKey.setBoolean(argIdx++, DisableRegister);
            stmtCreateByPKey.setBoolean(argIdx++, NDLBForceReport);
            stmtCreateByPKey.setString(argIdx++, ChallengeRealm);
            stmtCreateByPKey.setBoolean(argIdx++, DisableRtpAutoAdjust);
            stmtCreateByPKey.setBoolean(argIdx++, InboundUseCallIdAsUUID);
            stmtCreateByPKey.setBoolean(argIdx++, OutboundUseUUIDAsCallId);
            stmtCreateByPKey.setBoolean(argIdx++, RtpAutofixTiming);
            stmtCreateByPKey.setString(argIdx++, AutoRtpBugs);
            stmtCreateByPKey.setBoolean(argIdx++, DisableSrv);
            stmtCreateByPKey.setBoolean(argIdx++, DisableNAPtr);
            stmtCreateByPKey.setInt(argIdx++, TimerT1);
            stmtCreateByPKey.setInt(argIdx++, TimerT1X64);
            stmtCreateByPKey.setInt(argIdx++, TimerT2);
            stmtCreateByPKey.setInt(argIdx++, TimerT4);
            try {
                resultSet = stmtCreateByPKey.executeQuery();
            } catch (SQLException e) {
                if (e.getErrorCode() != 1329) {
                    throw e;
                }
                resultSet = null;
            }
            if ((resultSet != null) && resultSet.next()) {
                CFFswFSSFProfileBuff createdBuff = unpackFSSFProfileResultSetToBuff(resultSet);
                if ((resultSet != null) && resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                Buff.setRequiredTenantId(createdBuff.getRequiredTenantId());
                Buff.setRequiredFSSFProfileId(createdBuff.getRequiredFSSFProfileId());
                Buff.setRequiredFSSofiaId(createdBuff.getRequiredFSSofiaId());
                Buff.setRequiredName(createdBuff.getRequiredName());
                Buff.setRequiredDebug(createdBuff.getRequiredDebug());
                Buff.setRequiredSipTrace(createdBuff.getRequiredSipTrace());
                Buff.setRequiredSipPort(createdBuff.getRequiredSipPort());
                Buff.setRequiredDialplan(createdBuff.getRequiredDialplan());
                Buff.setRequiredContext(createdBuff.getRequiredContext());
                Buff.setRequiredDTMFDuration(createdBuff.getRequiredDTMFDuration());
                Buff.setRequiredCodecPrefs(createdBuff.getRequiredCodecPrefs());
                Buff.setRequiredHoldMusic(createdBuff.getRequiredHoldMusic());
                Buff.setRequiredRTPTimerName(createdBuff.getRequiredRTPTimerName());
                Buff.setRequiredEnable100Rel(createdBuff.getRequiredEnable100Rel());
                Buff.setRequiredManagePresence(createdBuff.getRequiredManagePresence());
                Buff.setOptionalDbName(createdBuff.getOptionalDbName());
                Buff.setRequiredPresenceHosts(createdBuff.getRequiredPresenceHosts());
                Buff.setRequiredForceRegisterDomain(createdBuff.getRequiredForceRegisterDomain());
                Buff.setOptionalForceRegisterDbDomain(createdBuff.getOptionalForceRegisterDbDomain());
                Buff.setRequiredAggressiveNATDetection(createdBuff.getRequiredAggressiveNATDetection());
                Buff.setRequiredInboundCodecNegotiation(createdBuff.getRequiredInboundCodecNegotiation());
                Buff.setRequiredNonCETTL(createdBuff.getRequiredNonCETTL());
                Buff.setRequiredAuthCalls(createdBuff.getRequiredAuthCalls());
                Buff.setRequiredRtpTimeoutSec(createdBuff.getRequiredRtpTimeoutSec());
                Buff.setRequiredRtpIP(createdBuff.getRequiredRtpIP());
                Buff.setRequiredSipIP(createdBuff.getRequiredSipIP());
                Buff.setRequiredExtRtpIP(createdBuff.getRequiredExtRtpIP());
                Buff.setRequiredExtSipIP(createdBuff.getRequiredExtSipIP());
                Buff.setRequiredEnable3PCC(createdBuff.getRequiredEnable3PCC());
                Buff.setRequiredTlsBindParams(createdBuff.getRequiredTlsBindParams());
                Buff.setRequiredTlsSipPort(createdBuff.getRequiredTlsSipPort());
                Buff.setRequiredTlsCertDir(createdBuff.getRequiredTlsCertDir());
                Buff.setRequiredTlsVersion(createdBuff.getRequiredTlsVersion());
                Buff.setRequiredRtpAutoflushDuringBridge(createdBuff.getRequiredRtpAutoflushDuringBridge());
                Buff.setRequiredRtpRewriteTimestamp(createdBuff.getRequiredRtpRewriteTimestamp());
                Buff.setRequiredPassRFC2833(createdBuff.getRequiredPassRFC2833());
                Buff.setOptionalOdbcDSN(createdBuff.getOptionalOdbcDSN());
                Buff.setRequiredInboundBypassMedia(createdBuff.getRequiredInboundBypassMedia());
                Buff.setRequiredInboundProxyMedia(createdBuff.getRequiredInboundProxyMedia());
                Buff.setRequiredInboundLateNegotiation(createdBuff.getRequiredInboundLateNegotiation());
                Buff.setRequiredAcceptBlindReg(createdBuff.getRequiredAcceptBlindReg());
                Buff.setRequiredAcceptBlindAuth(createdBuff.getRequiredAcceptBlindAuth());
                Buff.setRequiredSuppressCNG(createdBuff.getRequiredSuppressCNG());
                Buff.setRequiredDisableTranscoding(createdBuff.getRequiredDisableTranscoding());
                Buff.setRequiredDisableTransfer(createdBuff.getRequiredDisableTransfer());
                Buff.setRequiredNDLBBrokenAuthHash(createdBuff.getRequiredNDLBBrokenAuthHash());
                Buff.setRequiredNDLBReceivedInNATRegContact(createdBuff.getRequiredNDLBReceivedInNATRegContact());
                Buff.setRequiredInboundRegForceMatchingUsername(
                        createdBuff.getRequiredInboundRegForceMatchingUsername());
                Buff.setRequiredAuthAllPackets(createdBuff.getRequiredAuthAllPackets());
                Buff.setRequiredVad(createdBuff.getRequiredVad());
                Buff.setRequiredAlias(createdBuff.getRequiredAlias());
                Buff.setRequiredForceSubscriptionExpires(createdBuff.getRequiredForceSubscriptionExpires());
                Buff.setRequiredDisableRegister(createdBuff.getRequiredDisableRegister());
                Buff.setRequiredNDLBForceReport(createdBuff.getRequiredNDLBForceReport());
                Buff.setRequiredChallengeRealm(createdBuff.getRequiredChallengeRealm());
                Buff.setRequiredDisableRtpAutoAdjust(createdBuff.getRequiredDisableRtpAutoAdjust());
                Buff.setRequiredInboundUseCallIdAsUUID(createdBuff.getRequiredInboundUseCallIdAsUUID());
                Buff.setRequiredOutboundUseUUIDAsCallId(createdBuff.getRequiredOutboundUseUUIDAsCallId());
                Buff.setRequiredRtpAutofixTiming(createdBuff.getRequiredRtpAutofixTiming());
                Buff.setRequiredAutoRtpBugs(createdBuff.getRequiredAutoRtpBugs());
                Buff.setRequiredDisableSrv(createdBuff.getRequiredDisableSrv());
                Buff.setRequiredDisableNAPtr(createdBuff.getRequiredDisableNAPtr());
                Buff.setRequiredTimerT1(createdBuff.getRequiredTimerT1());
                Buff.setRequiredTimerT1X64(createdBuff.getRequiredTimerT1X64());
                Buff.setRequiredTimerT2(createdBuff.getRequiredTimerT2());
                Buff.setRequiredTimerT4(createdBuff.getRequiredTimerT4());
                Buff.setRequiredRevision(createdBuff.getRequiredRevision());
                Buff.setCreatedByUserId(createdBuff.getCreatedByUserId());
                Buff.setCreatedAt(createdBuff.getCreatedAt());
                Buff.setUpdatedByUserId(createdBuff.getUpdatedByUserId());
                Buff.setUpdatedAt(createdBuff.getUpdatedAt());
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Expected a single-record response, " + resultSet.getRow() + " rows selected");
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        } finally {
            if (resultSet != null) {
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            }
        }
    }

    protected static String S_sqlSelectFSSFProfileDistinctClassCode = null;

    public String getSqlSelectFSSFProfileDistinctClassCode() {
        if (S_sqlSelectFSSFProfileDistinctClassCode == null) {
            S_sqlSelectFSSFProfileDistinctClassCode = "SELECT " + "DISTINCT fspf.ClassCode " + "FROM "
                    + schema.getLowerDbSchemaName() + ".FSSFProfile AS fspf ";
        }
        return (S_sqlSelectFSSFProfileDistinctClassCode);
    }

    protected static String S_sqlSelectFSSFProfileBuff = null;

    public String getSqlSelectFSSFProfileBuff() {
        if (S_sqlSelectFSSFProfileBuff == null) {
            S_sqlSelectFSSFProfileBuff = "SELECT " + "fspf.TenantId, " + "fspf.FSSFProfileId, " + "fspf.FSSofiaId, "
                    + "fspf.Name, " + "fspf.Debug, " + "fspf.SipTrace, " + "fspf.SipPort, " + "fspf.Dialplan, "
                    + "fspf.Context, " + "fspf.DTMFDuration, " + "fspf.CodecPrefs, " + "fspf.HoldMusic, "
                    + "fspf.RTPTimerName, " + "fspf.Enable100Rel, " + "fspf.ManagePresence, " + "fspf.DbName, "
                    + "fspf.PresenceHosts, " + "fspf.ForceRegisterDomain, " + "fspf.ForceRegisterDbDomain, "
                    + "fspf.AggressiveNATDetection, " + "fspf.InboundCodecNegotiation, " + "fspf.NonCETTL, "
                    + "fspf.AuthCalls, " + "fspf.RtpTimeoutSec, " + "fspf.RtpIP, " + "fspf.SipIP, "
                    + "fspf.ExtRtpIP, " + "fspf.ExtSipIP, " + "fspf.Enable3PCC, " + "fspf.TlsBindParams, "
                    + "fspf.TlsSipPort, " + "fspf.TlsCertDir, " + "fspf.TlsVersion, "
                    + "fspf.RtpAutoflushDuringBridge, " + "fspf.RtpRewriteTimestamp, " + "fspf.PassRFC2833, "
                    + "fspf.OdbcDSN, " + "fspf.InboundBypassMedia, " + "fspf.InboundProxyMedia, "
                    + "fspf.InboundLateNegotiation, " + "fspf.AcceptBlindReg, " + "fspf.AcceptBlindAuth, "
                    + "fspf.SuppressCNG, " + "fspf.DisableTranscoding, " + "fspf.DisableTransfer, "
                    + "fspf.NDLBBrokenAuthHash, " + "fspf.NDLBReceivedInNATRegContact, " + "fspf.inbndregfrcmusr, "
                    + "fspf.AuthAllPackets, " + "fspf.Vad, " + "fspf.Alias, " + "fspf.ForceSubscriptionExpires, "
                    + "fspf.DisableRegister, " + "fspf.NDLBForceReport, " + "fspf.ChallengeRealm, "
                    + "fspf.DisableRtpAutoAdjust, " + "fspf.InboundUseCallIdAsUUID, "
                    + "fspf.OutboundUseUUIDAsCallId, " + "fspf.RtpAutofixTiming, " + "fspf.AutoRtpBugs, "
                    + "fspf.DisableSrv, " + "fspf.DisableNAPtr, " + "fspf.TimerT1, " + "fspf.TimerT1X64, "
                    + "fspf.TimerT2, " + "fspf.TimerT4, " + "fspf.Revision " + "FROM "
                    + schema.getLowerDbSchemaName() + ".FSSFProfile AS fspf ";
        }
        return (S_sqlSelectFSSFProfileBuff);
    }

    protected CFFswFSSFProfileBuff unpackFSSFProfileResultSetToBuff(ResultSet resultSet) throws SQLException {
        final String S_ProcName = "unpackFSSFProfileResultSetToBuff";
        int idxcol = 1;
        CFFswFSSFProfileBuff buff = schema.getFactoryFSSFProfile().newBuff();
        {
            String colString = resultSet.getString(idxcol);
            if (resultSet.wasNull()) {
                buff.setCreatedAt(null);
            } else if ((colString == null) || (colString.length() <= 0)) {
                buff.setCreatedAt(null);
            } else {
                buff.setCreatedAt(CFFswMySqlSchema.convertTimestampString(colString));
            }
        }
        idxcol++;
        {
            String colString = resultSet.getString(idxcol);
            if (resultSet.wasNull()) {
                buff.setCreatedByUserId(null);
            } else if ((colString == null) || (colString.length() <= 0)) {
                buff.setCreatedByUserId(null);
            } else {
                buff.setCreatedByUserId(UUID.fromString(colString));
            }
        }
        idxcol++;
        {
            String colString = resultSet.getString(idxcol);
            if (resultSet.wasNull()) {
                buff.setUpdatedAt(null);
            } else if ((colString == null) || (colString.length() <= 0)) {
                buff.setUpdatedAt(null);
            } else {
                buff.setUpdatedAt(CFFswMySqlSchema.convertTimestampString(colString));
            }
        }
        idxcol++;
        {
            String colString = resultSet.getString(idxcol);
            if (resultSet.wasNull()) {
                buff.setUpdatedByUserId(null);
            } else if ((colString == null) || (colString.length() <= 0)) {
                buff.setUpdatedByUserId(null);
            } else {
                buff.setUpdatedByUserId(UUID.fromString(colString));
            }
        }
        idxcol++;
        buff.setRequiredTenantId(resultSet.getLong(idxcol));
        idxcol++;
        buff.setRequiredFSSFProfileId(resultSet.getLong(idxcol));
        idxcol++;
        buff.setRequiredFSSofiaId(resultSet.getLong(idxcol));
        idxcol++;
        buff.setRequiredName(resultSet.getString(idxcol));
        idxcol++;
        buff.setRequiredDebug(resultSet.getShort(idxcol));
        idxcol++;
        buff.setRequiredSipTrace(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredSipPort(resultSet.getShort(idxcol));
        idxcol++;
        buff.setRequiredDialplan(resultSet.getString(idxcol));
        idxcol++;
        buff.setRequiredContext(resultSet.getString(idxcol));
        idxcol++;
        buff.setRequiredDTMFDuration(resultSet.getInt(idxcol));
        idxcol++;
        buff.setRequiredCodecPrefs(resultSet.getString(idxcol));
        idxcol++;
        buff.setRequiredHoldMusic(resultSet.getString(idxcol));
        idxcol++;
        buff.setRequiredRTPTimerName(resultSet.getString(idxcol));
        idxcol++;
        buff.setRequiredEnable100Rel(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredManagePresence(resultSet.getBoolean(idxcol));
        idxcol++;
        {
            String colVal = resultSet.getString(idxcol);
            if (resultSet.wasNull()) {
                buff.setOptionalDbName(null);
            } else {
                buff.setOptionalDbName(colVal);
            }
        }
        idxcol++;
        buff.setRequiredPresenceHosts(resultSet.getString(idxcol));
        idxcol++;
        buff.setRequiredForceRegisterDomain(resultSet.getString(idxcol));
        idxcol++;
        {
            String colVal = resultSet.getString(idxcol);
            if (resultSet.wasNull()) {
                buff.setOptionalForceRegisterDbDomain(null);
            } else {
                buff.setOptionalForceRegisterDbDomain(colVal);
            }
        }
        idxcol++;
        buff.setRequiredAggressiveNATDetection(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredInboundCodecNegotiation(resultSet.getString(idxcol));
        idxcol++;
        buff.setRequiredNonCETTL(resultSet.getShort(idxcol));
        idxcol++;
        buff.setRequiredAuthCalls(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredRtpTimeoutSec(resultSet.getInt(idxcol));
        idxcol++;
        buff.setRequiredRtpIP(resultSet.getString(idxcol));
        idxcol++;
        buff.setRequiredSipIP(resultSet.getString(idxcol));
        idxcol++;
        buff.setRequiredExtRtpIP(resultSet.getString(idxcol));
        idxcol++;
        buff.setRequiredExtSipIP(resultSet.getString(idxcol));
        idxcol++;
        buff.setRequiredEnable3PCC(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredTlsBindParams(resultSet.getString(idxcol));
        idxcol++;
        buff.setRequiredTlsSipPort(resultSet.getShort(idxcol));
        idxcol++;
        buff.setRequiredTlsCertDir(resultSet.getString(idxcol));
        idxcol++;
        buff.setRequiredTlsVersion(resultSet.getString(idxcol));
        idxcol++;
        buff.setRequiredRtpAutoflushDuringBridge(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredRtpRewriteTimestamp(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredPassRFC2833(resultSet.getBoolean(idxcol));
        idxcol++;
        {
            String colVal = resultSet.getString(idxcol);
            if (resultSet.wasNull()) {
                buff.setOptionalOdbcDSN(null);
            } else {
                buff.setOptionalOdbcDSN(colVal);
            }
        }
        idxcol++;
        buff.setRequiredInboundBypassMedia(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredInboundProxyMedia(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredInboundLateNegotiation(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredAcceptBlindReg(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredAcceptBlindAuth(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredSuppressCNG(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredDisableTranscoding(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredDisableTransfer(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredNDLBBrokenAuthHash(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredNDLBReceivedInNATRegContact(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredInboundRegForceMatchingUsername(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredAuthAllPackets(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredVad(resultSet.getString(idxcol));
        idxcol++;
        buff.setRequiredAlias(resultSet.getString(idxcol));
        idxcol++;
        buff.setRequiredForceSubscriptionExpires(resultSet.getInt(idxcol));
        idxcol++;
        buff.setRequiredDisableRegister(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredNDLBForceReport(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredChallengeRealm(resultSet.getString(idxcol));
        idxcol++;
        buff.setRequiredDisableRtpAutoAdjust(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredInboundUseCallIdAsUUID(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredOutboundUseUUIDAsCallId(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredRtpAutofixTiming(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredAutoRtpBugs(resultSet.getString(idxcol));
        idxcol++;
        buff.setRequiredDisableSrv(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredDisableNAPtr(resultSet.getBoolean(idxcol));
        idxcol++;
        buff.setRequiredTimerT1(resultSet.getInt(idxcol));
        idxcol++;
        buff.setRequiredTimerT1X64(resultSet.getInt(idxcol));
        idxcol++;
        buff.setRequiredTimerT2(resultSet.getInt(idxcol));
        idxcol++;
        buff.setRequiredTimerT4(resultSet.getInt(idxcol));
        idxcol++;

        buff.setRequiredRevision(resultSet.getInt(idxcol));
        return (buff);
    }

    public CFFswFSSFProfileBuff readDerived(CFFswAuthorization Authorization, CFFswFSSFProfilePKey PKey) {
        final String S_ProcName = "readDerived";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        CFFswFSSFProfileBuff buff;
        buff = readBuff(Authorization, PKey);
        return (buff);
    }

    public CFFswFSSFProfileBuff lockDerived(CFFswAuthorization Authorization, CFFswFSSFProfilePKey PKey) {
        final String S_ProcName = "lockDerived";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        CFFswFSSFProfileBuff buff;
        buff = lockBuff(Authorization, PKey);
        return (buff);
    }

    public CFFswFSSFProfileBuff[] readAllDerived(CFFswAuthorization Authorization) {
        final String S_ProcName = "readAllDerived";
        CFFswFSSFProfileBuff[] buffArray;
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        buffArray = readAllBuff(Authorization);
        return (buffArray);
    }

    public CFFswFSSFProfileBuff readDerivedByIdIdx(CFFswAuthorization Authorization, long TenantId,
            long FSSFProfileId) {
        final String S_ProcName = "CFFswMySqlFSSFProfileTable.readDerivedByIdIdx() ";
        CFFswFSSFProfileBuff buff;
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        buff = readBuffByIdIdx(Authorization, TenantId, FSSFProfileId);
        return (buff);
    }

    public CFFswFSSFProfileBuff[] readDerivedByTenantIdx(CFFswAuthorization Authorization, long TenantId) {
        final String S_ProcName = "readDerivedByTenantIdx";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        CFFswFSSFProfileBuff[] buffList = readBuffByTenantIdx(Authorization, TenantId);
        return (buffList);

    }

    public CFFswFSSFProfileBuff[] readDerivedBySofiaIdx(CFFswAuthorization Authorization, long TenantId,
            long FSSofiaId) {
        final String S_ProcName = "readDerivedBySofiaIdx";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        CFFswFSSFProfileBuff[] buffList = readBuffBySofiaIdx(Authorization, TenantId, FSSofiaId);
        return (buffList);

    }

    public CFFswFSSFProfileBuff[] readDerivedByUNameIdx(CFFswAuthorization Authorization, long TenantId,
            long FSSofiaId, String Name) {
        final String S_ProcName = "readDerivedByUNameIdx";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        CFFswFSSFProfileBuff[] buffList = readBuffByUNameIdx(Authorization, TenantId, FSSofiaId, Name);
        return (buffList);

    }

    public CFFswFSSFProfileBuff readBuff(CFFswAuthorization Authorization, CFFswFSSFProfilePKey PKey) {
        final String S_ProcName = "readBuff";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        ResultSet resultSet = null;
        try {
            Connection cnx = schema.getCnx();
            long TenantId = PKey.getRequiredTenantId();
            long FSSFProfileId = PKey.getRequiredFSSFProfileId();
            String sql = "call " + schema.getLowerDbSchemaName() + ".sp_read_fssfprofile( ?, ?, ?, ?, ?" + ", "
                    + "?" + ", " + "?" + " )";
            if (stmtReadBuffByPKey == null) {
                stmtReadBuffByPKey = cnx.prepareStatement(sql);
            }
            int argIdx = 1;
            stmtReadBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtReadBuffByPKey.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecUserId().toString());
            stmtReadBuffByPKey.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
            stmtReadBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtReadBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
            stmtReadBuffByPKey.setLong(argIdx++, TenantId);
            stmtReadBuffByPKey.setLong(argIdx++, FSSFProfileId);
            try {
                resultSet = stmtReadBuffByPKey.executeQuery();
            } catch (SQLException e) {
                if (e.getErrorCode() != 1329) {
                    throw e;
                }
                resultSet = null;
            }
            if ((resultSet != null) && resultSet.next()) {
                CFFswFSSFProfileBuff buff = unpackFSSFProfileResultSetToBuff(resultSet);
                if ((resultSet != null) && resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        } finally {
            if (resultSet != null) {
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            }
        }
    }

    public CFFswFSSFProfileBuff lockBuff(CFFswAuthorization Authorization, CFFswFSSFProfilePKey PKey) {
        final String S_ProcName = "lockBuff";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        ResultSet resultSet = null;
        try {
            Connection cnx = schema.getCnx();
            long TenantId = PKey.getRequiredTenantId();
            long FSSFProfileId = PKey.getRequiredFSSFProfileId();
            String sql = "call " + schema.getLowerDbSchemaName() + ".sp_lock_fssfprofile( ?, ?, ?, ?, ?" + ", "
                    + "?" + ", " + "?" + " )";
            if (stmtLockBuffByPKey == null) {
                stmtLockBuffByPKey = cnx.prepareStatement(sql);
            }
            int argIdx = 1;
            stmtLockBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtLockBuffByPKey.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecUserId().toString());
            stmtLockBuffByPKey.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
            stmtLockBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtLockBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
            stmtLockBuffByPKey.setLong(argIdx++, TenantId);
            stmtLockBuffByPKey.setLong(argIdx++, FSSFProfileId);
            try {
                resultSet = stmtLockBuffByPKey.executeQuery();
            } catch (SQLException e) {
                if (e.getErrorCode() != 1329) {
                    throw e;
                }
                resultSet = null;
            }
            if ((resultSet != null) && resultSet.next()) {
                CFFswFSSFProfileBuff buff = unpackFSSFProfileResultSetToBuff(resultSet);
                if ((resultSet != null) && resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        } finally {
            if (resultSet != null) {
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            }
        }
    }

    public CFFswFSSFProfileBuff[] readAllBuff(CFFswAuthorization Authorization) {
        final String S_ProcName = "readAllBuff";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        ResultSet resultSet = null;
        try {
            Connection cnx = schema.getCnx();
            String sql = "call " + schema.getLowerDbSchemaName() + ".sp_read_fssfprofile_all( ?, ?, ?, ?, ? )";
            if (stmtReadAllBuff == null) {
                stmtReadAllBuff = cnx.prepareStatement(sql);
            }
            int argIdx = 1;
            stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtReadAllBuff.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecUserId().toString());
            stmtReadAllBuff.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
            stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
            try {
                resultSet = stmtReadAllBuff.executeQuery();
            } catch (SQLException e) {
                if (e.getErrorCode() != 1329) {
                    throw e;
                }
                resultSet = null;
            }
            List<CFFswFSSFProfileBuff> buffList = new LinkedList<CFFswFSSFProfileBuff>();
            while ((resultSet != null) && resultSet.next()) {
                CFFswFSSFProfileBuff buff = unpackFSSFProfileResultSetToBuff(resultSet);
                buffList.add(buff);
            }
            int idx = 0;
            CFFswFSSFProfileBuff[] retBuff = new CFFswFSSFProfileBuff[buffList.size()];
            Iterator<CFFswFSSFProfileBuff> iter = buffList.iterator();
            while (iter.hasNext()) {
                retBuff[idx++] = iter.next();
            }
            return (retBuff);
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        } finally {
            if (resultSet != null) {
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            }
        }
    }

    public CFFswFSSFProfileBuff readBuffByIdIdx(CFFswAuthorization Authorization, long TenantId,
            long FSSFProfileId) {
        final String S_ProcName = "readBuffByIdIdx";
        ResultSet resultSet = null;
        try {
            Connection cnx = schema.getCnx();
            String sql = "call " + schema.getLowerDbSchemaName() + ".sp_read_fssfprofile_by_ididx( ?, ?, ?, ?, ?"
                    + ", " + "?" + ", " + "?" + " )";
            if (stmtReadBuffByIdIdx == null) {
                stmtReadBuffByIdIdx = cnx.prepareStatement(sql);
            }
            int argIdx = 1;
            stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtReadBuffByIdIdx.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecUserId().toString());
            stmtReadBuffByIdIdx.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
            stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
            stmtReadBuffByIdIdx.setLong(argIdx++, TenantId);
            stmtReadBuffByIdIdx.setLong(argIdx++, FSSFProfileId);
            try {
                resultSet = stmtReadBuffByIdIdx.executeQuery();
            } catch (SQLException e) {
                if (e.getErrorCode() != 1329) {
                    throw e;
                }
                resultSet = null;
            }
            if ((resultSet != null) && resultSet.next()) {
                CFFswFSSFProfileBuff buff = unpackFSSFProfileResultSetToBuff(resultSet);
                if ((resultSet != null) && resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        } finally {
            if (resultSet != null) {
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            }
        }
    }

    public CFFswFSSFProfileBuff[] readBuffByTenantIdx(CFFswAuthorization Authorization, long TenantId) {
        final String S_ProcName = "readBuffByTenantIdx";
        ResultSet resultSet = null;
        try {
            Connection cnx = schema.getCnx();
            String sql = "call " + schema.getLowerDbSchemaName()
                    + ".sp_read_fssfprofile_by_tenantidx( ?, ?, ?, ?, ?" + ", " + "?" + " )";
            if (stmtReadBuffByTenantIdx == null) {
                stmtReadBuffByTenantIdx = cnx.prepareStatement(sql);
            }
            int argIdx = 1;
            stmtReadBuffByTenantIdx.setLong(argIdx++,
                    (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtReadBuffByTenantIdx.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecUserId().toString());
            stmtReadBuffByTenantIdx.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
            stmtReadBuffByTenantIdx.setLong(argIdx++,
                    (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtReadBuffByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
            stmtReadBuffByTenantIdx.setLong(argIdx++, TenantId);
            try {
                resultSet = stmtReadBuffByTenantIdx.executeQuery();
            } catch (SQLException e) {
                if (e.getErrorCode() != 1329) {
                    throw e;
                }
                resultSet = null;
            }
            List<CFFswFSSFProfileBuff> buffList = new LinkedList<CFFswFSSFProfileBuff>();
            while ((resultSet != null) && resultSet.next()) {
                CFFswFSSFProfileBuff buff = unpackFSSFProfileResultSetToBuff(resultSet);
                buffList.add(buff);
            }
            int idx = 0;
            CFFswFSSFProfileBuff[] retBuff = new CFFswFSSFProfileBuff[buffList.size()];
            Iterator<CFFswFSSFProfileBuff> iter = buffList.iterator();
            while (iter.hasNext()) {
                retBuff[idx++] = iter.next();
            }
            return (retBuff);
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        } finally {
            if (resultSet != null) {
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            }
        }
    }

    public CFFswFSSFProfileBuff[] readBuffBySofiaIdx(CFFswAuthorization Authorization, long TenantId,
            long FSSofiaId) {
        final String S_ProcName = "readBuffBySofiaIdx";
        ResultSet resultSet = null;
        try {
            Connection cnx = schema.getCnx();
            String sql = "call " + schema.getLowerDbSchemaName() + ".sp_read_fssfprofile_by_sofiaidx( ?, ?, ?, ?, ?"
                    + ", " + "?" + ", " + "?" + " )";
            if (stmtReadBuffBySofiaIdx == null) {
                stmtReadBuffBySofiaIdx = cnx.prepareStatement(sql);
            }
            int argIdx = 1;
            stmtReadBuffBySofiaIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtReadBuffBySofiaIdx.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecUserId().toString());
            stmtReadBuffBySofiaIdx.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
            stmtReadBuffBySofiaIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtReadBuffBySofiaIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
            stmtReadBuffBySofiaIdx.setLong(argIdx++, TenantId);
            stmtReadBuffBySofiaIdx.setLong(argIdx++, FSSofiaId);
            try {
                resultSet = stmtReadBuffBySofiaIdx.executeQuery();
            } catch (SQLException e) {
                if (e.getErrorCode() != 1329) {
                    throw e;
                }
                resultSet = null;
            }
            List<CFFswFSSFProfileBuff> buffList = new LinkedList<CFFswFSSFProfileBuff>();
            while ((resultSet != null) && resultSet.next()) {
                CFFswFSSFProfileBuff buff = unpackFSSFProfileResultSetToBuff(resultSet);
                buffList.add(buff);
            }
            int idx = 0;
            CFFswFSSFProfileBuff[] retBuff = new CFFswFSSFProfileBuff[buffList.size()];
            Iterator<CFFswFSSFProfileBuff> iter = buffList.iterator();
            while (iter.hasNext()) {
                retBuff[idx++] = iter.next();
            }
            return (retBuff);
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        } finally {
            if (resultSet != null) {
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            }
        }
    }

    public CFFswFSSFProfileBuff[] readBuffByUNameIdx(CFFswAuthorization Authorization, long TenantId,
            long FSSofiaId, String Name) {
        final String S_ProcName = "readBuffByUNameIdx";
        ResultSet resultSet = null;
        try {
            Connection cnx = schema.getCnx();
            String sql = "call " + schema.getLowerDbSchemaName() + ".sp_read_fssfprofile_by_unameidx( ?, ?, ?, ?, ?"
                    + ", " + "?" + ", " + "?" + ", " + "?" + " )";
            if (stmtReadBuffByUNameIdx == null) {
                stmtReadBuffByUNameIdx = cnx.prepareStatement(sql);
            }
            int argIdx = 1;
            stmtReadBuffByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtReadBuffByUNameIdx.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecUserId().toString());
            stmtReadBuffByUNameIdx.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
            stmtReadBuffByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtReadBuffByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
            stmtReadBuffByUNameIdx.setLong(argIdx++, TenantId);
            stmtReadBuffByUNameIdx.setLong(argIdx++, FSSofiaId);
            stmtReadBuffByUNameIdx.setString(argIdx++, Name);
            try {
                resultSet = stmtReadBuffByUNameIdx.executeQuery();
            } catch (SQLException e) {
                if (e.getErrorCode() != 1329) {
                    throw e;
                }
                resultSet = null;
            }
            List<CFFswFSSFProfileBuff> buffList = new LinkedList<CFFswFSSFProfileBuff>();
            while ((resultSet != null) && resultSet.next()) {
                CFFswFSSFProfileBuff buff = unpackFSSFProfileResultSetToBuff(resultSet);
                buffList.add(buff);
            }
            int idx = 0;
            CFFswFSSFProfileBuff[] retBuff = new CFFswFSSFProfileBuff[buffList.size()];
            Iterator<CFFswFSSFProfileBuff> iter = buffList.iterator();
            while (iter.hasNext()) {
                retBuff[idx++] = iter.next();
            }
            return (retBuff);
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        } finally {
            if (resultSet != null) {
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            }
        }
    }

    public void updateFSSFProfile(CFFswAuthorization Authorization, CFFswFSSFProfileBuff Buff) {
        final String S_ProcName = "updateFSSFProfile";
        ResultSet resultSet = null;
        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();
            Connection cnx = schema.getCnx();
            String sql = "call " + schema.getLowerDbSchemaName() + ".sp_update_fssfprofile( ?, ?, ?, ?, ?, ?" + ", "
                    + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                    + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                    + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                    + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                    + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                    + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                    + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                    + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                    + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                    + ", " + "?" + ", " + "?" + ", " + "?" + " )";
            if (stmtUpdateByPKey == null) {
                stmtUpdateByPKey = cnx.prepareStatement(sql);
            }
            int argIdx = 1;
            stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtUpdateByPKey.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecUserId().toString());
            stmtUpdateByPKey.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
            stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
            stmtUpdateByPKey.setString(argIdx++, "FSPF");
            stmtUpdateByPKey.setLong(argIdx++, TenantId);
            stmtUpdateByPKey.setLong(argIdx++, FSSFProfileId);
            stmtUpdateByPKey.setLong(argIdx++, FSSofiaId);
            stmtUpdateByPKey.setString(argIdx++, Name);
            stmtUpdateByPKey.setShort(argIdx++, Debug);
            stmtUpdateByPKey.setBoolean(argIdx++, SipTrace);
            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);
            stmtUpdateByPKey.setBoolean(argIdx++, Enable100Rel);
            stmtUpdateByPKey.setBoolean(argIdx++, ManagePresence);
            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);
            }
            stmtUpdateByPKey.setBoolean(argIdx++, AggressiveNATDetection);
            stmtUpdateByPKey.setString(argIdx++, InboundCodecNegotiation);
            stmtUpdateByPKey.setShort(argIdx++, NonCETTL);
            stmtUpdateByPKey.setBoolean(argIdx++, AuthCalls);
            stmtUpdateByPKey.setInt(argIdx++, RtpTimeoutSec);
            stmtUpdateByPKey.setString(argIdx++, RtpIP);
            stmtUpdateByPKey.setString(argIdx++, SipIP);
            stmtUpdateByPKey.setString(argIdx++, ExtRtpIP);
            stmtUpdateByPKey.setString(argIdx++, ExtSipIP);
            stmtUpdateByPKey.setBoolean(argIdx++, Enable3PCC);
            stmtUpdateByPKey.setString(argIdx++, TlsBindParams);
            stmtUpdateByPKey.setShort(argIdx++, TlsSipPort);
            stmtUpdateByPKey.setString(argIdx++, TlsCertDir);
            stmtUpdateByPKey.setString(argIdx++, TlsVersion);
            stmtUpdateByPKey.setBoolean(argIdx++, RtpAutoflushDuringBridge);
            stmtUpdateByPKey.setBoolean(argIdx++, RtpRewriteTimestamp);
            stmtUpdateByPKey.setBoolean(argIdx++, PassRFC2833);
            if (OdbcDSN != null) {
                stmtUpdateByPKey.setString(argIdx++, OdbcDSN);
            } else {
                stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
            }
            stmtUpdateByPKey.setBoolean(argIdx++, InboundBypassMedia);
            stmtUpdateByPKey.setBoolean(argIdx++, InboundProxyMedia);
            stmtUpdateByPKey.setBoolean(argIdx++, InboundLateNegotiation);
            stmtUpdateByPKey.setBoolean(argIdx++, AcceptBlindReg);
            stmtUpdateByPKey.setBoolean(argIdx++, AcceptBlindAuth);
            stmtUpdateByPKey.setBoolean(argIdx++, SuppressCNG);
            stmtUpdateByPKey.setBoolean(argIdx++, DisableTranscoding);
            stmtUpdateByPKey.setBoolean(argIdx++, DisableTransfer);
            stmtUpdateByPKey.setBoolean(argIdx++, NDLBBrokenAuthHash);
            stmtUpdateByPKey.setBoolean(argIdx++, NDLBReceivedInNATRegContact);
            stmtUpdateByPKey.setBoolean(argIdx++, InboundRegForceMatchingUsername);
            stmtUpdateByPKey.setBoolean(argIdx++, AuthAllPackets);
            stmtUpdateByPKey.setString(argIdx++, Vad);
            stmtUpdateByPKey.setString(argIdx++, Alias);
            stmtUpdateByPKey.setInt(argIdx++, ForceSubscriptionExpires);
            stmtUpdateByPKey.setBoolean(argIdx++, DisableRegister);
            stmtUpdateByPKey.setBoolean(argIdx++, NDLBForceReport);
            stmtUpdateByPKey.setString(argIdx++, ChallengeRealm);
            stmtUpdateByPKey.setBoolean(argIdx++, DisableRtpAutoAdjust);
            stmtUpdateByPKey.setBoolean(argIdx++, InboundUseCallIdAsUUID);
            stmtUpdateByPKey.setBoolean(argIdx++, OutboundUseUUIDAsCallId);
            stmtUpdateByPKey.setBoolean(argIdx++, RtpAutofixTiming);
            stmtUpdateByPKey.setString(argIdx++, AutoRtpBugs);
            stmtUpdateByPKey.setBoolean(argIdx++, DisableSrv);
            stmtUpdateByPKey.setBoolean(argIdx++, DisableNAPtr);
            stmtUpdateByPKey.setInt(argIdx++, TimerT1);
            stmtUpdateByPKey.setInt(argIdx++, TimerT1X64);
            stmtUpdateByPKey.setInt(argIdx++, TimerT2);
            stmtUpdateByPKey.setInt(argIdx++, TimerT4);
            stmtUpdateByPKey.setInt(argIdx++, Revision);
            try {
                resultSet = stmtUpdateByPKey.executeQuery();
            } catch (SQLException e) {
                if (e.getErrorCode() != 1329) {
                    throw e;
                }
                resultSet = null;
            }
            if ((resultSet != null) && resultSet.next()) {
                CFFswFSSFProfileBuff updatedBuff = unpackFSSFProfileResultSetToBuff(resultSet);
                if ((resultSet != null) && resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                Buff.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().newDbException(getClass(), S_ProcName, e);
        } finally {
            if (resultSet != null) {
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            }
        }
    }

    public void deleteFSSFProfile(CFFswAuthorization Authorization, CFFswFSSFProfileBuff Buff) {
        final String S_ProcName = "deleteFSSFProfile";
        ResultSet resultSet = null;
        try {
            Connection cnx = schema.getCnx();
            long TenantId = Buff.getRequiredTenantId();
            long FSSFProfileId = Buff.getRequiredFSSFProfileId();

            String sql = "call " + schema.getLowerDbSchemaName() + ".sp_delete_fssfprofile( ?, ?, ?, ?, ?" + ", "
                    + "?" + ", " + "?" + ", " + "?" + " )";
            if (stmtDeleteByPKey == null) {
                stmtDeleteByPKey = cnx.prepareStatement(sql);
            }
            int argIdx = 1;
            stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtDeleteByPKey.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecUserId().toString());
            stmtDeleteByPKey.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
            stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
            stmtDeleteByPKey.setLong(argIdx++, TenantId);
            stmtDeleteByPKey.setLong(argIdx++, FSSFProfileId);
            stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision());
            ;
            stmtDeleteByPKey.executeUpdate();
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        } finally {
            if (resultSet != null) {
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            }
        }
    }

    public void deleteFSSFProfileByIdIdx(CFFswAuthorization Authorization, long argTenantId,
            long argFSSFProfileId) {
        final String S_ProcName = "deleteFSSFProfileByIdIdx";
        ResultSet resultSet = null;
        try {
            Connection cnx = schema.getCnx();
            String sql = "call " + schema.getLowerDbSchemaName() + ".sp_delete_fssfprofile_by_ididx( ?, ?, ?, ?, ?"
                    + ", " + "?" + ", " + "?" + " )";
            if (stmtDeleteByIdIdx == null) {
                stmtDeleteByIdIdx = cnx.prepareStatement(sql);
            }
            int argIdx = 1;
            stmtDeleteByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtDeleteByIdIdx.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecUserId().toString());
            stmtDeleteByIdIdx.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
            stmtDeleteByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtDeleteByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
            stmtDeleteByIdIdx.setLong(argIdx++, argTenantId);
            stmtDeleteByIdIdx.setLong(argIdx++, argFSSFProfileId);
            stmtDeleteByIdIdx.executeUpdate();
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        } finally {
            if (resultSet != null) {
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            }
        }
    }

    public void deleteFSSFProfileByIdIdx(CFFswAuthorization Authorization, CFFswFSSFProfilePKey argKey) {
        deleteFSSFProfileByIdIdx(Authorization, argKey.getRequiredTenantId(), argKey.getRequiredFSSFProfileId());
    }

    public void deleteFSSFProfileByTenantIdx(CFFswAuthorization Authorization, long argTenantId) {
        final String S_ProcName = "deleteFSSFProfileByTenantIdx";
        ResultSet resultSet = null;
        try {
            Connection cnx = schema.getCnx();
            String sql = "call " + schema.getLowerDbSchemaName()
                    + ".sp_delete_fssfprofile_by_tenantidx( ?, ?, ?, ?, ?" + ", " + "?" + " )";
            if (stmtDeleteByTenantIdx == null) {
                stmtDeleteByTenantIdx = cnx.prepareStatement(sql);
            }
            int argIdx = 1;
            stmtDeleteByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtDeleteByTenantIdx.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecUserId().toString());
            stmtDeleteByTenantIdx.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
            stmtDeleteByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtDeleteByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
            stmtDeleteByTenantIdx.setLong(argIdx++, argTenantId);
            stmtDeleteByTenantIdx.executeUpdate();
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        } finally {
            if (resultSet != null) {
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            }
        }
    }

    public void deleteFSSFProfileByTenantIdx(CFFswAuthorization Authorization,
            CFFswFSSFProfileByTenantIdxKey argKey) {
        deleteFSSFProfileByTenantIdx(Authorization, argKey.getRequiredTenantId());
    }

    public void deleteFSSFProfileBySofiaIdx(CFFswAuthorization Authorization, long argTenantId, long argFSSofiaId) {
        final String S_ProcName = "deleteFSSFProfileBySofiaIdx";
        ResultSet resultSet = null;
        try {
            Connection cnx = schema.getCnx();
            String sql = "call " + schema.getLowerDbSchemaName()
                    + ".sp_delete_fssfprofile_by_sofiaidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )";
            if (stmtDeleteBySofiaIdx == null) {
                stmtDeleteBySofiaIdx = cnx.prepareStatement(sql);
            }
            int argIdx = 1;
            stmtDeleteBySofiaIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtDeleteBySofiaIdx.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecUserId().toString());
            stmtDeleteBySofiaIdx.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
            stmtDeleteBySofiaIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtDeleteBySofiaIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
            stmtDeleteBySofiaIdx.setLong(argIdx++, argTenantId);
            stmtDeleteBySofiaIdx.setLong(argIdx++, argFSSofiaId);
            stmtDeleteBySofiaIdx.executeUpdate();
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        } finally {
            if (resultSet != null) {
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            }
        }
    }

    public void deleteFSSFProfileBySofiaIdx(CFFswAuthorization Authorization,
            CFFswFSSFProfileBySofiaIdxKey argKey) {
        deleteFSSFProfileBySofiaIdx(Authorization, argKey.getRequiredTenantId(), argKey.getRequiredFSSofiaId());
    }

    public void deleteFSSFProfileByUNameIdx(CFFswAuthorization Authorization, long argTenantId, long argFSSofiaId,
            String argName) {
        final String S_ProcName = "deleteFSSFProfileByUNameIdx";
        ResultSet resultSet = null;
        try {
            Connection cnx = schema.getCnx();
            String sql = "call " + schema.getLowerDbSchemaName()
                    + ".sp_delete_fssfprofile_by_unameidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?"
                    + " )";
            if (stmtDeleteByUNameIdx == null) {
                stmtDeleteByUNameIdx = cnx.prepareStatement(sql);
            }
            int argIdx = 1;
            stmtDeleteByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtDeleteByUNameIdx.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecUserId().toString());
            stmtDeleteByUNameIdx.setString(argIdx++,
                    (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
            stmtDeleteByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
            stmtDeleteByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
            stmtDeleteByUNameIdx.setLong(argIdx++, argTenantId);
            stmtDeleteByUNameIdx.setLong(argIdx++, argFSSofiaId);
            stmtDeleteByUNameIdx.setString(argIdx++, argName);
            stmtDeleteByUNameIdx.executeUpdate();
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        } finally {
            if (resultSet != null) {
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            }
        }
    }

    public void deleteFSSFProfileByUNameIdx(CFFswAuthorization Authorization,
            CFFswFSSFProfileByUNameIdxKey argKey) {
        deleteFSSFProfileByUNameIdx(Authorization, argKey.getRequiredTenantId(), argKey.getRequiredFSSofiaId(),
                argKey.getRequiredName());
    }

    public CFFswCursor openFSSFProfileCursorAll(CFFswAuthorization Authorization) {
        String sql = getSqlSelectFSSFProfileBuff()
                + ((schema.isSystemUser(Authorization)) ? ""
                        : (" WHERE fspf.TenantId = " + Authorization.getSecTenantId()))
                + "ORDER BY " + "fspf.TenantId ASC" + ", " + "fspf.FSSFProfileId ASC";
        CFFswCursor cursor = new CFFswMySqlCursor(Authorization, schema, sql);
        return (cursor);
    }

    public CFFswCursor openFSSFProfileCursorByTenantIdx(CFFswAuthorization Authorization, long TenantId) {
        String sql = getSqlSelectFSSFProfileBuff() + "WHERE " + "fspf.TenantId = " + Long.toString(TenantId) + " "
                + "ORDER BY " + "fspf.TenantId ASC" + ", " + "fspf.FSSFProfileId ASC";
        CFFswCursor cursor = new CFFswMySqlCursor(Authorization, schema, sql);
        return (cursor);
    }

    public CFFswCursor openFSSFProfileCursorBySofiaIdx(CFFswAuthorization Authorization, long TenantId,
            long FSSofiaId) {
        String sql = getSqlSelectFSSFProfileBuff() + "WHERE " + "fspf.TenantId = " + Long.toString(TenantId) + " "
                + "AND " + "fspf.FSSofiaId = " + Long.toString(FSSofiaId) + " " + "ORDER BY " + "fspf.TenantId ASC"
                + ", " + "fspf.FSSFProfileId ASC";
        CFFswCursor cursor = new CFFswMySqlCursor(Authorization, schema, sql);
        return (cursor);
    }

    public CFFswCursor openFSSFProfileCursorByUNameIdx(CFFswAuthorization Authorization, long TenantId,
            long FSSofiaId, String Name) {
        String sql = getSqlSelectFSSFProfileBuff() + "WHERE " + "fspf.TenantId = " + Long.toString(TenantId) + " "
                + "AND " + "fspf.FSSofiaId = " + Long.toString(FSSofiaId) + " " + "AND " + "fspf.Name = "
                + CFFswMySqlSchema.getQuotedString(Name) + " " + "ORDER BY " + "fspf.TenantId ASC" + ", "
                + "fspf.FSSFProfileId ASC";
        CFFswCursor cursor = new CFFswMySqlCursor(Authorization, schema, sql);
        return (cursor);
    }

    public void closeFSSFProfileCursor(CFFswCursor Cursor) {
        try {
            Cursor.getResultSet().close();
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), "closeFSSFProfileCursor", e);
        }
    }

    public CFFswFSSFProfileBuff nextFSSFProfileCursor(CFFswCursor Cursor) {
        final String S_ProcName = "nextFSSFProfileCursor";
        try {
            ResultSet resultSet = Cursor.getResultSet();
            if (!resultSet.next()) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "No more results available");
            }
            CFFswFSSFProfileBuff buff = unpackFSSFProfileResultSetToBuff(resultSet);
            return (buff);
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
    }

    public CFFswFSSFProfileBuff prevFSSFProfileCursor(CFFswCursor Cursor) {
        int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1;
        CFFswFSSFProfileBuff buff = null;
        if (Cursor.getRowIdx() >= targetRowIdx) {
            Cursor.reset();
        }
        while (Cursor.getRowIdx() < targetRowIdx) {
            buff = nextFSSFProfileCursor(Cursor);
        }
        return (buff);
    }

    public CFFswFSSFProfileBuff firstFSSFProfileCursor(CFFswCursor Cursor) {
        int targetRowIdx = 1;
        CFFswFSSFProfileBuff buff = null;
        Cursor.reset();
        while (Cursor.getRowIdx() < targetRowIdx) {
            buff = nextFSSFProfileCursor(Cursor);
        }
        return (buff);
    }

    public CFFswFSSFProfileBuff lastFSSFProfileCursor(CFFswCursor Cursor) {
        throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastFSSFProfileCursor");
    }

    public CFFswFSSFProfileBuff nthFSSFProfileCursor(CFFswCursor Cursor, int Idx) {
        int targetRowIdx = Idx;
        CFFswFSSFProfileBuff buff = null;
        if (Cursor.getRowIdx() >= targetRowIdx) {
            Cursor.reset();
        }
        while (Cursor.getRowIdx() < targetRowIdx) {
            buff = nextFSSFProfileCursor(Cursor);
        }
        return (buff);
    }

    /**
     *   Release the prepared statements.
     *   <p>
     *   When the schema changes connections, the prepared statements
     *   have to be released because they contain connection-specific
     *   information for most databases.
     */
    public void releasePreparedStatements() {
        S_sqlSelectFSSFProfileDistinctClassCode = null;
        S_sqlSelectFSSFProfileBuff = null;
        if (stmtReadBuffByPKey != null) {
            try {
                stmtReadBuffByPKey.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByPKey = null;
        }
        if (stmtLockBuffByPKey != null) {
            try {
                stmtLockBuffByPKey.close();
            } catch (SQLException e) {
            }
            stmtLockBuffByPKey = null;
        }
        if (stmtCreateByPKey != null) {
            try {
                stmtCreateByPKey.close();
            } catch (SQLException e) {
            }
            stmtCreateByPKey = null;
        }
        if (stmtUpdateByPKey != null) {
            try {
                stmtUpdateByPKey.close();
            } catch (SQLException e) {
            }
            stmtUpdateByPKey = null;
        }
        if (stmtDeleteByPKey != null) {
            try {
                stmtDeleteByPKey.close();
            } catch (SQLException e) {
            }
            stmtDeleteByPKey = null;
        }
        if (stmtDeleteByIdIdx != null) {
            try {
                stmtDeleteByIdIdx.close();
            } catch (SQLException e) {
            }
            stmtDeleteByIdIdx = null;
        }
        if (stmtDeleteByTenantIdx != null) {
            try {
                stmtDeleteByTenantIdx.close();
            } catch (SQLException e) {
            }
            stmtDeleteByTenantIdx = null;
        }
        if (stmtDeleteBySofiaIdx != null) {
            try {
                stmtDeleteBySofiaIdx.close();
            } catch (SQLException e) {
            }
            stmtDeleteBySofiaIdx = null;
        }
        if (stmtDeleteByUNameIdx != null) {
            try {
                stmtDeleteByUNameIdx.close();
            } catch (SQLException e) {
            }
            stmtDeleteByUNameIdx = null;
        }
        if (stmtReadAllBuff != null) {
            try {
                stmtReadAllBuff.close();
            } catch (SQLException e) {
            }
            stmtReadAllBuff = null;
        }
        if (stmtReadBuffByIdIdx != null) {
            try {
                stmtReadBuffByIdIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByIdIdx = null;
        }
        if (stmtReadBuffByTenantIdx != null) {
            try {
                stmtReadBuffByTenantIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByTenantIdx = null;
        }
        if (stmtReadBuffBySofiaIdx != null) {
            try {
                stmtReadBuffBySofiaIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffBySofiaIdx = null;
        }
        if (stmtReadBuffByUNameIdx != null) {
            try {
                stmtReadBuffByUNameIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByUNameIdx = null;
        }
    }
}