Example usage for java.sql ResultSet getShort

List of usage examples for java.sql ResultSet getShort

Introduction

In this page you can find the example usage for java.sql ResultSet getShort.

Prototype

short getShort(String columnLabel) throws SQLException;

Source Link

Document

Retrieves the value of the designated column in the current row of this ResultSet object as a short in the Java programming language.

Usage

From source file:massbank.DatabaseManager.java

public Record getAccessionData(String accessionId, String contributor) {
    Record acc = new Record(contributor);
    try {/*  w w  w .  j ava  2  s.com*/
        this.statementRECORD.setString(1, accessionId);
        ResultSet set = this.statementRECORD.executeQuery();
        int compoundID = -1;
        int sampleID = -1;
        int instrumentID = -1;
        if (set.next()) {
            acc.ACCESSION(set.getString("ACCESSION"));
            acc.RECORD_TITLE(set.getString("RECORD_TITLE"));
            acc.DATE(set.getDate("DATE").toLocalDate());
            acc.AUTHORS(set.getString("AUTHORS"));
            acc.LICENSE(set.getString("LICENSE"));
            acc.COPYRIGHT(set.getString("COPYRIGHT"));
            acc.PUBLICATION(set.getString("PUBLICATION"));
            compoundID = set.getInt("CH");
            sampleID = set.getInt("SP");
            instrumentID = set.getInt("AC_INSTRUMENT");
            acc.AC_MASS_SPECTROMETRY_MS_TYPE(set.getString("AC_MASS_SPECTROMETRY_MS_TYPE"));
            acc.AC_MASS_SPECTROMETRY_ION_MODE(set.getString("AC_MASS_SPECTROMETRY_ION_MODE"));
            acc.PK_SPLASH(set.getString("PK_SPLASH"));
            this.statementAC_CHROMATOGRAPHY.setString(1, set.getString("ACCESSION"));
            this.statementAC_MASS_SPECTROMETRY.setString(1, set.getString("ACCESSION"));
            this.statementMS_DATA_PROCESSING.setString(1, set.getString("ACCESSION"));
            this.statementMS_FOCUSED_ION.setString(1, set.getString("ACCESSION"));
            this.statementCOMMENT.setString(1, set.getString("ACCESSION"));
            this.statementPEAK.setString(1, set.getString("ACCESSION"));
            this.statementPK_NUM_PEAK.setString(1, set.getString("ACCESSION"));
            this.statementANNOTATION_HEADER.setString(1, accessionId);

            ResultSet tmp = this.statementAC_CHROMATOGRAPHY.executeQuery();
            List<Pair<String, String>> tmpList = new ArrayList<Pair<String, String>>();
            while (tmp.next())
                tmpList.add(Pair.of(tmp.getString("SUBTAG"), tmp.getString("VALUE")));
            acc.AC_CHROMATOGRAPHY(tmpList);

            tmp = this.statementAC_MASS_SPECTROMETRY.executeQuery();
            tmpList.clear();
            while (tmp.next())
                tmpList.add(Pair.of(tmp.getString("SUBTAG"), tmp.getString("VALUE")));
            acc.AC_MASS_SPECTROMETRY(tmpList);

            tmp = this.statementMS_DATA_PROCESSING.executeQuery();
            tmpList.clear();
            while (tmp.next())
                tmpList.add(Pair.of(tmp.getString("SUBTAG"), tmp.getString("VALUE")));
            acc.MS_DATA_PROCESSING(tmpList);

            tmp = this.statementMS_FOCUSED_ION.executeQuery();
            tmpList.clear();
            while (tmp.next())
                tmpList.add(Pair.of(tmp.getString("SUBTAG"), tmp.getString("VALUE")));
            acc.MS_FOCUSED_ION(tmpList);

            tmp = this.statementCOMMENT.executeQuery();
            List<String> tmpList2 = new ArrayList<String>();
            while (tmp.next())
                tmpList2.add(tmp.getString("COMMENT"));
            acc.COMMENT(tmpList2);

            tmp = this.statementANNOTATION_HEADER.executeQuery();
            //            int PK_ANNOTATION_HEADER_numberOfTokens   = -1;
            if (tmp.next()) {
                String PK_ANNOTATION_HEADER = tmp.getString("HEADER");
                String[] PK_ANNOTATION_HEADER_tokens = PK_ANNOTATION_HEADER.split(" ");
                acc.PK_ANNOTATION_HEADER(Arrays.asList(PK_ANNOTATION_HEADER_tokens));
                //               PK_ANNOTATION_HEADER_numberOfTokens   = PK_ANNOTATION_HEADER_tokens.length;
            }

            tmp = this.statementPEAK.executeQuery();
            //            acc.add("PK$PEAK", null, "m/z int. rel.int.");
            while (tmp.next()) {
                acc.PK_PEAK_ADD_LINE(Arrays.asList((Double) tmp.getDouble("PK_PEAK_MZ"),
                        (Double) (double) tmp.getFloat("PK_PEAK_INTENSITY"),
                        (Double) (double) tmp.getShort("PK_PEAK_RELATIVE")));
                String PK_ANNOTATION = tmp.getString("PK_ANNOTATION");
                if (PK_ANNOTATION != null)
                    acc.PK_ANNOTATION_ADD_LINE(Arrays.asList(PK_ANNOTATION.split(" ")));
            }
            tmp = this.statementPK_NUM_PEAK.executeQuery();
            while (tmp.next()) {
                acc.PK_NUM_PEAK(Integer.valueOf(tmp.getInt("PK_NUM_PEAK")));
            }
        } else
            throw new IllegalStateException("accessionId '" + accessionId + "' is not in database");
        if (compoundID == -1)
            throw new IllegalStateException("compoundID is not set");
        this.statementCOMPOUND.setInt(1, compoundID);
        set = this.statementCOMPOUND.executeQuery();
        while (set.next()) {
            String formulaString = set.getString("CH_FORMULA");
            IMolecularFormula m = MolecularFormulaManipulator.getMolecularFormula(formulaString,
                    DefaultChemObjectBuilder.getInstance());
            acc.CH_FORMULA(m);
            acc.CH_EXACT_MASS(set.getDouble("CH_EXACT_MASS"));

            String smilesString = set.getString("CH_SMILES");
            if (smilesString.equals("N/A"))
                acc.CH_SMILES(new AtomContainer());
            else {
                IAtomContainer c = new SmilesParser(DefaultChemObjectBuilder.getInstance())
                        .parseSmiles(smilesString);
                acc.CH_SMILES(c);
            }

            String iupacString = set.getString("CH_IUPAC");
            if (iupacString.equals("N/A"))
                acc.CH_IUPAC(new AtomContainer());
            else {
                // Get InChIToStructure
                InChIToStructure intostruct = InChIGeneratorFactory.getInstance()
                        .getInChIToStructure(iupacString, DefaultChemObjectBuilder.getInstance());
                INCHI_RET ret = intostruct.getReturnStatus();
                if (ret == INCHI_RET.WARNING) {
                    // Structure generated, but with warning message
                    System.out.println(acc.ACCESSION() + ": InChI warning: " + intostruct.getMessage());
                } else if (ret != INCHI_RET.OKAY) {
                    // Structure generation failed
                    throw new IllegalArgumentException(
                            "Can not parse INCHI string in \"CH$IUPAC\" field. Structure generation failed: "
                                    + ret.toString() + " [" + intostruct.getMessage() + "] for " + iupacString);
                }
                IAtomContainer iupac = intostruct.getAtomContainer();
                acc.CH_IUPAC(iupac);
            }

            // TODO CH$CDK_DEPICT_SMILES
            // TODO CH$CDK_DEPICT_GENERIC_SMILES
            // TODO CH$CDK_DEPICT_STRUCTURE_SMILES
            //            acc.add("CH$CDK_DEPICT_SMILES", null, set.getString("CH_CDK_DEPICT_SMILES"));
            //            acc.add("CH$CDK_DEPICT_GENERIC_SMILES", null, set.getString("CH_CDK_DEPICT_GENERIC_SMILES"));
            //            acc.add("CH$CDK_DEPICT_STRUCTURE_SMILES", null, set.getString("CH_CDK_DEPICT_STRUCTURE_SMILES"));
        }
        this.statementCH_LINK.setInt(1, compoundID);
        set = this.statementCH_LINK.executeQuery();
        List<Pair<String, String>> tmpList = new ArrayList<Pair<String, String>>();
        while (set.next()) {
            tmpList.add(Pair.of(set.getString("DATABASE_NAME"), set.getString("DATABASE_ID")));
        }
        acc.CH_LINK(tmpList);

        this.statementCOMPOUND_COMPOUND_CLASS.setInt(1, compoundID);
        set = this.statementCOMPOUND_COMPOUND_CLASS.executeQuery();
        List<String> tmpList2 = new ArrayList<String>();
        while (set.next()) {
            this.statementCOMPOUND_CLASS.setInt(1, set.getInt("CLASS"));
            ResultSet tmp = this.statementCOMPOUND_CLASS.executeQuery();
            while (tmp.next()) {
                tmpList2.add(tmp.getString("CH_COMPOUND_CLASS"));
            }
        }
        acc.CH_COMPOUND_CLASS(tmpList2);

        this.statementCOMPOUND_NAME.setInt(1, compoundID);
        set = this.statementCOMPOUND_NAME.executeQuery();
        tmpList2.clear();
        while (set.next()) {
            this.statementNAME.setInt(1, set.getInt("NAME"));
            ResultSet tmp = this.statementNAME.executeQuery();
            while (tmp.next()) {
                tmpList2.add(tmp.getString("CH_NAME"));
            }
        }
        acc.CH_NAME(tmpList2);

        this.statementSAMPLE.setInt(1, sampleID);
        set = this.statementSAMPLE.executeQuery();
        if (set.next()) {
            acc.SP_SCIENTIFIC_NAME(set.getString("SP_SCIENTIFIC_NAME"));
            acc.SP_LINEAGE(set.getString("SP_LINEAGE"));

            this.statementSP_LINK.setInt(1, set.getInt("ID"));
            ResultSet tmp = this.statementSP_LINK.executeQuery();
            tmpList.clear();
            while (tmp.next()) {
                String spLink = tmp.getString("SP_LINK");
                String[] tokens = spLink.split(" ");
                tmpList.add(Pair.of(tokens[0], tokens[1]));
            }
            acc.SP_LINK(tmpList);

            this.statementSP_SAMPLE.setInt(1, set.getInt("ID"));
            tmp = this.statementSP_SAMPLE.executeQuery();
            tmpList2.clear();
            while (tmp.next()) {
                tmpList2.add(tmp.getString("SP_SAMPLE"));
            }
            acc.SP_SAMPLE(tmpList2);
        }
        if (instrumentID == -1)
            throw new IllegalStateException("instrumentID is not set");
        this.statementINSTRUMENT.setInt(1, instrumentID);
        set = this.statementINSTRUMENT.executeQuery();
        if (set.next()) {
            acc.AC_INSTRUMENT(set.getString("AC_INSTRUMENT"));
            acc.AC_INSTRUMENT_TYPE(set.getString("AC_INSTRUMENT_TYPE"));
        } else
            throw new IllegalStateException("instrumentID is not in database");
    } catch (Exception e) {
        System.out.println("error: " + accessionId);
        e.printStackTrace();
        return null;
    }
    //      this.openConnection();

    return acc;
}

