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:com.mimp.hibernate.HiberEtapa.java

public ArrayList<Revision> getListaRevisionNumero(final String numero) {

    Session session = sessionFactory.getCurrentSession();

    final ArrayList<Revision> allRevision = new ArrayList();

    Work work = new Work() {
        @Override/*ww  w . j  a v a2 s  .  c om*/
        public void execute(Connection connection) throws SQLException {
            String hql = "{call HE_GET_LISTA_REVISION_NUM(?,?)}";
            CallableStatement statement = connection.prepareCall(hql);
            statement.setString(1, numero);
            statement.registerOutParameter(2, OracleTypes.CURSOR);
            statement.execute();

            ResultSet rs = (ResultSet) statement.getObject(2);
            while (rs.next()) {
                Revision tempRev = new Revision();
                Nna nna = new Nna();
                ExpedienteFamilia expFamilia = new ExpedienteFamilia();
                Familia fam = new Familia();
                Unidad unidad = new Unidad();

                tempRev.setIdrevision(rs.getLong("IDREVISION"));
                if (rs.getLong("IDNNA") != 0) {

                    String hql2 = "{call HE_GET_NNA(?, ?)}";
                    CallableStatement statement2 = connection.prepareCall(hql2);
                    statement2.setLong(1, rs.getLong("IDNNA"));
                    statement2.registerOutParameter(2, OracleTypes.CURSOR);
                    statement2.execute();
                    ResultSet rs2 = (ResultSet) statement2.getObject(2);
                    if (rs2.next()) {
                        nna.setIdnna(rs2.getLong(1));
                        tempRev.setNna(nna);
                    }
                    statement2.close();
                }
                if (rs.getLong("IDEXPEDIENTE_FAMILIA") != 0) {

                    String hql3 = "{call HE_GET_EXPEDIENTE_FAMILIA(?, ?)}";
                    CallableStatement statement3 = connection.prepareCall(hql3);
                    statement3.setLong(1, rs.getLong("IDEXPEDIENTE_FAMILIA"));
                    statement3.registerOutParameter(2, OracleTypes.CURSOR);
                    statement3.execute();
                    ResultSet rs3 = (ResultSet) statement3.getObject(2);
                    if (rs3.next()) {
                        expFamilia.setIdexpedienteFamilia(rs3.getLong(1));

                        if (rs3.getLong(2) != 0) {

                            String hql4 = "{call HE_GETFAMILIA(?, ?)}";
                            CallableStatement statement4 = connection.prepareCall(hql4);
                            statement4.setLong(1, rs3.getLong(2));
                            statement4.registerOutParameter(2, OracleTypes.CURSOR);
                            statement4.execute();
                            ResultSet rs4 = (ResultSet) statement4.getObject(2);
                            if (rs4.next()) {
                                fam.setIdfamilia(rs4.getLong(1));
                                expFamilia.setFamilia(fam);
                            }
                            rs4.close();
                            statement4.close();
                        }

                        if (rs3.getLong(3) != 0) {

                            String hql5 = "{call HE_GET_UNIDAD(?, ?)}";
                            CallableStatement statement5 = connection.prepareCall(hql5);
                            statement5.setLong(1, rs3.getLong(3));
                            statement5.registerOutParameter(2, OracleTypes.CURSOR);
                            statement5.execute();
                            ResultSet rs5 = (ResultSet) statement5.getObject(2);
                            if (rs5.next()) {
                                unidad.setIdunidad(rs5.getLong(1));
                                expFamilia.setUnidad(unidad);
                            }
                            rs5.close();
                            statement5.close();
                        }

                        expFamilia.setNumero(rs3.getLong(4));
                        expFamilia.setExpediente(rs3.getString(5));
                        expFamilia.setHt(rs3.getString(6));
                        expFamilia.setNumeroExpediente(rs3.getString(7));
                        expFamilia.setFechaIngresoDga(rs3.getDate(8));
                        expFamilia.setEstado(rs3.getString(9));
                        expFamilia.setTupa(rs3.getDate(10));
                        expFamilia.setNacionalidad(rs3.getString(11));
                        expFamilia.setRnsa(rs3.getShort(12));
                        expFamilia.setRnaa(rs3.getShort(13));
                        expFamilia.setTipoFamilia(rs3.getString(14));
                        expFamilia.setTipoListaEspera(rs3.getString(15));
                        expFamilia.setHtFicha(rs3.getString(16));
                        expFamilia.setnFicha(rs3.getString(17));
                        expFamilia.setFechaIngresoFicha(rs3.getDate(18));

                        tempRev.setExpedienteFamilia(expFamilia);
                    }
                    rs3.close();
                    statement3.close();
                }

                tempRev.setNumero(rs.getString("NUMERO"));
                tempRev.setFechaRevision(rs.getDate("FECHA_REVISION"));
                tempRev.setComentarios(rs.getString("COMENTARIOS"));

                allRevision.add(tempRev);

            }
            rs.close();
            statement.close();
        }
    };

    session.doWork(work);

    return allRevision;
}

