Example usage for java.sql CallableStatement setNull

List of usage examples for java.sql CallableStatement setNull

Introduction

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

Prototype

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

Source Link

Document

Sets the designated parameter to SQL NULL.

Usage

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

public void updateFSSFConferenceProfile(CFFswAuthorization Authorization, CFFswFSSFConferenceProfileBuff Buff) {
    final String S_ProcName = "updateFSSFConferenceProfile";
    ResultSet resultSet = null;/*from   w ww . j a v  a 2 s.c  o  m*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFFswFSSFConferenceProfileBuff> buffList = new LinkedList<CFFswFSSFConferenceProfileBuff>();
    try {
        long TenantId = Buff.getRequiredTenantId();
        long FSSFConferenceProfileId = Buff.getRequiredFSSFConferenceProfileId();
        long FSSFConferenceId = Buff.getRequiredFSSFConferenceId();
        String Name = Buff.getRequiredName();
        String SoundPrefix = Buff.getRequiredSoundPrefix();
        String AckSound = Buff.getOptionalAckSound();
        String AloneSound = Buff.getOptionalAloneSound();
        String BadPinSound = Buff.getOptionalBadPinSound();
        String EnterSound = Buff.getOptionalEnterSound();
        String ExitSound = Buff.getOptionalExitSound();
        String IsLockedSound = Buff.getOptionalIsLockedSound();
        String KickedSound = Buff.getOptionalKickedSound();
        String LockedSound = Buff.getOptionalLockedSound();
        String MaxMembersSound = Buff.getOptionalMaxMembersSound();
        String MOHSound = Buff.getOptionalMOHSound();
        String MuteDetectSound = Buff.getOptionalMuteDetectSound();
        String MutedSound = Buff.getOptionalMutedSound();
        String NackSound = Buff.getOptionalNackSound();
        String PerpetualSound = Buff.getOptionalPerpetualSound();
        String PinSound = Buff.getOptionalPinSound();
        String Pin = Buff.getOptionalPin();
        String UnmutedSound = Buff.getOptionalUnmutedSound();
        int Rate = Buff.getRequiredRate();
        String AutoRecord = Buff.getRequiredAutoRecord();
        int ValInterval = Buff.getRequiredValInterval();
        int EnergyLevel = Buff.getRequiredEnergyLevel();
        String MemberFlags = Buff.getRequiredMemberFlags();
        String ConferenceFlags = Buff.getRequiredConferenceFlags();
        String CallerControls = Buff.getRequiredCallerControls();
        String TTSEngine = Buff.getRequiredTTSEngine();
        String TTSVoice = Buff.getRequiredTTSVoice();
        int MaxMembers = Buff.getRequiredMaxMembers();
        int ComfortNoise = Buff.getRequiredComfortNoise();
        int AnnounceCount = Buff.getRequiredAnnounceCount();
        String SuppressEvents = Buff.getRequiredSuppressEvents();
        String VerboseEvents = Buff.getRequiredVerboseEvents();
        String CallerIdName = Buff.getOptionalCallerIdName();
        String CallerIdNumber = Buff.getOptionalCallerIdNumber();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx.prepareCall(
                "begin " + schema.getLowerDbSchemaName() + ".upd_fssfcnfprf( ?, ?, ?, ?, ?, ?, ?" + ", " + "?"
                        + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                        + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                        + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                        + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                        + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                        + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); end;");
        int argIdx = 1;
        stmtUpdateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtUpdateByPKey.setString(argIdx++, "FSCP");
        stmtUpdateByPKey.setLong(argIdx++, TenantId);
        stmtUpdateByPKey.setLong(argIdx++, FSSFConferenceProfileId);
        stmtUpdateByPKey.setLong(argIdx++, FSSFConferenceId);
        stmtUpdateByPKey.setString(argIdx++, Name);
        stmtUpdateByPKey.setString(argIdx++, SoundPrefix);
        if (AckSound != null) {
            stmtUpdateByPKey.setString(argIdx++, AckSound);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (AloneSound != null) {
            stmtUpdateByPKey.setString(argIdx++, AloneSound);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (BadPinSound != null) {
            stmtUpdateByPKey.setString(argIdx++, BadPinSound);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (EnterSound != null) {
            stmtUpdateByPKey.setString(argIdx++, EnterSound);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (ExitSound != null) {
            stmtUpdateByPKey.setString(argIdx++, ExitSound);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (IsLockedSound != null) {
            stmtUpdateByPKey.setString(argIdx++, IsLockedSound);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (KickedSound != null) {
            stmtUpdateByPKey.setString(argIdx++, KickedSound);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (LockedSound != null) {
            stmtUpdateByPKey.setString(argIdx++, LockedSound);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (MaxMembersSound != null) {
            stmtUpdateByPKey.setString(argIdx++, MaxMembersSound);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (MOHSound != null) {
            stmtUpdateByPKey.setString(argIdx++, MOHSound);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (MuteDetectSound != null) {
            stmtUpdateByPKey.setString(argIdx++, MuteDetectSound);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (MutedSound != null) {
            stmtUpdateByPKey.setString(argIdx++, MutedSound);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (NackSound != null) {
            stmtUpdateByPKey.setString(argIdx++, NackSound);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (PerpetualSound != null) {
            stmtUpdateByPKey.setString(argIdx++, PerpetualSound);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (PinSound != null) {
            stmtUpdateByPKey.setString(argIdx++, PinSound);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (Pin != null) {
            stmtUpdateByPKey.setString(argIdx++, Pin);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (UnmutedSound != null) {
            stmtUpdateByPKey.setString(argIdx++, UnmutedSound);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtUpdateByPKey.setInt(argIdx++, Rate);
        stmtUpdateByPKey.setString(argIdx++, AutoRecord);
        stmtUpdateByPKey.setInt(argIdx++, ValInterval);
        stmtUpdateByPKey.setInt(argIdx++, EnergyLevel);
        stmtUpdateByPKey.setString(argIdx++, MemberFlags);
        stmtUpdateByPKey.setString(argIdx++, ConferenceFlags);
        stmtUpdateByPKey.setString(argIdx++, CallerControls);
        stmtUpdateByPKey.setString(argIdx++, TTSEngine);
        stmtUpdateByPKey.setString(argIdx++, TTSVoice);
        stmtUpdateByPKey.setInt(argIdx++, MaxMembers);
        stmtUpdateByPKey.setInt(argIdx++, ComfortNoise);
        stmtUpdateByPKey.setInt(argIdx++, AnnounceCount);
        stmtUpdateByPKey.setString(argIdx++, SuppressEvents);
        stmtUpdateByPKey.setString(argIdx++, VerboseEvents);
        if (CallerIdName != null) {
            stmtUpdateByPKey.setString(argIdx++, CallerIdName);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (CallerIdNumber != null) {
            stmtUpdateByPKey.setString(argIdx++, CallerIdNumber);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
        if (resultSet != null) {
            try {
                if (resultSet.next()) {
                    CFFswFSSFConferenceProfileBuff updatedBuff = unpackFSSFConferenceProfileResultSetToBuff(
                            resultSet);
                    if (resultSet.next()) {
                        resultSet.last();
                        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                                "Did not expect multi-record response, " + resultSet.getRow()
                                        + " rows selected");
                    }
                    Buff.setRequiredFSSFConferenceId(updatedBuff.getRequiredFSSFConferenceId());
                    Buff.setRequiredName(updatedBuff.getRequiredName());
                    Buff.setRequiredSoundPrefix(updatedBuff.getRequiredSoundPrefix());
                    Buff.setOptionalAckSound(updatedBuff.getOptionalAckSound());
                    Buff.setOptionalAloneSound(updatedBuff.getOptionalAloneSound());
                    Buff.setOptionalBadPinSound(updatedBuff.getOptionalBadPinSound());
                    Buff.setOptionalEnterSound(updatedBuff.getOptionalEnterSound());
                    Buff.setOptionalExitSound(updatedBuff.getOptionalExitSound());
                    Buff.setOptionalIsLockedSound(updatedBuff.getOptionalIsLockedSound());
                    Buff.setOptionalKickedSound(updatedBuff.getOptionalKickedSound());
                    Buff.setOptionalLockedSound(updatedBuff.getOptionalLockedSound());
                    Buff.setOptionalMaxMembersSound(updatedBuff.getOptionalMaxMembersSound());
                    Buff.setOptionalMOHSound(updatedBuff.getOptionalMOHSound());
                    Buff.setOptionalMuteDetectSound(updatedBuff.getOptionalMuteDetectSound());
                    Buff.setOptionalMutedSound(updatedBuff.getOptionalMutedSound());
                    Buff.setOptionalNackSound(updatedBuff.getOptionalNackSound());
                    Buff.setOptionalPerpetualSound(updatedBuff.getOptionalPerpetualSound());
                    Buff.setOptionalPinSound(updatedBuff.getOptionalPinSound());
                    Buff.setOptionalPin(updatedBuff.getOptionalPin());
                    Buff.setOptionalUnmutedSound(updatedBuff.getOptionalUnmutedSound());
                    Buff.setRequiredRate(updatedBuff.getRequiredRate());
                    Buff.setRequiredAutoRecord(updatedBuff.getRequiredAutoRecord());
                    Buff.setRequiredValInterval(updatedBuff.getRequiredValInterval());
                    Buff.setRequiredEnergyLevel(updatedBuff.getRequiredEnergyLevel());
                    Buff.setRequiredMemberFlags(updatedBuff.getRequiredMemberFlags());
                    Buff.setRequiredConferenceFlags(updatedBuff.getRequiredConferenceFlags());
                    Buff.setRequiredCallerControls(updatedBuff.getRequiredCallerControls());
                    Buff.setRequiredTTSEngine(updatedBuff.getRequiredTTSEngine());
                    Buff.setRequiredTTSVoice(updatedBuff.getRequiredTTSVoice());
                    Buff.setRequiredMaxMembers(updatedBuff.getRequiredMaxMembers());
                    Buff.setRequiredComfortNoise(updatedBuff.getRequiredComfortNoise());
                    Buff.setRequiredAnnounceCount(updatedBuff.getRequiredAnnounceCount());
                    Buff.setRequiredSuppressEvents(updatedBuff.getRequiredSuppressEvents());
                    Buff.setRequiredVerboseEvents(updatedBuff.getRequiredVerboseEvents());
                    Buff.setOptionalCallerIdName(updatedBuff.getOptionalCallerIdName());
                    Buff.setOptionalCallerIdNumber(updatedBuff.getOptionalCallerIdNumber());
                    Buff.setRequiredRevision(updatedBuff.getRequiredRevision());
                } else {
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Expected a single-record response, " + resultSet.getRow() + " rows selected");
                }
            } catch (SQLException e) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "upd_fssfcnfprf() did not return a valid result cursor");
            } finally {
                if (resultSet != null) {
                    try {
                        resultSet.close();
                    } catch (SQLException e) {
                    }
                    resultSet = null;
                }
            }
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "upd_fssfcnfprf() did not return a result cursor");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtUpdateByPKey != null) {
            try {
                stmtUpdateByPKey.close();
            } catch (SQLException e) {
            }
            stmtUpdateByPKey = null;
        }
    }
}

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

public void createFSSFVMail(CFFswAuthorization Authorization, CFFswFSSFVMailBuff Buff) {
    final String S_ProcName = "createFSSFVMail";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from w ww.j  a v  a  2s. c  om*/
    ResultSet resultSet = null;
    CallableStatement stmtCreateByPKey = null;
    try {
        long TenantId = Buff.getRequiredTenantId();
        long FSSFVMailId = Buff.getRequiredFSSFVMailId();
        long FSSofiaId = Buff.getRequiredFSSofiaId();
        String Name = Buff.getRequiredName();
        String TemplateFile = Buff.getRequiredTemplateFile();
        String NotifyTemplateFile = Buff.getRequiredNotifyTemplateFile();
        String DateFmt = Buff.getRequiredDateFmt();
        String EmailFrom = Buff.getRequiredEmailFrom();
        String FileExtension = Buff.getRequiredFileExtension();
        String TerminatorKey = Buff.getRequiredTerminatorKey();
        short MaxLoginAttempts = Buff.getRequiredMaxLoginAttempts();
        int DigitTimeout = Buff.getRequiredDigitTimeout();
        int MinRecordLen = Buff.getRequiredMinRecordLen();
        int MaxRecordLen = Buff.getRequiredMaxRecordLen();
        short MaxRetries = Buff.getRequiredMaxRetries();
        String ToneSpec = Buff.getRequiredToneSpec();
        String CallbackDialplan = Buff.getRequiredCallbackDialplan();
        String CallbackContext = Buff.getOptionalCallbackContext();
        String PlayNewMessagesKey = Buff.getRequiredPlayNewMessagesKey();
        String PlaySavedMessagesKey = Buff.getRequiredPlaySavedMessagesKey();
        String LoginKeys = Buff.getRequiredLoginKeys();
        String MainMenuKey = Buff.getRequiredMainMenuKey();
        String ConfigMenuKey = Buff.getRequiredConfigMenuKey();
        String RecordGreetingKey = Buff.getRequiredRecordGreetingKey();
        String ChooseGreetingKey = Buff.getRequiredChooseGreetingKey();
        String ChangePassKey = Buff.getRequiredChangePassKey();
        String RecordNameKey = Buff.getRequiredRecordNameKey();
        String RecordFileKey = Buff.getRequiredRecordFileKey();
        String ListenFileKey = Buff.getRequiredListenFileKey();
        String SaveFileKey = Buff.getRequiredSaveFileKey();
        String DeleteFileKey = Buff.getRequiredDeleteFileKey();
        String UndeleteFileKey = Buff.getRequiredUndeleteFileKey();
        String EMailKey = Buff.getRequiredEMailKey();
        String PauseKey = Buff.getRequiredPauseKey();
        String RestartKey = Buff.getRequiredRestartKey();
        String FastForwardKey = Buff.getRequiredFastForwardKey();
        String RewindKey = Buff.getRequiredRewindKey();
        String SkipGreetKey = Buff.getRequiredSkipGreetKey();
        int RecordSilenceThreshold = Buff.getRequiredRecordSilenceThreshold();
        short RecordSilenceHits = Buff.getRequiredRecordSilenceHits();
        String WebTemplateFile = Buff.getRequiredWebTemplateFile();
        int RecordSampleRate = Buff.getRequiredRecordSampleRate();
        String OperatorExtension = Buff.getRequiredOperatorExtension();
        String VMainExtension = Buff.getRequiredVMainExtension();
        String VMailKey = Buff.getRequiredVMailKey();
        boolean AutoPlaybackRecordings = Buff.getRequiredAutoPlaybackRecordings();
        String StorageDir = Buff.getRequiredStorageDir();
        String OdbcDSN = Buff.getOptionalOdbcDSN();
        String RecordComent = Buff.getOptionalRecordComent();
        String RecordTitle = Buff.getOptionalRecordTitle();
        String RecordCopyright = Buff.getOptionalRecordCopyright();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".crt_fssfvm( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtCreateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtCreateByPKey.setString(argIdx++, "FSVM");
        stmtCreateByPKey.setLong(argIdx++, TenantId);
        stmtCreateByPKey.setLong(argIdx++, FSSFVMailId);
        stmtCreateByPKey.setLong(argIdx++, FSSofiaId);
        stmtCreateByPKey.setString(argIdx++, Name);
        stmtCreateByPKey.setString(argIdx++, TemplateFile);
        stmtCreateByPKey.setString(argIdx++, NotifyTemplateFile);
        stmtCreateByPKey.setString(argIdx++, DateFmt);
        stmtCreateByPKey.setString(argIdx++, EmailFrom);
        stmtCreateByPKey.setString(argIdx++, FileExtension);
        stmtCreateByPKey.setString(argIdx++, TerminatorKey);
        stmtCreateByPKey.setShort(argIdx++, MaxLoginAttempts);
        stmtCreateByPKey.setInt(argIdx++, DigitTimeout);
        stmtCreateByPKey.setInt(argIdx++, MinRecordLen);
        stmtCreateByPKey.setInt(argIdx++, MaxRecordLen);
        stmtCreateByPKey.setShort(argIdx++, MaxRetries);
        stmtCreateByPKey.setString(argIdx++, ToneSpec);
        stmtCreateByPKey.setString(argIdx++, CallbackDialplan);
        if (CallbackContext != null) {
            stmtCreateByPKey.setString(argIdx++, CallbackContext);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtCreateByPKey.setString(argIdx++, PlayNewMessagesKey);
        stmtCreateByPKey.setString(argIdx++, PlaySavedMessagesKey);
        stmtCreateByPKey.setString(argIdx++, LoginKeys);
        stmtCreateByPKey.setString(argIdx++, MainMenuKey);
        stmtCreateByPKey.setString(argIdx++, ConfigMenuKey);
        stmtCreateByPKey.setString(argIdx++, RecordGreetingKey);
        stmtCreateByPKey.setString(argIdx++, ChooseGreetingKey);
        stmtCreateByPKey.setString(argIdx++, ChangePassKey);
        stmtCreateByPKey.setString(argIdx++, RecordNameKey);
        stmtCreateByPKey.setString(argIdx++, RecordFileKey);
        stmtCreateByPKey.setString(argIdx++, ListenFileKey);
        stmtCreateByPKey.setString(argIdx++, SaveFileKey);
        stmtCreateByPKey.setString(argIdx++, DeleteFileKey);
        stmtCreateByPKey.setString(argIdx++, UndeleteFileKey);
        stmtCreateByPKey.setString(argIdx++, EMailKey);
        stmtCreateByPKey.setString(argIdx++, PauseKey);
        stmtCreateByPKey.setString(argIdx++, RestartKey);
        stmtCreateByPKey.setString(argIdx++, FastForwardKey);
        stmtCreateByPKey.setString(argIdx++, RewindKey);
        stmtCreateByPKey.setString(argIdx++, SkipGreetKey);
        stmtCreateByPKey.setInt(argIdx++, RecordSilenceThreshold);
        stmtCreateByPKey.setShort(argIdx++, RecordSilenceHits);
        stmtCreateByPKey.setString(argIdx++, WebTemplateFile);
        stmtCreateByPKey.setInt(argIdx++, RecordSampleRate);
        stmtCreateByPKey.setString(argIdx++, OperatorExtension);
        stmtCreateByPKey.setString(argIdx++, VMainExtension);
        stmtCreateByPKey.setString(argIdx++, VMailKey);
        if (AutoPlaybackRecordings) {
            stmtCreateByPKey.setString(argIdx++, "Y");
        } else {
            stmtCreateByPKey.setString(argIdx++, "N");
        }
        stmtCreateByPKey.setString(argIdx++, StorageDir);
        if (OdbcDSN != null) {
            stmtCreateByPKey.setString(argIdx++, OdbcDSN);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (RecordComent != null) {
            stmtCreateByPKey.setString(argIdx++, RecordComent);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (RecordTitle != null) {
            stmtCreateByPKey.setString(argIdx++, RecordTitle);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (RecordCopyright != null) {
            stmtCreateByPKey.setString(argIdx++, RecordCopyright);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_fssfvm() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFFswFSSFVMailBuff createdBuff = unpackFSSFVMailResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                Buff.setRequiredTenantId(createdBuff.getRequiredTenantId());
                Buff.setRequiredFSSFVMailId(createdBuff.getRequiredFSSFVMailId());
                Buff.setRequiredFSSofiaId(createdBuff.getRequiredFSSofiaId());
                Buff.setRequiredName(createdBuff.getRequiredName());
                Buff.setRequiredTemplateFile(createdBuff.getRequiredTemplateFile());
                Buff.setRequiredNotifyTemplateFile(createdBuff.getRequiredNotifyTemplateFile());
                Buff.setRequiredDateFmt(createdBuff.getRequiredDateFmt());
                Buff.setRequiredEmailFrom(createdBuff.getRequiredEmailFrom());
                Buff.setRequiredFileExtension(createdBuff.getRequiredFileExtension());
                Buff.setRequiredTerminatorKey(createdBuff.getRequiredTerminatorKey());
                Buff.setRequiredMaxLoginAttempts(createdBuff.getRequiredMaxLoginAttempts());
                Buff.setRequiredDigitTimeout(createdBuff.getRequiredDigitTimeout());
                Buff.setRequiredMinRecordLen(createdBuff.getRequiredMinRecordLen());
                Buff.setRequiredMaxRecordLen(createdBuff.getRequiredMaxRecordLen());
                Buff.setRequiredMaxRetries(createdBuff.getRequiredMaxRetries());
                Buff.setRequiredToneSpec(createdBuff.getRequiredToneSpec());
                Buff.setRequiredCallbackDialplan(createdBuff.getRequiredCallbackDialplan());
                Buff.setOptionalCallbackContext(createdBuff.getOptionalCallbackContext());
                Buff.setRequiredPlayNewMessagesKey(createdBuff.getRequiredPlayNewMessagesKey());
                Buff.setRequiredPlaySavedMessagesKey(createdBuff.getRequiredPlaySavedMessagesKey());
                Buff.setRequiredLoginKeys(createdBuff.getRequiredLoginKeys());
                Buff.setRequiredMainMenuKey(createdBuff.getRequiredMainMenuKey());
                Buff.setRequiredConfigMenuKey(createdBuff.getRequiredConfigMenuKey());
                Buff.setRequiredRecordGreetingKey(createdBuff.getRequiredRecordGreetingKey());
                Buff.setRequiredChooseGreetingKey(createdBuff.getRequiredChooseGreetingKey());
                Buff.setRequiredChangePassKey(createdBuff.getRequiredChangePassKey());
                Buff.setRequiredRecordNameKey(createdBuff.getRequiredRecordNameKey());
                Buff.setRequiredRecordFileKey(createdBuff.getRequiredRecordFileKey());
                Buff.setRequiredListenFileKey(createdBuff.getRequiredListenFileKey());
                Buff.setRequiredSaveFileKey(createdBuff.getRequiredSaveFileKey());
                Buff.setRequiredDeleteFileKey(createdBuff.getRequiredDeleteFileKey());
                Buff.setRequiredUndeleteFileKey(createdBuff.getRequiredUndeleteFileKey());
                Buff.setRequiredEMailKey(createdBuff.getRequiredEMailKey());
                Buff.setRequiredPauseKey(createdBuff.getRequiredPauseKey());
                Buff.setRequiredRestartKey(createdBuff.getRequiredRestartKey());
                Buff.setRequiredFastForwardKey(createdBuff.getRequiredFastForwardKey());
                Buff.setRequiredRewindKey(createdBuff.getRequiredRewindKey());
                Buff.setRequiredSkipGreetKey(createdBuff.getRequiredSkipGreetKey());
                Buff.setRequiredRecordSilenceThreshold(createdBuff.getRequiredRecordSilenceThreshold());
                Buff.setRequiredRecordSilenceHits(createdBuff.getRequiredRecordSilenceHits());
                Buff.setRequiredWebTemplateFile(createdBuff.getRequiredWebTemplateFile());
                Buff.setRequiredRecordSampleRate(createdBuff.getRequiredRecordSampleRate());
                Buff.setRequiredOperatorExtension(createdBuff.getRequiredOperatorExtension());
                Buff.setRequiredVMainExtension(createdBuff.getRequiredVMainExtension());
                Buff.setRequiredVMailKey(createdBuff.getRequiredVMailKey());
                Buff.setRequiredAutoPlaybackRecordings(createdBuff.getRequiredAutoPlaybackRecordings());
                Buff.setRequiredStorageDir(createdBuff.getRequiredStorageDir());
                Buff.setOptionalOdbcDSN(createdBuff.getOptionalOdbcDSN());
                Buff.setOptionalRecordComent(createdBuff.getOptionalRecordComent());
                Buff.setOptionalRecordTitle(createdBuff.getOptionalRecordTitle());
                Buff.setOptionalRecordCopyright(createdBuff.getOptionalRecordCopyright());
                Buff.setRequiredRevision(createdBuff.getRequiredRevision());
                Buff.setCreatedByUserId(createdBuff.getCreatedByUserId());
                Buff.setCreatedAt(createdBuff.getCreatedAt());
                Buff.setUpdatedByUserId(createdBuff.getUpdatedByUserId());
                Buff.setUpdatedAt(createdBuff.getUpdatedAt());
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Expected a single-record response, " + resultSet.getRow() + " rows selected");
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_fssfvm() did not return a valid result set");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtCreateByPKey != null) {
            try {
                stmtCreateByPKey.close();
            } catch (SQLException e) {
            }
            stmtCreateByPKey = null;
        }
    }
}

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

public void updateFSSFVMail(CFFswAuthorization Authorization, CFFswFSSFVMailBuff Buff) {
    final String S_ProcName = "updateFSSFVMail";
    ResultSet resultSet = null;/*w  ww.  ja v a2 s.c  o m*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFFswFSSFVMailBuff> buffList = new LinkedList<CFFswFSSFVMailBuff>();
    try {
        long TenantId = Buff.getRequiredTenantId();
        long FSSFVMailId = Buff.getRequiredFSSFVMailId();
        long FSSofiaId = Buff.getRequiredFSSofiaId();
        String Name = Buff.getRequiredName();
        String TemplateFile = Buff.getRequiredTemplateFile();
        String NotifyTemplateFile = Buff.getRequiredNotifyTemplateFile();
        String DateFmt = Buff.getRequiredDateFmt();
        String EmailFrom = Buff.getRequiredEmailFrom();
        String FileExtension = Buff.getRequiredFileExtension();
        String TerminatorKey = Buff.getRequiredTerminatorKey();
        short MaxLoginAttempts = Buff.getRequiredMaxLoginAttempts();
        int DigitTimeout = Buff.getRequiredDigitTimeout();
        int MinRecordLen = Buff.getRequiredMinRecordLen();
        int MaxRecordLen = Buff.getRequiredMaxRecordLen();
        short MaxRetries = Buff.getRequiredMaxRetries();
        String ToneSpec = Buff.getRequiredToneSpec();
        String CallbackDialplan = Buff.getRequiredCallbackDialplan();
        String CallbackContext = Buff.getOptionalCallbackContext();
        String PlayNewMessagesKey = Buff.getRequiredPlayNewMessagesKey();
        String PlaySavedMessagesKey = Buff.getRequiredPlaySavedMessagesKey();
        String LoginKeys = Buff.getRequiredLoginKeys();
        String MainMenuKey = Buff.getRequiredMainMenuKey();
        String ConfigMenuKey = Buff.getRequiredConfigMenuKey();
        String RecordGreetingKey = Buff.getRequiredRecordGreetingKey();
        String ChooseGreetingKey = Buff.getRequiredChooseGreetingKey();
        String ChangePassKey = Buff.getRequiredChangePassKey();
        String RecordNameKey = Buff.getRequiredRecordNameKey();
        String RecordFileKey = Buff.getRequiredRecordFileKey();
        String ListenFileKey = Buff.getRequiredListenFileKey();
        String SaveFileKey = Buff.getRequiredSaveFileKey();
        String DeleteFileKey = Buff.getRequiredDeleteFileKey();
        String UndeleteFileKey = Buff.getRequiredUndeleteFileKey();
        String EMailKey = Buff.getRequiredEMailKey();
        String PauseKey = Buff.getRequiredPauseKey();
        String RestartKey = Buff.getRequiredRestartKey();
        String FastForwardKey = Buff.getRequiredFastForwardKey();
        String RewindKey = Buff.getRequiredRewindKey();
        String SkipGreetKey = Buff.getRequiredSkipGreetKey();
        int RecordSilenceThreshold = Buff.getRequiredRecordSilenceThreshold();
        short RecordSilenceHits = Buff.getRequiredRecordSilenceHits();
        String WebTemplateFile = Buff.getRequiredWebTemplateFile();
        int RecordSampleRate = Buff.getRequiredRecordSampleRate();
        String OperatorExtension = Buff.getRequiredOperatorExtension();
        String VMainExtension = Buff.getRequiredVMainExtension();
        String VMailKey = Buff.getRequiredVMailKey();
        boolean AutoPlaybackRecordings = Buff.getRequiredAutoPlaybackRecordings();
        String StorageDir = Buff.getRequiredStorageDir();
        String OdbcDSN = Buff.getOptionalOdbcDSN();
        String RecordComent = Buff.getOptionalRecordComent();
        String RecordTitle = Buff.getOptionalRecordTitle();
        String RecordCopyright = Buff.getOptionalRecordCopyright();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".upd_fssfvm( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); end;");
        int argIdx = 1;
        stmtUpdateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtUpdateByPKey.setString(argIdx++, "FSVM");
        stmtUpdateByPKey.setLong(argIdx++, TenantId);
        stmtUpdateByPKey.setLong(argIdx++, FSSFVMailId);
        stmtUpdateByPKey.setLong(argIdx++, FSSofiaId);
        stmtUpdateByPKey.setString(argIdx++, Name);
        stmtUpdateByPKey.setString(argIdx++, TemplateFile);
        stmtUpdateByPKey.setString(argIdx++, NotifyTemplateFile);
        stmtUpdateByPKey.setString(argIdx++, DateFmt);
        stmtUpdateByPKey.setString(argIdx++, EmailFrom);
        stmtUpdateByPKey.setString(argIdx++, FileExtension);
        stmtUpdateByPKey.setString(argIdx++, TerminatorKey);
        stmtUpdateByPKey.setShort(argIdx++, MaxLoginAttempts);
        stmtUpdateByPKey.setInt(argIdx++, DigitTimeout);
        stmtUpdateByPKey.setInt(argIdx++, MinRecordLen);
        stmtUpdateByPKey.setInt(argIdx++, MaxRecordLen);
        stmtUpdateByPKey.setShort(argIdx++, MaxRetries);
        stmtUpdateByPKey.setString(argIdx++, ToneSpec);
        stmtUpdateByPKey.setString(argIdx++, CallbackDialplan);
        if (CallbackContext != null) {
            stmtUpdateByPKey.setString(argIdx++, CallbackContext);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtUpdateByPKey.setString(argIdx++, PlayNewMessagesKey);
        stmtUpdateByPKey.setString(argIdx++, PlaySavedMessagesKey);
        stmtUpdateByPKey.setString(argIdx++, LoginKeys);
        stmtUpdateByPKey.setString(argIdx++, MainMenuKey);
        stmtUpdateByPKey.setString(argIdx++, ConfigMenuKey);
        stmtUpdateByPKey.setString(argIdx++, RecordGreetingKey);
        stmtUpdateByPKey.setString(argIdx++, ChooseGreetingKey);
        stmtUpdateByPKey.setString(argIdx++, ChangePassKey);
        stmtUpdateByPKey.setString(argIdx++, RecordNameKey);
        stmtUpdateByPKey.setString(argIdx++, RecordFileKey);
        stmtUpdateByPKey.setString(argIdx++, ListenFileKey);
        stmtUpdateByPKey.setString(argIdx++, SaveFileKey);
        stmtUpdateByPKey.setString(argIdx++, DeleteFileKey);
        stmtUpdateByPKey.setString(argIdx++, UndeleteFileKey);
        stmtUpdateByPKey.setString(argIdx++, EMailKey);
        stmtUpdateByPKey.setString(argIdx++, PauseKey);
        stmtUpdateByPKey.setString(argIdx++, RestartKey);
        stmtUpdateByPKey.setString(argIdx++, FastForwardKey);
        stmtUpdateByPKey.setString(argIdx++, RewindKey);
        stmtUpdateByPKey.setString(argIdx++, SkipGreetKey);
        stmtUpdateByPKey.setInt(argIdx++, RecordSilenceThreshold);
        stmtUpdateByPKey.setShort(argIdx++, RecordSilenceHits);
        stmtUpdateByPKey.setString(argIdx++, WebTemplateFile);
        stmtUpdateByPKey.setInt(argIdx++, RecordSampleRate);
        stmtUpdateByPKey.setString(argIdx++, OperatorExtension);
        stmtUpdateByPKey.setString(argIdx++, VMainExtension);
        stmtUpdateByPKey.setString(argIdx++, VMailKey);
        if (AutoPlaybackRecordings) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        stmtUpdateByPKey.setString(argIdx++, StorageDir);
        if (OdbcDSN != null) {
            stmtUpdateByPKey.setString(argIdx++, OdbcDSN);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (RecordComent != null) {
            stmtUpdateByPKey.setString(argIdx++, RecordComent);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (RecordTitle != null) {
            stmtUpdateByPKey.setString(argIdx++, RecordTitle);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (RecordCopyright != null) {
            stmtUpdateByPKey.setString(argIdx++, RecordCopyright);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
        if (resultSet != null) {
            try {
                if (resultSet.next()) {
                    CFFswFSSFVMailBuff updatedBuff = unpackFSSFVMailResultSetToBuff(resultSet);
                    if (resultSet.next()) {
                        resultSet.last();
                        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                                "Did not expect multi-record response, " + resultSet.getRow()
                                        + " rows selected");
                    }
                    Buff.setRequiredFSSofiaId(updatedBuff.getRequiredFSSofiaId());
                    Buff.setRequiredName(updatedBuff.getRequiredName());
                    Buff.setRequiredTemplateFile(updatedBuff.getRequiredTemplateFile());
                    Buff.setRequiredNotifyTemplateFile(updatedBuff.getRequiredNotifyTemplateFile());
                    Buff.setRequiredDateFmt(updatedBuff.getRequiredDateFmt());
                    Buff.setRequiredEmailFrom(updatedBuff.getRequiredEmailFrom());
                    Buff.setRequiredFileExtension(updatedBuff.getRequiredFileExtension());
                    Buff.setRequiredTerminatorKey(updatedBuff.getRequiredTerminatorKey());
                    Buff.setRequiredMaxLoginAttempts(updatedBuff.getRequiredMaxLoginAttempts());
                    Buff.setRequiredDigitTimeout(updatedBuff.getRequiredDigitTimeout());
                    Buff.setRequiredMinRecordLen(updatedBuff.getRequiredMinRecordLen());
                    Buff.setRequiredMaxRecordLen(updatedBuff.getRequiredMaxRecordLen());
                    Buff.setRequiredMaxRetries(updatedBuff.getRequiredMaxRetries());
                    Buff.setRequiredToneSpec(updatedBuff.getRequiredToneSpec());
                    Buff.setRequiredCallbackDialplan(updatedBuff.getRequiredCallbackDialplan());
                    Buff.setOptionalCallbackContext(updatedBuff.getOptionalCallbackContext());
                    Buff.setRequiredPlayNewMessagesKey(updatedBuff.getRequiredPlayNewMessagesKey());
                    Buff.setRequiredPlaySavedMessagesKey(updatedBuff.getRequiredPlaySavedMessagesKey());
                    Buff.setRequiredLoginKeys(updatedBuff.getRequiredLoginKeys());
                    Buff.setRequiredMainMenuKey(updatedBuff.getRequiredMainMenuKey());
                    Buff.setRequiredConfigMenuKey(updatedBuff.getRequiredConfigMenuKey());
                    Buff.setRequiredRecordGreetingKey(updatedBuff.getRequiredRecordGreetingKey());
                    Buff.setRequiredChooseGreetingKey(updatedBuff.getRequiredChooseGreetingKey());
                    Buff.setRequiredChangePassKey(updatedBuff.getRequiredChangePassKey());
                    Buff.setRequiredRecordNameKey(updatedBuff.getRequiredRecordNameKey());
                    Buff.setRequiredRecordFileKey(updatedBuff.getRequiredRecordFileKey());
                    Buff.setRequiredListenFileKey(updatedBuff.getRequiredListenFileKey());
                    Buff.setRequiredSaveFileKey(updatedBuff.getRequiredSaveFileKey());
                    Buff.setRequiredDeleteFileKey(updatedBuff.getRequiredDeleteFileKey());
                    Buff.setRequiredUndeleteFileKey(updatedBuff.getRequiredUndeleteFileKey());
                    Buff.setRequiredEMailKey(updatedBuff.getRequiredEMailKey());
                    Buff.setRequiredPauseKey(updatedBuff.getRequiredPauseKey());
                    Buff.setRequiredRestartKey(updatedBuff.getRequiredRestartKey());
                    Buff.setRequiredFastForwardKey(updatedBuff.getRequiredFastForwardKey());
                    Buff.setRequiredRewindKey(updatedBuff.getRequiredRewindKey());
                    Buff.setRequiredSkipGreetKey(updatedBuff.getRequiredSkipGreetKey());
                    Buff.setRequiredRecordSilenceThreshold(updatedBuff.getRequiredRecordSilenceThreshold());
                    Buff.setRequiredRecordSilenceHits(updatedBuff.getRequiredRecordSilenceHits());
                    Buff.setRequiredWebTemplateFile(updatedBuff.getRequiredWebTemplateFile());
                    Buff.setRequiredRecordSampleRate(updatedBuff.getRequiredRecordSampleRate());
                    Buff.setRequiredOperatorExtension(updatedBuff.getRequiredOperatorExtension());
                    Buff.setRequiredVMainExtension(updatedBuff.getRequiredVMainExtension());
                    Buff.setRequiredVMailKey(updatedBuff.getRequiredVMailKey());
                    Buff.setRequiredAutoPlaybackRecordings(updatedBuff.getRequiredAutoPlaybackRecordings());
                    Buff.setRequiredStorageDir(updatedBuff.getRequiredStorageDir());
                    Buff.setOptionalOdbcDSN(updatedBuff.getOptionalOdbcDSN());
                    Buff.setOptionalRecordComent(updatedBuff.getOptionalRecordComent());
                    Buff.setOptionalRecordTitle(updatedBuff.getOptionalRecordTitle());
                    Buff.setOptionalRecordCopyright(updatedBuff.getOptionalRecordCopyright());
                    Buff.setRequiredRevision(updatedBuff.getRequiredRevision());
                } else {
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Expected a single-record response, " + resultSet.getRow() + " rows selected");
                }
            } catch (SQLException e) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "upd_fssfvm() did not return a valid result cursor");
            } finally {
                if (resultSet != null) {
                    try {
                        resultSet.close();
                    } catch (SQLException e) {
                    }
                    resultSet = null;
                }
            }
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "upd_fssfvm() did not return a result cursor");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtUpdateByPKey != null) {
            try {
                stmtUpdateByPKey.close();
            } catch (SQLException e) {
            }
            stmtUpdateByPKey = null;
        }
    }
}

From source file:com.ibm.ioes.dao.ReportsDao_Usage.java

public ArrayList<NewOrderDto> viewContactList(NewOrderDto objDto) throws Exception {
    //Nagarjuna//ww w  . java 2s .c  o  m
    String methodName = "viewContactList", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end Nagarjuna
    ArrayList<NewOrderDto> objUserList = new ArrayList<NewOrderDto>();
    Connection conn = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    int recordCount = 0;

    try {
        String userName = "";

        conn = DbConnection.getReportsConnectionObject();

        proc = conn.prepareCall(sqlContactList);
        if (objDto.getAccountID() != 0) {
            proc.setLong(1, (objDto.getAccountID()));
        } else {
            proc.setNull(1, java.sql.Types.BIGINT);
        }
        if (objDto.getContactType() != null && !"".equals(objDto.getContactType())) {
            proc.setString(2, (objDto.getContactType()));
        } else {
            proc.setNull(2, java.sql.Types.VARCHAR);
        }

        if (objDto.getContactName() != null && !"".equals(objDto.getContactName())) {
            proc.setString(3, objDto.getContactName().trim());
        } else {
            proc.setNull(3, java.sql.Types.VARCHAR);
        }
        if (objDto.getAccountName() != null && !"".equals(objDto.getAccountName())) {
            proc.setString(4, objDto.getAccountName().trim());
        } else {
            proc.setNull(4, java.sql.Types.VARCHAR);
        }
        if (objDto.getOrderNumber() != 0) {
            proc.setLong(5, (objDto.getOrderNumber()));
        } else {
            proc.setNull(5, java.sql.Types.BIGINT);
        }
        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index

        proc.setString(6, pagingSorting.getSortByColumn());// columnName
        proc.setString(7, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(8, pagingSorting.getStartRecordId());// start index
        proc.setInt(9, pagingSorting.getEndRecordId());// end index
        proc.setInt(10, (pagingSorting.isPagingToBeDone() ? 1 : 0));// end
        // index

        rs = proc.executeQuery();
        int countFlag = 0;
        while (rs.next() != false) {
            countFlag++;

            userName = (rs.getString("FIRSTNAME")) + " " + (rs.getString("LASTNAME"));
            objDto = new NewOrderDto();
            objDto.setContactName(userName);
            objDto.setAccountID(rs.getInt("ACCOUNTID"));
            objDto.setOrderNumber(rs.getInt("ORDERNO"));
            objDto.setContactId(rs.getLong("CONTACTID"));
            objDto.setContactType(rs.getString("CONTACTTYPE"));
            objDto.setSaluation(rs.getString("SALUATION"));
            objDto.setCntEmail(rs.getString("EMAIL"));
            objDto.setContactCell(rs.getString("CELLNO"));
            objDto.setContactFax(rs.getString("FAXNO"));
            objDto.setAddress1(rs.getString("ADDRESS1"));
            objDto.setAddress2(rs.getString("ADDRESS2"));
            objDto.setAddress3(rs.getString("ADDRESS3"));
            objDto.setCityName(rs.getString("CITY"));
            objDto.setStateName(rs.getString("STATE"));
            objDto.setCountyName(rs.getString("COUNTRY"));
            objDto.setPinNo(rs.getString("PINCODE"));
            objDto.setAccountName(rs.getString("ACCOUNTNAME"));

            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }
            objUserList.add(objDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);
        //ex.printStackTrace();
        throw new Exception("SQL Exception : " + ex.getMessage(), ex);
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(proc);
            DbConnection.freeConnection(conn);

        } catch (Exception e) {
            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);
            //e.printStackTrace();
            throw new Exception("Exception : " + e.getMessage(), e);
        }
    }

    return objUserList;
}

From source file:com.ibm.ioes.dao.ReportsDao_Usage.java

public ArrayList<DispatchAddressDto> viewDispatchAddressList(DispatchAddressDto objDto) throws Exception {
    //Nagarjuna//from  ww w .j  a v a 2s . c  o  m
    String methodName = "viewDispatchAddressList", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end Nagarjuna
    ArrayList<DispatchAddressDto> objUserList = new ArrayList<DispatchAddressDto>();
    Connection conn = null;
    CallableStatement proc = null;
    ResultSet rs = null;

    try {
        conn = DbConnection.getReportsConnectionObject();
        proc = conn.prepareCall(sqlDispatchList);

        if (objDto.getDispatchAddressId() != null && !"".equals(objDto.getDispatchAddressId())) {
            proc.setLong(2, Long.parseLong(objDto.getDispatchAddressId()));
        } else {
            proc.setNull(2, java.sql.Types.BIGINT);
        }
        if (objDto.getAccountID() != null && !"".equals(objDto.getAccountID())) {
            proc.setLong(1, Long.parseLong(objDto.getAccountID()));
        } else {
            proc.setNull(1, java.sql.Types.BIGINT);

        }

        if (objDto.getDispatchAddressName() != null && !"".equals(objDto.getDispatchAddressName())) {
            proc.setString(3, objDto.getDispatchAddressName().trim());
        } else {
            proc.setNull(3, java.sql.Types.VARCHAR);
        }

        if (objDto.getAccountName() != null || !objDto.getAccountName().trim().equals("")) {
            proc.setString(4, objDto.getAccountName());
        } else {
            proc.setNull(4, java.sql.Types.VARCHAR);
        }

        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index

        proc.setString(5, pagingSorting.getSortByColumn());// columnName
        proc.setString(6, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(7, pagingSorting.getStartRecordId());// start index
        proc.setInt(8, pagingSorting.getEndRecordId());// end index
        proc.setInt(9, (pagingSorting.isPagingToBeDone() ? 1 : 0));// end
        // index

        rs = proc.executeQuery();
        int countFlag = 0;
        int recordCount = 0;

        while (rs.next() != false) {
            countFlag++;

            String userName = (rs.getString("FNAME")) + " " + (rs.getString("LNAME"));
            objDto = new DispatchAddressDto();
            objDto.setCustomerName(userName);
            objDto.setAccountID(String.valueOf(rs.getInt("ACCOUNTID")));
            objDto.setAccountName(rs.getString("ACCOUNTNAME"));
            objDto.setDispatchAddressId(String.valueOf(rs.getInt("DISPATCH_ADDRESS_CODE")));
            objDto.setDispatchAddressName(rs.getString("DISPATCHADDNAME"));
            objDto.setTelephonePhno(rs.getString("TELEPHONENO"));
            objDto.setEmail_Id(rs.getString("EMAIL_ID"));
            objDto.setAddress1(rs.getString("ADDRESS1"));
            objDto.setAddress2(rs.getString("ADDRESS2"));
            objDto.setAddress3(rs.getString("ADDRESS3"));
            objDto.setAddress4(rs.getString("ADDRESS4"));

            objDto.setFax(rs.getString("FAX"));
            objDto.setPin(rs.getString("PIN"));
            objDto.setTitle(rs.getString("TITLE"));
            objDto.setPostalCode(rs.getString("POSTAL_CODE"));
            objDto.setCountryName(rs.getString("COUNTRY_NAME"));
            objDto.setStateName(rs.getString("STATE_NAME"));
            objDto.setCityName(rs.getString("CITY_NAME"));

            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }
            objUserList.add(objDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);
        //ex.printStackTrace();
        throw new Exception("SQL Exception : " + ex.getMessage(), ex);
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(proc);
            DbConnection.freeConnection(conn);

        } catch (Exception e) {
            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);
            //e.printStackTrace();
            throw new Exception("Exception : " + e.getMessage(), e);
        }
    }

    return objUserList;
}

From source file:com.ibm.ioes.dao.ReportsDao_Usage.java

public ArrayList<LocationDetailDto> viewCustomerLocationList(LocationDetailDto objDto) throws Exception {
    //Nagarjuna/*from  www  .  j  av  a  2  s.  co m*/
    String methodName = "viewCustomerLocationList", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end Nagarjuna
    ArrayList<LocationDetailDto> objUserList = new ArrayList<LocationDetailDto>();
    Connection conn = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    int recordCount = 0;

    try {
        String userName = "";

        conn = DbConnection.getReportsConnectionObject();

        proc = conn.prepareCall(sqlGetCustomerLocReport);
        if (objDto.getLocationId() != null && !"".equals(objDto.getLocationId())) {
            proc.setLong(2, Long.parseLong(objDto.getLocationId()));
        } else {
            proc.setNull(2, java.sql.Types.BIGINT);
        }
        if (objDto.getAccountID() != null && !"".equals(objDto.getAccountID())) {
            proc.setLong(1, Long.parseLong(objDto.getAccountID()));
        } else {
            proc.setNull(1, java.sql.Types.BIGINT);
        }
        if (objDto.getLocationName() != null && !"".equals(objDto.getLocationName())) {
            proc.setString(3, objDto.getLocationName().trim());
        } else {
            proc.setNull(3, java.sql.Types.VARCHAR);
        }
        if (objDto.getAccountName() != null && !"".equals(objDto.getAccountName())) {
            proc.setString(4, objDto.getAccountName().trim());
        } else {
            proc.setNull(4, java.sql.Types.VARCHAR);
        }
        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index

        proc.setString(5, pagingSorting.getSortByColumn());// columnName
        proc.setString(6, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(7, pagingSorting.getStartRecordId());// start index
        proc.setInt(8, pagingSorting.getEndRecordId());// end index
        proc.setInt(9, (pagingSorting.isPagingToBeDone() ? 1 : 0));// end
        // index

        rs = proc.executeQuery();
        int countFlag = 0;
        while (rs.next() != false) {
            countFlag++;

            userName = (rs.getString("FNAME")) + " " + (rs.getString("LNAME"));
            objDto = new LocationDetailDto();
            objDto.setCustomerName(userName);
            objDto.setAccountID(String.valueOf(rs.getInt("ACCOUNTID")));
            objDto.setLocationId(String.valueOf(rs.getInt("LOCATION_CODE")));
            objDto.setLocationName(rs.getString("LOCATION_NAME"));
            objDto.setTelephonePhno(rs.getString("TELEPHONENO"));
            objDto.setEmail_Id(rs.getString("EMAIL_ID"));
            objDto.setAddress1(rs.getString("ADDRESS1"));
            objDto.setAddress2(rs.getString("ADDRESS2"));
            objDto.setAddress3(rs.getString("ADDRESS3"));
            objDto.setAddress4(rs.getString("ADDRESS4"));
            objDto.setFax(rs.getString("FAX"));
            objDto.setPin(rs.getString("PIN"));
            objDto.setTitle(rs.getString("TITLE"));
            objDto.setCountryName(rs.getString("COUNTRY_NAME"));
            objDto.setPostalCode(rs.getString("POSTAL_CODE"));
            objDto.setStateName(rs.getString("STATE_NAME"));
            objDto.setCityName(rs.getString("CITY_NAME"));
            objDto.setAccountName(rs.getString("ACCOUNTNAME"));

            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }
            objUserList.add(objDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);
        //ex.printStackTrace();
        throw new Exception("SQL Exception : " + ex.getMessage(), ex);
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(proc);
            DbConnection.freeConnection(conn);

        } catch (Exception e) {
            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);
            //e.printStackTrace();
            throw new Exception("Exception : " + e.getMessage(), e);
        }
    }

    return objUserList;
}

From source file:com.ibm.ioes.dao.ReportsDao_Usage.java

public ArrayList<NewOrderDto> viewOrderStatusList(NewOrderDto objDto) throws Exception {
    //Nagarjuna//from   ww w  .  j a  v  a  2 s . c om
    String methodName = "viewOrderStatusList", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end Nagarjuna
    ArrayList<NewOrderDto> objUserList = new ArrayList<NewOrderDto>();
    Connection conn = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    int recordCount = 0;
    Utility utility = new Utility();
    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    try {

        conn = DbConnection.getReportsConnectionObject();

        proc = conn.prepareCall(sqlOrderList);
        if (objDto.getAccountID() != 0) {
            proc.setLong(1, (objDto.getAccountID()));
        } else {
            proc.setNull(1, java.sql.Types.BIGINT);
        }
        if (objDto.getAccountName() != null && !"".equals(objDto.getAccountName())) {
            proc.setString(2, objDto.getAccountName().trim());
        } else {
            proc.setNull(2, java.sql.Types.VARCHAR);
        }
        if (objDto.getOrderType() != null && !"".equals(objDto.getOrderType())) {
            proc.setString(3, objDto.getOrderType().trim());
        } else {
            proc.setNull(3, java.sql.Types.VARCHAR);
        }

        if (objDto.getOrderNumber() != 0) {
            proc.setLong(4, objDto.getOrderNumber());
        } else {
            proc.setNull(4, java.sql.Types.BIGINT);
        }
        if (objDto.getFromDate() != null && !"".equals(objDto.getFromDate())) {
            proc.setString(5, objDto.getFromDate().trim());
        } else {
            proc.setNull(5, java.sql.Types.VARCHAR);
        }
        if (objDto.getToDate() != null && !"".equals(objDto.getToDate())) {
            proc.setString(6, objDto.getToDate().trim());
        } else {
            proc.setNull(6, java.sql.Types.VARCHAR);
        }

        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index

        proc.setString(7, pagingSorting.getSortByColumn());// columnName
        proc.setString(8, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(9, pagingSorting.getStartRecordId());// start index
        proc.setInt(10, pagingSorting.getEndRecordId());// end index
        proc.setInt(11, (pagingSorting.isPagingToBeDone() ? 1 : 0));// end
        // index

        rs = proc.executeQuery();
        int countFlag = 0;
        while (rs.next() != false) {
            countFlag++;

            objDto = new NewOrderDto();
            objDto.setAccountID(rs.getInt("ACCOUNTID"));
            objDto.setAccountName(rs.getString("ACCOUNTNAME"));
            objDto.setOrderNumber(rs.getInt("ORDERNO"));
            objDto.setOrderType(rs.getString("ORDERTYPE"));
            objDto.setOrderDate(rs.getString("ORDERDATE"));
            if (rs.getString("ORDERDATE") != null && !"".equals(rs.getString("ORDERDATE"))) {

                Date date = df.parse(objDto.getOrderDate());
                objDto.setOrderDate((utility.showDate_Report(date)).toUpperCase());

            }
            objDto.setSourceName(rs.getString("SOURCE"));
            objDto.setQuoteNo(rs.getString("QUOTENO"));
            objDto.setCurrencyName(rs.getString("CURNAME"));
            // objDto.setStatus(new
            // Integer(rs.getString("STATUS")).intValue());
            objDto.setStageName(rs.getString("STAGE"));

            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }
            objUserList.add(objDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);
        //ex.printStackTrace();
        throw new Exception("SQL Exception : " + ex.getMessage(), ex);
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(proc);
            DbConnection.freeConnection(conn);

        } catch (Exception e) {
            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);
            //e.printStackTrace();
            throw new Exception("Exception : " + e.getMessage(), e);
        }
    }

    return objUserList;
}

From source file:com.ibm.ioes.dao.ReportsDao_Usage.java

public ArrayList<NetworkLocationDto> viewNetworkLocsList(NetworkLocationDto objDto) throws Exception {
    //Nagarjuna/*  w w  w .j  ava 2 s  . c o  m*/
    String methodName = "viewNetworkLocsList", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end Nagarjuna
    ArrayList<NetworkLocationDto> objUserList = new ArrayList<NetworkLocationDto>();
    Connection conn = null;
    ResultSet rs = null;
    CallableStatement getNetworkLocs = null;

    try {
        String userName = "";
        conn = DbConnection.getReportsConnectionObject();
        getNetworkLocs = conn.prepareCall(sqlGetNetworkLocReport);
        String networkLocationIdStr = objDto.getSearchNetworkLocationIdStr();
        String contactNameStr = objDto.getSearchContactNameStr();

        if (networkLocationIdStr == null || networkLocationIdStr.trim().equals("")) {
            getNetworkLocs.setNull(1, java.sql.Types.BIGINT);
        } else {
            getNetworkLocs.setLong(1, Long.parseLong(networkLocationIdStr));
        }

        if (contactNameStr == null || contactNameStr.trim().equals("")) {
            getNetworkLocs.setNull(2, java.sql.Types.VARCHAR);
        } else {
            getNetworkLocs.setString(2, contactNameStr);
        }

        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index

        getNetworkLocs.setString(3, pagingSorting.getSortByColumn());// columnName
        getNetworkLocs.setString(4, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        getNetworkLocs.setInt(5, pagingSorting.getStartRecordId());// start
        // index
        getNetworkLocs.setInt(6, pagingSorting.getEndRecordId());// end
        // index
        getNetworkLocs.setInt(7, (pagingSorting.isPagingToBeDone() ? 1 : 0));// end
        // index

        rs = getNetworkLocs.executeQuery();

        int countFlag = 0;
        int recordCount = 0;
        while (rs.next() != false) {
            countFlag++;

            userName = (rs.getString("FNAME")) + " " + (rs.getString("LNAME"));
            objDto = new NetworkLocationDto();
            objDto.setCustomerName(userName);
            objDto.setNetworkLocationId("" + rs.getInt("LOCATION_CODE"));
            objDto.setFirstname(rs.getString("FNAME"));
            objDto.setLastName(rs.getString("LNAME"));
            objDto.setTelephonePhno(rs.getString("TELEPHONENO"));
            objDto.setEmail_Id(rs.getString("EMAIL_ID"));
            objDto.setAddress1(rs.getString("ADDRESS1"));
            objDto.setAddress2(rs.getString("ADDRESS2"));
            objDto.setAddress3(rs.getString("ADDRESS3"));
            objDto.setAddress4(rs.getString("ADDRESS4"));
            objDto.setFax(rs.getString("FAX"));
            // objDto.setPin(rs.getString("PIN"));
            objDto.setTitle(rs.getString("TITLE"));
            objDto.setPostalCode(rs.getString("POSTAL_CODE"));
            objDto.setCityName(rs.getString("CITY_NAME"));
            objDto.setStateName(rs.getString("STATE_NAME"));
            objDto.setCountryName(rs.getString("COUNTRY_NAME"));

            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }

            objUserList.add(objDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);
        //ex.printStackTrace();
        throw new Exception("SQL Exception : " + ex.getMessage(), ex);
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(getNetworkLocs);
            DbConnection.freeConnection(conn);

        } catch (Exception e) {
            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);
            //e.printStackTrace();
            throw new Exception("Exception : " + e.getMessage(), e);
        }
    }
    return objUserList;
}

From source file:com.ibm.ioes.dao.ReportsDao_Usage.java

public ArrayList<ReportsDto> viewM6OrderCancelReport(ReportsDto objDto) throws Exception {
    //   Nagarjuna
    String methodName = "viewM6OrderCancelReport", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end Nagarjuna
    ArrayList<ReportsDto> objUserList = new ArrayList<ReportsDto>();
    Connection conn = null;// w  w  w  . jav a 2  s  .  c  om
    CallableStatement proc = null;
    ResultSet rs = null;
    int recordCount = 0;
    Utility utility = new Utility();

    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    try {

        conn = DbConnection.getReportsConnectionObject();

        proc = conn.prepareCall(sqlM6OrderCancelReport);
        if (objDto.getCanceldate() != null && !"".equals(objDto.getCanceldate())) {
            proc.setString(1, objDto.getCanceldate().trim());
        } else {
            proc.setNull(1, java.sql.Types.VARCHAR);
        }

        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index

        proc.setString(2, pagingSorting.getSortByColumn());// columnName
        proc.setString(3, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(4, pagingSorting.getStartRecordId());// start index
        proc.setInt(5, pagingSorting.getEndRecordId());// end index
        proc.setInt(6, (pagingSorting.isPagingToBeDone() ? 1 : 0));// end
        // index
        rs = proc.executeQuery();
        int countFlag = 0;
        while (rs.next() != false) {
            countFlag++;

            objDto = new ReportsDto();
            objDto.setOrderNumber(rs.getInt("ORDERNO"));
            objDto.setServiceId(rs.getInt("SERVICEID"));
            objDto.setOrderType(rs.getString("ORDERTYPE"));
            objDto.setServiceType(rs.getString("SERVICETYPE"));
            objDto.setCreatedDate(rs.getString("CREATEDDATE"));
            if (rs.getString("CREATEDDATE") != null && !"".equals(rs.getString("CREATEDDATE"))) {
                objDto.setCreatedDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("CREATEDDATE").getTime())))
                                .toUpperCase());
            }
            objDto.setEffDate(rs.getString("EFFSTARTDATE"));
            if (rs.getString("EFFSTARTDATE") != null && !"".equals(rs.getString("EFFSTARTDATE"))) {
                Date date = df.parse(objDto.getEffDate());
                objDto.setEffDate((utility.showDate_Report(date)).toUpperCase());
            }
            objDto.setRfs_date(rs.getString("RFS_DATE"));
            if (rs.getString("RFS_DATE") != null && !"".equals(rs.getString("RFS_DATE"))) {
                Date date = df.parse(objDto.getRfs_date());
                objDto.setRfs_date((utility.showDate_Report(date)).toUpperCase());
            }
            objDto.setProductName(rs.getString("PRODUCTNAME"));
            objDto.setSubProductName(rs.getString("SUBPRODUCTNAME"));
            objDto.setServiceStage(rs.getString("SERVICESTAGE"));
            objDto.setCrmAccountId(rs.getInt("CRMACCOUNTNO"));
            objDto.setLogicalSINo(rs.getString("LOGICAL_SI_NO"));
            objDto.setCancelServiceReason(rs.getString("CANCEL_SERVICE_REASON"));
            objDto.setOrdertype_demo(rs.getString("order_type_DEMO"));
            objDto.setBisource(rs.getString("BISOURCE"));
            objDto.setCanceldate(rs.getString("CANCEL_DATE"));
            if (rs.getString("CANCEL_DATE") != null && !"".equals(rs.getString("CANCEL_DATE"))) {
                objDto.setCanceldate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("CANCEL_DATE").getTime())))
                                .toUpperCase());
            }

            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");

            }
            objUserList.add(objDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);//nagarjuna
        //ex.printStackTrace();
        throw new Exception("SQL Exception : " + ex.getMessage(), ex);
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(proc);
            DbConnection.freeConnection(conn);

        } catch (Exception e) {
            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);//nagarjuna
            //e.printStackTrace();
            throw new Exception("Exception : " + e.getMessage(), e);
        }
    }
    return objUserList;
}