From source file:com.alibaba.wasp.jdbc.TestJdbcResultSet.java

@Test
public void testInt() throws SQLException {
    trace("test INT");
    ResultSet rs;
    Object o;/*from   w  w  w .  ja v  a  2 s  .c o  m*/
    stat = conn.createStatement();
    stat.execute("INSERT INTO test (column1,column2,column3) VALUES(31,-1, 'testInt')");
    stat.execute("INSERT INTO test (column1,column2,column3) VALUES(32,0, 'testInt')");
    stat.execute("INSERT INTO test (column1,column2,column3) VALUES(33,1, 'testInt')");
    stat.execute("INSERT INTO test (column1,column2,column3) VALUES(34," + Integer.MAX_VALUE + ", 'testInt')");
    stat.execute("INSERT INTO test (column1,column2,column3) VALUES(35," + Integer.MIN_VALUE + ", 'testInt')");
    stat.execute("INSERT INTO test (column1,column2,column3) VALUES(36,0, 'testInt')");
    stat.execute("INSERT INTO test (column1,column2,column3) VALUES(37,0, 'testInt')");
    // this should not be read - maxrows=6

    // MySQL compatibility (is this required?)
    rs = stat.executeQuery("SELECT column1,column2,column3 FROM test where column3='testInt' ORDER BY column1");
    // MySQL compatibility
    assertEquals(1, rs.findColumn("column1"));
    assertEquals(2, rs.findColumn("column2"));

    ResultSetMetaData meta = rs.getMetaData();
    assertEquals(3, meta.getColumnCount());

    assertTrue(rs.getRow() == 0);

    rs.next();
    trace("default fetch size=" + rs.getFetchSize());
    // 0 should be an allowed value (but it's not defined what is actually
    // means)
    rs.setFetchSize(1);
    assertThrows(SQLErrorCode.INVALID_VALUE_2, rs).setFetchSize(-1);
    // fetch size 100 is bigger than maxrows - not allowed
    rs.setFetchSize(6);

    assertTrue(rs.getRow() == 1);
    assertEquals(2, rs.findColumn("COLUMN2"));
    assertEquals(2, rs.findColumn("column2"));
    assertEquals(2, rs.findColumn("Column2"));
    assertEquals(1, rs.findColumn("COLUMN1"));
    assertEquals(1, rs.findColumn("column1"));
    assertEquals(1, rs.findColumn("Column1"));
    assertEquals(1, rs.findColumn("colUMN1"));
    assertTrue(rs.getInt(2) == -1 && !rs.wasNull());
    assertTrue(rs.getInt("COLUMN2") == -1 && !rs.wasNull());
    assertTrue(rs.getInt("column2") == -1 && !rs.wasNull());
    assertTrue(rs.getInt("Column2") == -1 && !rs.wasNull());
    assertTrue(rs.getString("Column2").equals("-1") && !rs.wasNull());

    o = rs.getObject("column2");
    trace(o.getClass().getName());
    assertTrue(o instanceof Long);
    assertTrue(((Long) o).longValue() == -1);
    o = rs.getObject(2);
    trace(o.getClass().getName());
    assertTrue(o instanceof Long);
    assertTrue(((Long) o).longValue() == -1);
    assertTrue(rs.getBoolean("Column2"));
    assertTrue(rs.getByte("Column2") == (byte) -1);
    assertTrue(rs.getShort("Column2") == (short) -1);
    assertTrue(rs.getLong("Column2") == -1);
    assertTrue(rs.getFloat("Column2") == -1.0);
    assertTrue(rs.getDouble("Column2") == -1.0);

    assertTrue(rs.getString("Column2").equals("-1") && !rs.wasNull());
    assertTrue(rs.getInt("COLUMN1") == 31 && !rs.wasNull());
    assertTrue(rs.getInt("column1") == 31 && !rs.wasNull());
    assertTrue(rs.getInt("Column1") == 31 && !rs.wasNull());
    assertTrue(rs.getInt(1) == 31 && !rs.wasNull());
    rs.next();
    assertTrue(rs.getRow() == 2);
    assertTrue(rs.getInt(2) == 0 && !rs.wasNull());
    assertTrue(!rs.getBoolean(2));
    assertTrue(rs.getByte(2) == 0);
    assertTrue(rs.getShort(2) == 0);
    assertTrue(rs.getLong(2) == 0);
    assertTrue(rs.getFloat(2) == 0.0);
    assertTrue(rs.getDouble(2) == 0.0);
    assertTrue(rs.getString(2).equals("0") && !rs.wasNull());
    assertTrue(rs.getInt(1) == 32 && !rs.wasNull());
    rs.next();
    assertTrue(rs.getRow() == 3);
    assertTrue(rs.getInt("COLUMN1") == 33 && !rs.wasNull());
    assertTrue(rs.getInt("COLUMN2") == 1 && !rs.wasNull());
    rs.next();
    assertTrue(rs.getRow() == 4);
    assertTrue(rs.getInt("COLUMN1") == 34 && !rs.wasNull());
    assertTrue(rs.getInt("COLUMN2") == Integer.MAX_VALUE && !rs.wasNull());
    rs.next();
    assertTrue(rs.getRow() == 5);
    assertTrue(rs.getInt("column1") == 35 && !rs.wasNull());
    assertTrue(rs.getInt("column2") == Integer.MIN_VALUE && !rs.wasNull());
    assertTrue(rs.getString(1).equals("35") && !rs.wasNull());
    rs.next();
    assertTrue(rs.getRow() == 6);
    assertTrue(rs.getInt("column1") == 36 && !rs.wasNull());
    assertTrue(rs.getInt("column2") == 0 && !rs.wasNull());
    assertTrue(rs.getInt(2) == 0 && !rs.wasNull());
    assertTrue(rs.getInt(1) == 36 && !rs.wasNull());
    assertTrue(rs.getString(1).equals("36") && !rs.wasNull());
    assertTrue(rs.getString(2).equals("0") && !rs.wasNull());
    assertTrue(!rs.wasNull());
    // assertFalse(rs.next());
    // assertEquals(0, rs.getRow());
    // there is one more row, but because of setMaxRows we don't get it
}

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswMySql.CFFswMySqlFSSFProfileTable.java