From source file:edu.ku.brc.specify.conversion.MSULichensFixer.java

/**
 * @param rs//from  ww  w. j  av  a  2  s.c  o m
 * @param rsmd
 * @param parentNodeId
 * @return
 * @throws SQLException
 */
protected boolean processRow(final ResultSet rs, final ResultSetMetaData rsmd, final Integer parentNodeId)
        throws SQLException {
    for (int colInx = 1; colInx <= cols.length; colInx++) {
        pStmtTx.setNull(colInx, colTypes[colInx - 1]);
    }

    String newName = null;
    Boolean isRoot = null;
    boolean skip = false;
    for (int colInx = 1; colInx <= oldCols.length && !skip; colInx++) {
        String oldName = oldCols[colInx - 1];
        Integer newInx = fieldToColHash.get(oldName);
        if (newInx == null) {
            newName = oldToNewColMap.get(oldName);
            if (newName != null) {
                newInx = fieldToColHash.get(newName);
                if (newInx == -1) {
                    String msg = "Couldn't find column index for New Name[" + newName + "]";
                    log.error(msg);
                    tblWriter.logError(msg);
                }
            } else if (colInx == lastEditedByInx) {
                String lastEditedByStr = rs.getString(colInx);
                if (StringUtils.isNotEmpty(lastEditedByStr)) {
                    Integer agtId = 1;//conversion.getModifiedByAgentId(lastEditedByStr);
                    if (agtId != null) {
                        pStmtTx.setInt(modifiedByAgentInx, agtId);
                        continue;
                    }
                }

                pStmtTx.setInt(colInx, 1);
                continue;

            } else if (colInx != 20) {
                String msg = "Couldn't find Old Name[" + oldName + "]";
                log.error(msg);
                tblWriter.logError(msg);
            } else {
                continue; // GroupToView
            }
        }

        if (colInx < 6) {
            if (isRoot == null) {
                isRoot = rs.getInt(rankIdOldDBInx) == 0;
            }
            Integer oldID = rs.getInt(colInx);
            if (!rs.wasNull() || (isRoot && colInx == 2)) {
                boolean skipError = false;

                Integer newID = null;
                if (oldID == 612195491)
                    oldID = 21;
                else if (oldID == -447245554)
                    oldID = -1414322196;

                if (oldName.equals("TaxonomyTypeID")) {
                    newID = 1;

                } else if (oldName.equals("TaxonomicUnitTypeID")) {
                    String s = "SELECT RankID FROM taxonomicunittype WHERE TaxonomicUnitTypeID = " + oldID;
                    Integer rankId = BasicSQLUtils.getCount(oldDBConn, s);
                    log.debug(s);
                    switch (rankId) {
                    case 0:
                        newID = 8;
                        break;
                    case 10:
                        newID = 12;
                        break;
                    case 20:
                        newID = 22;
                        break;
                    case 30:
                        newID = 23;
                        break;
                    case 40:
                        newID = 7;
                        break;
                    case 60:
                        newID = 14;
                        break;
                    case 70:
                        newID = 4;
                        break;
                    case 100:
                        newID = 17;
                        break;
                    case 110:
                        newID = 19;
                        break;
                    case 140:
                        newID = 15;
                        break;
                    case 150:
                        newID = 10;
                        break;
                    case 160:
                        newID = 16;
                        break;
                    case 170:
                        newID = 2;
                        break;
                    case 180:
                        newID = 5;
                        break;
                    case 190:
                        newID = 13;
                        break;
                    case 200:
                        newID = 1;
                        break;
                    case 210:
                        newID = 6;
                        break;
                    case 220:
                        newID = 21;
                        break;
                    case 230:
                        newID = 18;
                        break;
                    case 240:
                        newID = 11;
                        break;
                    case 250:
                        newID = 3;
                        break;
                    case 260:
                        newID = 20;
                        break;
                    case 270:
                        newID = 9;
                        break;
                    default:
                        log.error("Error with rank: " + rankId);
                    }

                } else {
                    newID = mappers[colInx - 1].get(oldID);
                    if (newID == null && (colInx == 5 || colInx == 3)) {
                        String s = "SELECT RankID FROM taxonomicunittype WHERE TaxonomicUnitTypeID = " + oldID;
                        Integer rankId = BasicSQLUtils.getCount(oldDBConn, s);
                        log.debug(s);
                        if (rankId != null) {
                            s = "SELECT TaxonomicUnitTypeID FROM taxonomicunittype WHERE TaxonomyTypeID = 6 && RankID = "
                                    + rankId;
                            oldID = BasicSQLUtils.getCount(oldDBConn, s);
                            log.debug(s);
                            if (oldID != null) {
                                newID = mappers[colInx - 1].get(oldID);
                                if (newID == null) {
                                    log.error("newID is null for Old Id " + oldID + "   colInx: " + colInx);
                                }
                            } else {
                                log.error("oldID is null");
                            }
                        } else {
                            log.error("rankId is null");
                        }
                    }

                }

                if (newID == null) {
                    if (colInx == 3 || colInx == 5) {
                        if (!isRoot) {
                            skip = true;
                        }

                    } else if (colInx == 2 && (parentNodeId != null || isRoot)) {
                        // Note for RankID == 0 the parent would be null because it is the root
                        newID = parentNodeId;

                    } else {
                        boolean wasInOldTaxonTable = BasicSQLUtils.getCountAsInt(oldDBConn,
                                "SELECT COUNT(*) FROM taxonname WHERE TaxonNameID = " + oldID) > 0;
                        boolean isDetPointToTaxon = BasicSQLUtils.getCountAsInt(oldDBConn,
                                "SELECT COUNT(*) FROM determination WHERE TaxonNameID = " + oldID) > 0;
                        if (isDetPointToTaxon) {
                            String msg = String.format(
                                    "***** Couldn't get %s NewID [%d] from mapper for colInx[%d] In Old taxonname table: %s  WasParentID: %s  Det Using: %s",
                                    (colInx == 2 ? "Parent" : ""), oldID, colInx,
                                    (wasInOldTaxonTable ? "YES" : "no"), (colInx == 2 ? "YES" : "no"),
                                    (isDetPointToTaxon ? "YES" : "no"));
                            log.error(msg);
                            tblWriter.logError(msg);
                        }
                        skipError = true;
                        missingParentTaxonCount++;
                    }
                }

                if (!skip) {
                    if (newID != null) {
                        //System.out.println("newInx["+newInx+"]  newID["+newID+"] oldID["+oldID+"]");
                        pStmtTx.setInt(newInx, newID);

                    } else if (!skipError && !isRoot) {
                        String msg = "Unable to map old TaxonNameID[" + oldID + "]";
                        log.error(msg);
                        tblWriter.logError(msg);
                    }
                }
            } else {
                //log.error("***** Old ID Col ["+colInx+"] was null");
                //skip = true;
            }
            continue;
        }

        switch (colTypes[newInx - 1]) {
        case java.sql.Types.BIT: {
            boolean val = rs.getBoolean(colInx);
            if (!rs.wasNull())
                pStmtTx.setBoolean(newInx, val);
            break;
        }
        case java.sql.Types.INTEGER: {
            int val = rs.getInt(colInx);
            if (!rs.wasNull())
                pStmtTx.setInt(newInx, val);

            //System.out.println("newInx["+colInx+"]  newID["+val+"]");
            break;
        }
        case java.sql.Types.SMALLINT: {
            short val = rs.getShort(colInx);
            if (!rs.wasNull())
                pStmtTx.setShort(newInx, val);
            break;
        }
        case java.sql.Types.TIMESTAMP: {
            Timestamp val = rs.getTimestamp(colInx);
            //if (val == null && oldName.equals("Date"))
            //{
            //    pStmtTx.setTimestamp(newInx, null);
            //} else
            //{
            pStmtTx.setTimestamp(newInx, !rs.wasNull() ? val : null);
            //}
            break;
        }
        case java.sql.Types.LONGVARCHAR:
        case java.sql.Types.VARCHAR: {
            int len = colSizes[newInx - 1];
            String val = rs.getString(colInx);
            if (val != null && val.length() > len) {
                newName = oldToNewColMap.get(oldName);
                String msg = String.format("Concatinating field [%s] from length %d to %d String Lost:[%s]",
                        newName, val.length(), len, val.substring(len));
                log.debug(msg);
                tblWriter.logError(msg);

                val = val.substring(0, len);
            }
            if (!rs.wasNull()) {
                pStmtTx.setString(newInx, val);

            } else if (colInx == 7) {
                pStmtTx.setString(newInx, "Empty");
            }
            break;
        }
        default:
            log.error("Didn't support SQL Type: " + rsmd.getColumnType(colInx));
            break;
        }

    }

    if (!skip) {
        if (parentNodeId != null) {
            int nxtId = BasicSQLUtils.getCountAsInt("SELECT TaxonID FROM taxon ORDER BY TaxonID DESC LIMIT 0,1")
                    + 1;
            pStmtTx.setInt(1, nxtId);
        }

        pStmtTx.setInt(fieldToColHash.get("Version"), 0);
        try {
            //System.out.println("----------------------------------------");
            pStmtTx.execute();

        } catch (Exception ex) {
            ex.printStackTrace();
            UIRegistry.showError(ex.toString());
        }
    }

    return true;
}