From source file:com.ibm.ioes.dao.ReportsDao_Usage.java

public ArrayList<M6OrderStatusDto> viewM6OrderList(M6OrderStatusDto objDto) throws Exception {
    //Nagarjuna//www  . j a v  a2s .c o m
    String methodName = "viewM6OrderList", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end Nagarjuna
    ArrayList<M6OrderStatusDto> objUserList = new ArrayList<M6OrderStatusDto>();
    Connection conn = null;
    ResultSet rs = null;
    CallableStatement getOrder = null;

    try {
        conn = DbConnection.getReportsConnectionObject();
        getOrder = conn.prepareCall(sqlGetM6OrderStatusReport);
        String accountIdStr = objDto.getSearchAccountIdStr();
        String orderNoStr = objDto.getSearchOrderNoStr();
        //   String m6OrderNoStr = objDto.getSearchM6OrderNoStr();
        String accountNameStr = objDto.getSearchAccountNameStr();

        if (accountIdStr == null || accountIdStr.trim().equals("")) {
            getOrder.setNull(1, java.sql.Types.BIGINT);
        } else {
            getOrder.setLong(1, Long.parseLong(accountIdStr));
        }

        if (orderNoStr == null || orderNoStr.trim().equals("")) {
            getOrder.setNull(2, java.sql.Types.BIGINT);
        } else {
            getOrder.setLong(2, Long.parseLong(orderNoStr));
        }

        if (accountNameStr == null || accountNameStr.trim().equals("")) {
            getOrder.setNull(3, java.sql.Types.VARCHAR);
        } else {
            getOrder.setString(3, accountNameStr);
        }

        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index

        getOrder.setString(4, pagingSorting.getSortByColumn());// columnName
        getOrder.setString(5, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        getOrder.setInt(6, pagingSorting.getStartRecordId());// start index
        getOrder.setInt(7, pagingSorting.getEndRecordId());// end index
        getOrder.setInt(8, (pagingSorting.isPagingToBeDone() ? 1 : 0));// end
        // index

        rs = getOrder.executeQuery();

        int countFlag = 0;
        int recordCount = 0;
        while (rs.next() != false) {
            countFlag++;

            objDto = new M6OrderStatusDto();
            objDto.setAccountID("" + rs.getInt("ACCOUNTID"));
            objDto.setAccountName(rs.getString("ACCOUNTNAME"));
            objDto.setOrderNo("" + rs.getInt("OrderNO"));
            objDto.setM6OrderNo("" + rs.getInt("M6OrderNO"));

            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }

            objUserList.add(objDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);
        //ex.printStackTrace();
        throw new Exception("SQL Exception : " + ex.getMessage(), ex);
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(getOrder);
            DbConnection.freeConnection(conn);

        } catch (Exception e) {
            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);
            //e.printStackTrace();
            throw new Exception("Exception : " + e.getMessage(), e);
        }
    }
    return objUserList;
}