protected CFFswFSSFProfileBuff unpackFSSFProfileResultSetToBuff(ResultSet resultSet) throws SQLException {
    final String S_ProcName = "unpackFSSFProfileResultSetToBuff";
    int idxcol = 1;
    CFFswFSSFProfileBuff buff = schema.getFactoryFSSFProfile().newBuff();
    {//from   w ww  . j  a v  a2s .c  o m
        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);
}

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_4.CFFreeSwitchMySql.CFFreeSwitchMySqlFSSFProfileTable.java

protected CFFreeSwitchFSSFProfileBuff unpackFSSFProfileResultSetToBuff(ResultSet resultSet)
        throws SQLException {
    final String S_ProcName = "unpackFSSFProfileResultSetToBuff";
    int idxcol = 1;
    CFFreeSwitchFSSFProfileBuff buff = schema.getFactoryFSSFProfile().newBuff();
    {//ww  w . jav a2 s.  c om
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setCreatedAt(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setCreatedAt(null);
        } else {
            buff.setCreatedAt(CFFreeSwitchMySqlSchema.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(CFFreeSwitchMySqlSchema.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);
}

From source file:forseti.compras.JCompFactDlg.java

@SuppressWarnings("rawtypes")
public void SubirArchivosOTROS(HttpServletRequest request, HttpServletResponse response,
        JFacturasXML compfactxml, Vector archivos) throws ServletException, IOException {
    short idmensaje = -1;
    String mensaje = "";

    String cfd_cbb_serie = compfactxml.getParametros().getProperty("cfd_cbb_serie");
    String cfd_cbb_numfol = compfactxml.getParametros().getProperty("cfd_cbb_numfol");
    String factnumext = compfactxml.getParametros().getProperty("factnumext");
    String total = compfactxml.getParametros().getProperty("total");
    String idmoneda = compfactxml.getParametros().getProperty("idmoneda");
    String tc = compfactxml.getParametros().getProperty("tc");

    if ((!factnumext.equals("") && (!cfd_cbb_serie.equals("") || !cfd_cbb_numfol.equals("")))
            || (factnumext.equals("") && (cfd_cbb_serie.equals("") || cfd_cbb_numfol.equals("")))) {
        idmensaje = 3;//from   w w  w .ja  v a  2 s  .com
        mensaje = "ERROR: Se debe seleccionar, ya sea, el numero de factura extranjera, o la serie y folio de la factura impresa.";
        getSesion(request).setID_Mensaje(idmensaje, mensaje);
    } else //Sube el archivo
    {
        UUID nombre = UUID.randomUUID();

        String[] exts = { "pdf", "jpg", "jpeg", "gif", "bmp", "zip", "png" };
        boolean[] frz = { true, true, true, true, true, true, true };
        JSubirArchivo sa = new JSubirArchivo(512,
                "/usr/local/forseti/emp/" + getSesion(request).getBDCompania() + "/comp/", exts, frz);

        if (sa.processFiles(archivos) < 1) // significa que no encontr el archivo
        {
            idmensaje = 3;
            mensaje = JUtil.Msj("CEF", "ADM_CFDI", "DLG", "MSJ-PROCERR", 3) + "<br>" + sa.getError();
            getSesion(request).setID_Mensaje(idmensaje, mensaje);
        } else {
            String str = "select * from sp_cfdcompotr_agregar('ENT','"
                    + Integer.parseInt(getSesion(request)
                            .getSesion(compfactxml.getParametros().getProperty("idmod")).getEspecial())
                    + "','" + p(cfd_cbb_serie) + "','" + (cfd_cbb_numfol.equals("") ? "0" : p(cfd_cbb_numfol))
                    + "','" + p(factnumext) + "','" + p(nombre.toString()) + "','" + p(sa.getExt(0)) + "','"
                    + p(sa.getFile(0)) + "','" + p(total) + "','" + p(idmoneda) + "','" + p(tc)
                    + "') as (err int, res varchar)";
            System.out.println(str);
            try {
                Connection con = JAccesoBD.getConexionSes(request);
                Statement s = con.createStatement();
                ResultSet rs = s.executeQuery(str);
                if (rs.next()) {
                    idmensaje = rs.getShort("ERR");
                    mensaje = rs.getString("RES");
                }
                s.close();
                JAccesoBD.liberarConexion(con);

                if (idmensaje == 0) {
                    File orig = new File("/usr/local/forseti/emp/" + JUtil.getSesion(request).getBDCompania()
                            + "/comp/" + sa.getFile(0));
                    File dest = new File("/usr/local/forseti/emp/" + JUtil.getSesion(request).getBDCompania()
                            + "/comp/OTRs/" + nombre.toString() + "." + sa.getExt(0));
                    orig.renameTo(dest);
                }

                getSesion(request).setID_Mensaje(idmensaje, mensaje);

            } catch (SQLException e) {
                e.printStackTrace();
                idmensaje = 3;
                mensaje = e.getMessage();
                getSesion(request).setID_Mensaje(idmensaje, mensaje);
            }
        }
    }

    irApag("/forsetiweb/caja_mensajes.jsp", request, response);
    return;
}

From source file:it.eng.spagobi.meta.initializer.PhysicalModelInitializer.java

private void initColumnsMeta(DatabaseMetaData dbMeta, PhysicalModel model, PhysicalTable table) {
    ResultSet rs;
    PhysicalColumn column;/*ww  w.j  a  va  2 s .c  o  m*/

    try {
        rs = dbMeta.getColumns(model.getCatalog(), model.getSchema(), table.getName(), null);

        /*
         * 1. TABLE_CAT String => table catalog (may be null) 2. TABLE_SCHEM String => table schema (may be null) 3. TABLE_NAME String => table name 4.
         * COLUMN_NAME String => column name 5. DATA_TYPE short => SQL type from java.sql.Types 6. TYPE_NAME String => Data source dependent type name, for
         * a UDT the type name is fully qualified 7. COLUMN_SIZE int => column size. For char or date types this is the maximum number of characters, for
         * numeric or decimal types this is precision. 8. BUFFER_LENGTH is not used. 9. DECIMAL_DIGITS int => the number of fractional digits 10.
         * NUM_PREC_RADIX int => Radix (typically either 10 or 2) 11. NULLABLE int => is NULL allowed. columnNoNulls - might not allow NULL values;
         * columnNullable - definitely allows NULL values; columnNullableUnknown - nullability unknown 12. REMARKS String => comment describing column (may
         * be null) 13. COLUMN_DEF String => default value (may be null) 14. SQL_DATA_TYPE int => unused 15. SQL_DATETIME_SUB int => unused 16.
         * CHAR_OCTET_LENGTH int => for char types the maximum number of bytes in the column 17. ORDINAL_POSITION int => index of column in table (starting
         * at 1) 18. IS_NULLABLE String => NO means column definitely does not allow NULL values; YES means the column might allow NULL values. An empty
         * string means nobody knows. 19. SCOPE_CATLOG String => catalog of table that is the scope of a reference attribute (null if DATA_TYPE isnt REF)
         * 20. SCOPE_SCHEMA String => schema of table that is the scope of a
         * 
         * 182 Chapter 5 reference attribute (null if the DATA_TYPE isnt REF) 21. SCOPE_TABLE String => table name that is the scope of a reference
         * attribute (null if the DATA_TYPE isnt REF) 22. SOURCE_DATA_TYPE short => source type of a distinct type or user-generated Ref type, SQL type
         * from java.sql.Types (null if DATA_TYPE isnt DISTINCT or user-generated REF)
         */
        while (rs.next()) {
            column = FACTORY.createPhysicalColumn();

            // to prevent ojdbc bug
            try {
                column.setDefaultValue(rs.getString("COLUMN_DEF"));
            } catch (Throwable t) {
                log("Impossible to set Default column value");
                t.printStackTrace();
                column.setDefaultValue(null);
            }
            column.setName(rs.getString("COLUMN_NAME"));

            column.setComment(getEscapedMetadataPropertyValue(rs, "REMARKS"));

            column.setDataType(JDBCTypeMapper.getModelType(rs.getShort("DATA_TYPE")));
            column.setTypeName(rs.getString("TYPE_NAME"));
            column.setSize(rs.getInt("COLUMN_SIZE"));
            column.setOctectLength(rs.getInt("CHAR_OCTET_LENGTH"));
            column.setDecimalDigits(rs.getInt("DECIMAL_DIGITS"));
            column.setRadix(rs.getInt("NUM_PREC_RADIX"));
            // column.setDefaultValue( rs.getString("COLUMN_DEF") );
            column.setNullable(!"NO".equalsIgnoreCase(rs.getString("IS_NULLABLE")));
            column.setPosition(rs.getInt("ORDINAL_POSITION"));

            table.getColumns().add(column);
            log("  - column: " + column.getName() + " [" + column.getTypeName() + "]" + " ["
                    + column.getDefaultValue() + "]");
            getPropertiesInitializer().addProperties(column);

        }
        rs.close();
    } catch (Throwable t) {
        throw new RuntimeException("Impossible to initialize primaryKeys metadata", t);
    }
}

From source file:com.nway.spring.jdbc.bean.AsmBeanProcessor.java

private Object processColumn(ResultSet rs, int index, Class<?> propType, String writer, String processorName,
        String beanName, MethodVisitor mv) throws SQLException {

    if (propType.equals(String.class)) {
        visitMethod(mv, index, beanName, "Ljava/lang/String;", "getString", writer);
        return rs.getString(index);
    } else if (propType.equals(Integer.TYPE)) {
        visitMethod(mv, index, beanName, "I", "getInt", writer);
        return rs.getInt(index);
    } else if (propType.equals(Integer.class)) {
        visitMethodWrap(mv, index, beanName, PROPERTY_TYPE_INTEGER, writer, processorName);
        return JdbcUtils.getResultSetValue(rs, index, Integer.class);
    } else if (propType.equals(Long.TYPE)) {
        visitMethod(mv, index, beanName, "J", "getLong", writer);
        return rs.getLong(index);
    } else if (propType.equals(Long.class)) {
        visitMethodWrap(mv, index, beanName, PROPERTY_TYPE_LONG, writer, processorName);
        return JdbcUtils.getResultSetValue(rs, index, Long.class);
    } else if (propType.equals(java.sql.Date.class)) {
        visitMethod(mv, index, beanName, "Ljava/sql/Date;", "getDate", writer);
        return rs.getDate(index);
    } else if (propType.equals(java.util.Date.class)) {
        visitMethodCast(mv, index, beanName, PROPERTY_TYPE_DATE, "java/util/Date", writer);
        return rs.getTimestamp(index);
    } else if (propType.equals(Timestamp.class)) {
        visitMethod(mv, index, beanName, "Ljava/sql/Timestamp;", "getTimestamp", writer);
        return rs.getTimestamp(index);
    } else if (propType.equals(Time.class)) {
        visitMethod(mv, index, beanName, "Ljava/sql/Time;", "getTime", writer);
        return rs.getTime(index);
    } else if (propType.equals(Double.TYPE)) {
        visitMethod(mv, index, beanName, "D", "getDouble", writer);
        return rs.getDouble(index);
    } else if (propType.equals(Double.class)) {
        visitMethodWrap(mv, index, beanName, PROPERTY_TYPE_DOUBLE, writer, processorName);
        return JdbcUtils.getResultSetValue(rs, index, Double.class);
    } else if (propType.equals(Float.TYPE)) {
        visitMethod(mv, index, beanName, "F", "getFloat", writer);
        return rs.getFloat(index);
    } else if (propType.equals(Float.class)) {
        visitMethodWrap(mv, index, beanName, PROPERTY_TYPE_FLOAT, writer, processorName);
        return JdbcUtils.getResultSetValue(rs, index, Float.class);
    } else if (propType.equals(Boolean.TYPE)) {
        visitMethod(mv, index, beanName, "Z", "getBoolean", writer);
        return rs.getBoolean(index);
    } else if (propType.equals(Boolean.class)) {
        visitMethodWrap(mv, index, beanName, PROPERTY_TYPE_BOOLEAN, writer, processorName);
        return JdbcUtils.getResultSetValue(rs, index, Boolean.class);
    } else if (propType.equals(Clob.class)) {
        visitMethod(mv, index, beanName, "Ljava/sql/Clob;", "getClob", writer);
        return rs.getClob(index);
    } else if (propType.equals(Blob.class)) {
        visitMethod(mv, index, beanName, "Ljava/sql/Blob;", "getBlob", writer);
        return rs.getBlob(index);
    } else if (propType.equals(byte[].class)) {
        visitMethod(mv, index, beanName, "[B", "getBytes", writer);
        return rs.getBytes(index);
    } else if (propType.equals(Short.TYPE)) {
        visitMethod(mv, index, beanName, "S", "getShort", writer);
        return rs.getShort(index);
    } else if (propType.equals(Short.class)) {
        visitMethodWrap(mv, index, beanName, PROPERTY_TYPE_SHORT, writer, processorName);
        return JdbcUtils.getResultSetValue(rs, index, Short.class);
    } else if (propType.equals(Byte.TYPE)) {
        visitMethod(mv, index, beanName, "B", "getByte", writer);
        return rs.getByte(index);
    } else if (propType.equals(Byte.class)) {
        visitMethodWrap(mv, index, beanName, PROPERTY_TYPE_BYTE, writer, processorName);
        return rs.getByte(index);
    } else {//from  w  ww  . j a  v  a  2s  . com
        visitMethodCast(mv, index, beanName, PROPERTY_TYPE_OTHER, propType.getName().replace('.', '/'), writer);
        return rs.getObject(index);
    }
}

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

protected CFFswFSSFProfileBuff unpackFSSFProfileResultSetToBuff(ResultSet resultSet) throws SQLException {
    final String S_ProcName = "unpackFSSFProfileResultSetToBuff";
    int idxcol = 1;
    CFFswFSSFProfileBuff buff = schema.getFactoryFSSFProfile().newBuff();
    {/* w  w w .ja va2s . c o m*/
        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++;

        colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setCreatedAt(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setCreatedAt(null);
        } else {
            buff.setCreatedAt(CFFswOracleSchema.convertTimestampString(colString));
        }
        idxcol++;
        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++;

        colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setUpdatedAt(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setUpdatedAt(null);
        } else {
            buff.setUpdatedAt(CFFswOracleSchema.convertTimestampString(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(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    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(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredManagePresence(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    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(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredInboundCodecNegotiation(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredNonCETTL(resultSet.getShort(idxcol));
    idxcol++;
    buff.setRequiredAuthCalls(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    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(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    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(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredRtpRewriteTimestamp(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredPassRFC2833(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    {
        String colVal = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalOdbcDSN(null);
        } else {
            buff.setOptionalOdbcDSN(colVal);
        }
    }
    idxcol++;
    buff.setRequiredInboundBypassMedia(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredInboundProxyMedia(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredInboundLateNegotiation(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredAcceptBlindReg(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredAcceptBlindAuth(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredSuppressCNG(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredDisableTranscoding(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredDisableTransfer(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredNDLBBrokenAuthHash(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredNDLBReceivedInNATRegContact(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredInboundRegForceMatchingUsername(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredAuthAllPackets(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredVad(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredAlias(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredForceSubscriptionExpires(resultSet.getInt(idxcol));
    idxcol++;
    buff.setRequiredDisableRegister(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredNDLBForceReport(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredChallengeRealm(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredDisableRtpAutoAdjust(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredInboundUseCallIdAsUUID(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredOutboundUseUUIDAsCallId(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredRtpAutofixTiming(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredAutoRtpBugs(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredDisableSrv(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredDisableNAPtr(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    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);
}

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswMySql.CFFswMySqlFSSFVMailTable.java

protected CFFswFSSFVMailBuff unpackFSSFVMailResultSetToBuff(ResultSet resultSet) throws SQLException {
    final String S_ProcName = "unpackFSSFVMailResultSetToBuff";
    int idxcol = 1;
    CFFswFSSFVMailBuff buff = schema.getFactoryFSSFVMail().newBuff();
    {/*from  ww  w.  j  a v a 2s  . c  om*/
        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.setRequiredFSSFVMailId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredFSSofiaId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredName(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredTemplateFile(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredNotifyTemplateFile(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredDateFmt(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredEmailFrom(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredFileExtension(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredTerminatorKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredMaxLoginAttempts(resultSet.getShort(idxcol));
    idxcol++;
    buff.setRequiredDigitTimeout(resultSet.getInt(idxcol));
    idxcol++;
    buff.setRequiredMinRecordLen(resultSet.getInt(idxcol));
    idxcol++;
    buff.setRequiredMaxRecordLen(resultSet.getInt(idxcol));
    idxcol++;
    buff.setRequiredMaxRetries(resultSet.getShort(idxcol));
    idxcol++;
    buff.setRequiredToneSpec(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredCallbackDialplan(resultSet.getString(idxcol));
    idxcol++;
    {
        String colVal = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalCallbackContext(null);
        } else {
            buff.setOptionalCallbackContext(colVal);
        }
    }
    idxcol++;
    buff.setRequiredPlayNewMessagesKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredPlaySavedMessagesKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredLoginKeys(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredMainMenuKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredConfigMenuKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredRecordGreetingKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredChooseGreetingKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredChangePassKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredRecordNameKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredRecordFileKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredListenFileKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredSaveFileKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredDeleteFileKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredUndeleteFileKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredEMailKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredPauseKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredRestartKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredFastForwardKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredRewindKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredSkipGreetKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredRecordSilenceThreshold(resultSet.getInt(idxcol));
    idxcol++;
    buff.setRequiredRecordSilenceHits(resultSet.getShort(idxcol));
    idxcol++;
    buff.setRequiredWebTemplateFile(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredRecordSampleRate(resultSet.getInt(idxcol));
    idxcol++;
    buff.setRequiredOperatorExtension(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredVMainExtension(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredVMailKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredAutoPlaybackRecordings(resultSet.getBoolean(idxcol));
    idxcol++;
    buff.setRequiredStorageDir(resultSet.getString(idxcol));
    idxcol++;
    {
        String colVal = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalOdbcDSN(null);
        } else {
            buff.setOptionalOdbcDSN(colVal);
        }
    }
    idxcol++;
    {
        String colVal = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalRecordComent(null);
        } else {
            buff.setOptionalRecordComent(colVal);
        }
    }
    idxcol++;
    {
        String colVal = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalRecordTitle(null);
        } else {
            buff.setOptionalRecordTitle(colVal);
        }
    }
    idxcol++;
    {
        String colVal = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalRecordCopyright(null);
        } else {
            buff.setOptionalRecordCopyright(colVal);
        }
    }
    idxcol++;

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

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_4.CFFreeSwitchMySql.CFFreeSwitchMySqlFSSFVMailTable.java

protected CFFreeSwitchFSSFVMailBuff unpackFSSFVMailResultSetToBuff(ResultSet resultSet) throws SQLException {
    final String S_ProcName = "unpackFSSFVMailResultSetToBuff";
    int idxcol = 1;
    CFFreeSwitchFSSFVMailBuff buff = schema.getFactoryFSSFVMail().newBuff();
    {//from  w  ww .  j  a v a2  s . co  m
        String colString = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setCreatedAt(null);
        } else if ((colString == null) || (colString.length() <= 0)) {
            buff.setCreatedAt(null);
        } else {
            buff.setCreatedAt(CFFreeSwitchMySqlSchema.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(CFFreeSwitchMySqlSchema.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.setRequiredFSSFVMailId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredFSSofiaId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredName(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredTemplateFile(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredNotifyTemplateFile(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredDateFmt(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredEmailFrom(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredFileExtension(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredTerminatorKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredMaxLoginAttempts(resultSet.getShort(idxcol));
    idxcol++;
    buff.setRequiredDigitTimeout(resultSet.getInt(idxcol));
    idxcol++;
    buff.setRequiredMinRecordLen(resultSet.getInt(idxcol));
    idxcol++;
    buff.setRequiredMaxRecordLen(resultSet.getInt(idxcol));
    idxcol++;
    buff.setRequiredMaxRetries(resultSet.getShort(idxcol));
    idxcol++;
    buff.setRequiredToneSpec(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredCallbackDialplan(resultSet.getString(idxcol));
    idxcol++;
    {
        String colVal = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalCallbackContext(null);
        } else {
            buff.setOptionalCallbackContext(colVal);
        }
    }
    idxcol++;
    buff.setRequiredPlayNewMessagesKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredPlaySavedMessagesKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredLoginKeys(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredMainMenuKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredConfigMenuKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredRecordGreetingKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredChooseGreetingKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredChangePassKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredRecordNameKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredRecordFileKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredListenFileKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredSaveFileKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredDeleteFileKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredUndeleteFileKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredEMailKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredPauseKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredRestartKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredFastForwardKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredRewindKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredSkipGreetKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredRecordSilenceThreshold(resultSet.getInt(idxcol));
    idxcol++;
    buff.setRequiredRecordSilenceHits(resultSet.getShort(idxcol));
    idxcol++;
    buff.setRequiredWebTemplateFile(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredRecordSampleRate(resultSet.getInt(idxcol));
    idxcol++;
    buff.setRequiredOperatorExtension(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredVMainExtension(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredVMailKey(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredAutoPlaybackRecordings(resultSet.getBoolean(idxcol));
    idxcol++;
    buff.setRequiredStorageDir(resultSet.getString(idxcol));
    idxcol++;
    {
        String colVal = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalOdbcDSN(null);
        } else {
            buff.setOptionalOdbcDSN(colVal);
        }
    }
    idxcol++;
    {
        String colVal = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalRecordComent(null);
        } else {
            buff.setOptionalRecordComent(colVal);
        }
    }
    idxcol++;
    {
        String colVal = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalRecordTitle(null);
        } else {
            buff.setOptionalRecordTitle(colVal);
        }
    }
    idxcol++;
    {
        String colVal = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalRecordCopyright(null);
        } else {
            buff.setOptionalRecordCopyright(colVal);
        }
    }
    idxcol++;

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