From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbPgSql.CFGenKbPgSqlNmTokenFormatterTable.java

protected CFGenKbNmTokenFormatterBuff unpackNmTokenFormatterResultSetToBuff(ResultSet resultSet)
        throws SQLException {
    final String S_ProcName = "unpackNmTokenFormatterResultSetToBuff";
    int idxcol = 1;
    String classCode = resultSet.getString(idxcol);
    idxcol++;/*from   ww  w.  jav a  2 s  .  c  o m*/
    CFGenKbNmTokenFormatterBuff buff;
    if (classCode.equals("FNTK")) {
        buff = schema.getFactoryNmTokenFormatter().newBuff();
    } else {
        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                "Unrecognized class code \"" + classCode + "\"");
    }
    buff.setRequiredTenantId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredCartridgeId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredItemId(resultSet.getInt(idxcol));
    idxcol++;
    buff.setRequiredRuleTypeId(resultSet.getShort(idxcol));
    idxcol++;
    buff.setRequiredName(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredToolSetId(resultSet.getShort(idxcol));
    idxcol++;
    {
        short colVal = resultSet.getShort(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalScopeDefId(null);
        } else {
            buff.setOptionalScopeDefId(colVal);
        }
    }
    idxcol++;
    buff.setRequiredGenDefId(resultSet.getShort(idxcol));
    idxcol++;
    {
        int colVal = resultSet.getInt(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalGelExecutableId(null);
        } else {
            buff.setOptionalGelExecutableId(colVal);
        }
    }
    idxcol++;

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

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

protected CFCrmAddressBuff unpackAddressResultSetToBuff(ResultSet resultSet) throws SQLException {
    final String S_ProcName = "unpackAddressResultSetToBuff";
    int idxcol = 1;
    CFCrmAddressBuff buff = schema.getFactoryAddress().newBuff();
    {/*from   w  w w .  j  a va  2  s. co  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(CFCrmOracleSchema.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(CFCrmOracleSchema.convertTimestampString(colString));
        }
        idxcol++;
    }
    buff.setRequiredTenantId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredAddressId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredContactId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredDescription(resultSet.getString(idxcol));
    idxcol++;
    {
        String colVal = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalAddrLine1(null);
        } else {
            buff.setOptionalAddrLine1(colVal);
        }
    }
    idxcol++;
    {
        String colVal = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalAddrLine2(null);
        } else {
            buff.setOptionalAddrLine2(colVal);
        }
    }
    idxcol++;
    {
        String colVal = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalCity(null);
        } else {
            buff.setOptionalCity(colVal);
        }
    }
    idxcol++;
    {
        String colVal = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalState(null);
        } else {
            buff.setOptionalState(colVal);
        }
    }
    idxcol++;
    {
        short colVal = resultSet.getShort(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalCountryId(null);
        } else {
            buff.setOptionalCountryId(colVal);
        }
    }
    idxcol++;
    {
        String colVal = resultSet.getString(idxcol);
        if (resultSet.wasNull()) {
            buff.setOptionalZip(null);
        } else {
            buff.setOptionalZip(colVal);
        }
    }
    idxcol++;
    buff.setRequiredRevision(resultSet.getInt(idxcol));
    return (buff);
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmSybase.null.java

protected CFCrmISOCountryCurrencyBuff unpackISOCountryCurrencyResultSetToBuff(ResultSet resultSet)
        throws SQLException {
    final String S_ProcName = "unpackISOCountryCurrencyResultSetToBuff";
    int idxcol = 1;
    CFCrmISOCountryCurrencyBuff buff = schema.getFactoryISOCountryCurrency().newBuff();
    {//www.  j  av a 2s . 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(CFCrmSybaseSchema.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(CFCrmSybaseSchema.convertTimestampString(colString));
        }
        idxcol++;
    }
    buff.setRequiredISOCountryId(resultSet.getShort(idxcol));
    idxcol++;
    buff.setRequiredISOCurrencyId(resultSet.getShort(idxcol));
    idxcol++;
    buff.setRequiredRevision(resultSet.getInt(idxcol));
    return (buff);
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmSybase.null.java

protected CFCrmISOCountryLanguageBuff unpackISOCountryLanguageResultSetToBuff(ResultSet resultSet)
        throws SQLException {
    final String S_ProcName = "unpackISOCountryLanguageResultSetToBuff";
    int idxcol = 1;
    CFCrmISOCountryLanguageBuff buff = schema.getFactoryISOCountryLanguage().newBuff();
    {//from ww  w. j av a2  s.co 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(CFCrmSybaseSchema.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(CFCrmSybaseSchema.convertTimestampString(colString));
        }
        idxcol++;
    }
    buff.setRequiredISOCountryId(resultSet.getShort(idxcol));
    idxcol++;
    buff.setRequiredISOLanguageId(resultSet.getShort(idxcol));
    idxcol++;
    buff.setRequiredRevision(resultSet.getInt(idxcol));
    return (buff);
}

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_0.CFFswMSSql.CFFswMSSqlURLProtocolTable.java

protected CFFswURLProtocolBuff unpackURLProtocolResultSetToBuff(ResultSet resultSet) throws SQLException {
    final String S_ProcName = "unpackURLProtocolResultSetToBuff";
    int idxcol = 1;
    CFFswURLProtocolBuff buff = schema.getFactoryURLProtocol().newBuff();
    {/*  w w  w .j av a 2s . c om*/
        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(CFFswMSSqlSchema.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(CFFswMSSqlSchema.convertTimestampString(colString));
        }
        idxcol++;
    }
    buff.setRequiredURLProtocolId(resultSet.getShort(idxcol));
    idxcol++;
    buff.setRequiredName(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredDescription(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredIsSecure(("Y".equals(resultSet.getString(idxcol)) ? true : false));
    idxcol++;
    buff.setRequiredRevision(resultSet.getInt(idxcol));
    return (buff);
}

From source file:net.sourceforge.msscodefactory.cfinternet.v2_0.CFInternetPgSql.CFInternetPgSqlURLProtocolTable.java

protected CFInternetURLProtocolBuff unpackURLProtocolResultSetToBuff(ResultSet resultSet) throws SQLException {
    final String S_ProcName = "unpackURLProtocolResultSetToBuff";
    int idxcol = 1;
    CFInternetURLProtocolBuff buff = schema.getFactoryURLProtocol().newBuff();
    {//from   www  .  ja  v  a2s . co 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(CFInternetPgSqlSchema.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(CFInternetPgSqlSchema.convertTimestampString(colString));
        }
        idxcol++;
    }
    buff.setRequiredURLProtocolId(resultSet.getShort(idxcol));
    idxcol++;
    buff.setRequiredName(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredDescription(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredIsSecure(resultSet.getBoolean(idxcol));
    idxcol++;

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

From source file:net.sourceforge.msscodefactory.cfinternet.v2_0.CFInternetXMsgClient.CFInternetXMsgClientSchema.java

public static Short getNullableInt16(ResultSet reader, int colidx) {
    try {// www  .j av a 2  s. c  om
        short val = reader.getShort(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Short(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFInternetXMsgClientSchema.class,
                "getNullableInt64", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetDb2LUW.CFInternetDb2LUWAuditActionTable.java

protected CFInternetAuditActionBuff unpackAuditActionResultSetToBuff(ResultSet resultSet) throws SQLException {
    final String S_ProcName = "unpackAuditActionResultSetToBuff";
    int idxcol = 1;
    CFInternetAuditActionBuff buff = schema.getFactoryAuditAction().newBuff();
    buff.setRequiredAuditActionId(resultSet.getShort(idxcol));
    idxcol++;/*from  w w w .j  a v a  2s .com*/
    buff.setRequiredDescription(resultSet.getString(idxcol));
    idxcol++;

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