List of usage examples for java.sql ResultSet getBigDecimal
BigDecimal getBigDecimal(String columnLabel) throws SQLException;
ResultSet
object as a java.math.BigDecimal
with full precision. From source file:edu.ku.brc.specify.dbsupport.cleanuptools.GeoCleanupFuzzySearch.java
/** * Builds the Geography tree from the geonames table. * @param earthId the id of the root.// w w w.ja v a 2 s . com * @return true on success */ private boolean buildLuceneIndex(final int earthId) { boolean isOK = true; boolean doCloseIndexer = true; Statement stmt = null; try { //connectToDB(); stmt = readConn.createStatement(); int cnt; initLuceneForIndexing(true); ////////////////////// // Continent ////////////////////// cnt = 0; String cntSQL = "SELECT COUNT(*) "; int totCnt = getCountAsInt(cntSQL + "FROM continentcodes"); if (frame != null) frame.setProcess(0, totCnt); String sqlStr = "SELECT geonameId, name, code from continentcodes"; ResultSet rs = stmt.executeQuery(sqlStr); while (rs.next() && isOK) { isOK = addDoc(rs.getInt(1), rs.getString(2), "", "", "", 100, rs.getString(3), "", ""); cnt++; if (frame != null) frame.setProcess(cnt); } rs.close(); if (!isOK) return false; ////////////////////// // Create an Countries that referenced in the geoname table ////////////////////// /*cnt = 0; post = "FROM countryinfo ORDER BY continent, iso_alpha2"; totCnt = getCountAsInt(cntSQL + post); inc = totCnt / 20; rs = stmt.executeQuery("SELECT geonameId, name, iso_alpha2, continent " + post); while (rs.next() && isOK) { int geonameId = rs.getInt(1); String countryName = rs.getString(2); String countryCode = rs.getString(3); //log.debug("1 Adding country["+countryName+"] "+countryCode); isOK = addDoc(geonameId, countryName, countryName, null, null, 200, countryCode, countryCode); if (frame != null && cnt % inc == 0) frame.setProcess(cnt); } rs.close();*/ // Now create all the countries in the geoname table cnt = 0; String post = "FROM countryinfo c INNER JOIN geoname g ON g.geonameId = c.geonameId"; totCnt = getCountAsInt(cntSQL + post); int inc = totCnt / 20; if (frame != null) frame.setProcess(0, 100); sqlStr = "SELECT c.geonameId, c.Name, Latitude, Longitude, iso_alpha2, iso_alpha3, alternatenames " + post; //System.out.println(sqlStr); rs = stmt.executeQuery(sqlStr); while (rs.next() && isOK) { String countryCode = rs.getString(5); if (stCntXRef.countryCodeToName(countryCode) == null) { log.error("Error - Unknown country code[" + countryCode + "]"); } isOK = buildDoc(rs, 200, earthId); cnt++; if (frame != null && (cnt % inc) == 0) frame.setProcess(cnt / 20); } rs.close(); if (!isOK) return false; setProgressDesc("Preparing States..."); // I18N ////////////////////// // States ////////////////////// cnt = 0; post = "FROM geoname WHERE asciiname IS NOT NULL AND LENGTH(asciiname) > 0 AND fcode = 'ADM1' ORDER BY asciiname"; totCnt = getCountAsInt(cntSQL + post); inc = totCnt / 20; if (frame != null) frame.setProcess(0, 100); sqlStr = "SELECT geonameId, asciiname, latitude, longitude, country, admin1, ISOCode, alternatenames "; rs = stmt.executeQuery(sqlStr + post); while (rs.next()) { isOK = buildDoc(rs, 300, earthId); cnt++; if (frame != null && cnt % inc == 0) frame.setProcess(cnt / 20); } rs.close(); if (!isOK) return false; setProgressDesc("Preparing Counties..."); // I18N ////////////////////// // County ////////////////////// cnt = 0; post = "FROM geoname WHERE fcode = 'ADM2' ORDER BY asciiname"; totCnt = getCountAsInt(cntSQL + post); inc = totCnt / 20; if (frame != null) frame.setProcess(0, 100); sqlStr = "SELECT geonameId, asciiname, latitude, longitude, country, admin1, admin2, ISOCode, alternatenames "; rs = stmt.executeQuery(sqlStr + post); while (rs.next() && isOK) { rowData.clear(); rowData.add((Integer) rs.getInt(1)); // (0) rowData.add(rs.getString(2)); // (1) rowData.add(rs.getBigDecimal(3)); // Lat (2) rowData.add(rs.getBigDecimal(4)); // Lon (3) rowData.add(rs.getString(5)); // CountryCode (4) rowData.add(rs.getString(6)); // StateCode (5) rowData.add(rs.getString(7)); // CountyCode (6) rowData.add(rs.getString(8)); // ISOCode (7) isOK = buildDocInsert(rowData, 400, earthId); cnt++; if (frame != null && cnt % inc == 0) frame.setProcess(cnt / 20); } rs.close(); if (!isOK) return false; doneIndexing(); doCloseIndexer = false; return true; } catch (Exception ex) { ex.printStackTrace(); edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(GeographyAssignISOs.class, ex); } finally { if (!isOK) { showError("There was an error indexing geographies."); } if (doCloseIndexer) { try { if (stmt != null) stmt.close(); } catch (Exception ex) { } } } return false; }
From source file:org.apache.openjpa.jdbc.sql.DBDictionary.java
/** * Convert the specified column of the SQL ResultSet to the proper * java type./* w w w . ja v a2s . co m*/ */ public BigDecimal getBigDecimal(ResultSet rs, int column) throws SQLException { if (storeLargeNumbersAsStrings) { String str = getString(rs, column); return (str == null) ? null : new BigDecimal(str); } return rs.getBigDecimal(column); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWAccountEntryTable.java
protected CFAccAccountEntryBuff unpackAccountEntryResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackAccountEntryResultSetToBuff"; int idxcol = 1; CFAccAccountEntryBuff buff = schema.getFactoryAccountEntry().newBuff(); {// w ww. j a v a2s . com 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(CFAccDb2LUWSchema.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(CFAccDb2LUWSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredTenantId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredAccountId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredEntryId(CFAccDb2LUWSchema.convertUuidString(resultSet.getString(idxcol))); idxcol++; { UUID colVal = CFAccDb2LUWSchema.convertUuidString(resultSet.getString(idxcol)); if (resultSet.wasNull()) { buff.setOptionalSplitEntryId(null); } else { buff.setOptionalSplitEntryId(colVal); } } idxcol++; buff.setRequiredEntryStamp(CFAccDb2LUWSchema.convertTimestampString(resultSet.getString(idxcol))); idxcol++; buff.setRequiredDescription(resultSet.getString(idxcol)); idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalTransferTenantId(null); } else { buff.setOptionalTransferTenantId(colVal); } } idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalTransferAccountId(null); } else { buff.setOptionalTransferAccountId(colVal); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalDebitCurrencyId(null); } else { buff.setOptionalDebitCurrencyId(colVal); } } idxcol++; { BigDecimal bival = resultSet.getBigDecimal(idxcol); if (resultSet.wasNull()) { buff.setOptionalDebit(null); } else { buff.setOptionalDebit(bival); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalCreditCurrencyId(null); } else { buff.setOptionalCreditCurrencyId(colVal); } } idxcol++; { BigDecimal bival = resultSet.getBigDecimal(idxcol); if (resultSet.wasNull()) { buff.setOptionalCredit(null); } else { buff.setOptionalCredit(bival); } } idxcol++; buff.setRequiredConvertedCurrencyId(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredConvertedAmount(resultSet.getBigDecimal(idxcol)); idxcol++; buff.setRequiredBalanceCurrencyId(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredBalance(resultSet.getBigDecimal(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccPgSql.CFAccPgSqlAccountEntryTable.java
protected CFAccAccountEntryBuff unpackAccountEntryResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackAccountEntryResultSetToBuff"; int idxcol = 1; CFAccAccountEntryBuff buff = schema.getFactoryAccountEntry().newBuff(); {/*from w w w . j a v a 2 s. 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(CFAccPgSqlSchema.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(CFAccPgSqlSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredTenantId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredAccountId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredEntryId(CFAccPgSqlSchema.convertUuidString(resultSet.getString(idxcol))); idxcol++; { UUID colVal = CFAccPgSqlSchema.convertUuidString(resultSet.getString(idxcol)); if (resultSet.wasNull()) { buff.setOptionalSplitEntryId(null); } else { buff.setOptionalSplitEntryId(colVal); } } idxcol++; buff.setRequiredEntryStamp(CFAccPgSqlSchema.convertTimestampString(resultSet.getString(idxcol))); idxcol++; buff.setRequiredDescription(resultSet.getString(idxcol)); idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalTransferTenantId(null); } else { buff.setOptionalTransferTenantId(colVal); } } idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalTransferAccountId(null); } else { buff.setOptionalTransferAccountId(colVal); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalDebitCurrencyId(null); } else { buff.setOptionalDebitCurrencyId(colVal); } } idxcol++; { BigDecimal bival = resultSet.getBigDecimal(idxcol); if (resultSet.wasNull()) { buff.setOptionalDebit(null); } else { buff.setOptionalDebit(bival); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalCreditCurrencyId(null); } else { buff.setOptionalCreditCurrencyId(colVal); } } idxcol++; { BigDecimal bival = resultSet.getBigDecimal(idxcol); if (resultSet.wasNull()) { buff.setOptionalCredit(null); } else { buff.setOptionalCredit(bival); } } idxcol++; buff.setRequiredConvertedCurrencyId(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredConvertedAmount(resultSet.getBigDecimal(idxcol)); idxcol++; buff.setRequiredBalanceCurrencyId(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredBalance(resultSet.getBigDecimal(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMySql.CFAccMySqlAccountEntryTable.java
protected CFAccAccountEntryBuff unpackAccountEntryResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackAccountEntryResultSetToBuff"; int idxcol = 1; CFAccAccountEntryBuff buff = schema.getFactoryAccountEntry().newBuff(); {//from w w w . ja v a 2 s .com String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedAt(null); } else { buff.setCreatedAt(CFAccMySqlSchema.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(CFAccMySqlSchema.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.setRequiredAccountId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredEntryId(CFAccMySqlSchema.convertUuidString(resultSet.getString(idxcol))); idxcol++; { UUID colVal = CFAccMySqlSchema.convertUuidString(resultSet.getString(idxcol)); if (resultSet.wasNull()) { buff.setOptionalSplitEntryId(null); } else { buff.setOptionalSplitEntryId(colVal); } } idxcol++; buff.setRequiredEntryStamp(CFAccMySqlSchema.convertTimestampString(resultSet.getString(idxcol))); idxcol++; buff.setRequiredDescription(resultSet.getString(idxcol)); idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalTransferTenantId(null); } else { buff.setOptionalTransferTenantId(colVal); } } idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalTransferAccountId(null); } else { buff.setOptionalTransferAccountId(colVal); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalDebitCurrencyId(null); } else { buff.setOptionalDebitCurrencyId(colVal); } } idxcol++; { BigDecimal bival = resultSet.getBigDecimal(idxcol); if (resultSet.wasNull()) { buff.setOptionalDebit(null); } else { buff.setOptionalDebit(bival); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalCreditCurrencyId(null); } else { buff.setOptionalCreditCurrencyId(colVal); } } idxcol++; { BigDecimal bival = resultSet.getBigDecimal(idxcol); if (resultSet.wasNull()) { buff.setOptionalCredit(null); } else { buff.setOptionalCredit(bival); } } idxcol++; buff.setRequiredConvertedCurrencyId(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredConvertedAmount(resultSet.getBigDecimal(idxcol)); idxcol++; buff.setRequiredBalanceCurrencyId(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredBalance(resultSet.getBigDecimal(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMSSql.CFAccMSSqlAccountEntryTable.java
protected CFAccAccountEntryBuff unpackAccountEntryResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackAccountEntryResultSetToBuff"; int idxcol = 1; CFAccAccountEntryBuff buff = schema.getFactoryAccountEntry().newBuff(); {// w w w. jav a 2 s. 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(CFAccMSSqlSchema.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(CFAccMSSqlSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredTenantId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredAccountId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredEntryId(CFAccMSSqlSchema.convertUuidString(resultSet.getString(idxcol))); idxcol++; { UUID colVal = CFAccMSSqlSchema.convertUuidString(resultSet.getString(idxcol)); if (resultSet.wasNull()) { buff.setOptionalSplitEntryId(null); } else { buff.setOptionalSplitEntryId(colVal); } } idxcol++; buff.setRequiredEntryStamp(CFAccMSSqlSchema.convertTimestampString(resultSet.getString(idxcol))); idxcol++; buff.setRequiredDescription(resultSet.getString(idxcol)); idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalTransferTenantId(null); } else { buff.setOptionalTransferTenantId(colVal); } } idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalTransferAccountId(null); } else { buff.setOptionalTransferAccountId(colVal); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalDebitCurrencyId(null); } else { buff.setOptionalDebitCurrencyId(colVal); } } idxcol++; { BigDecimal bival = resultSet.getBigDecimal(idxcol); if (resultSet.wasNull()) { buff.setOptionalDebit(null); } else { buff.setOptionalDebit(bival); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalCreditCurrencyId(null); } else { buff.setOptionalCreditCurrencyId(colVal); } } idxcol++; { BigDecimal bival = resultSet.getBigDecimal(idxcol); if (resultSet.wasNull()) { buff.setOptionalCredit(null); } else { buff.setOptionalCredit(bival); } } idxcol++; buff.setRequiredConvertedCurrencyId(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredConvertedAmount(resultSet.getBigDecimal(idxcol)); idxcol++; buff.setRequiredBalanceCurrencyId(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredBalance(resultSet.getBigDecimal(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
From source file:com.github.woonsan.jdbc.jcr.impl.JcrJdbcResultSetTest.java
@SuppressWarnings("deprecation") @Test/*from w w w . j ava2s. co m*/ public void testResultSetWhenClosed() throws Exception { Statement statement = getConnection().createStatement(); ResultSet rs = statement.executeQuery(SQL_EMPS); rs.close(); try { rs.isBeforeFirst(); fail(); } catch (SQLException ignore) { } try { rs.isAfterLast(); fail(); } catch (SQLException ignore) { } try { rs.isFirst(); fail(); } catch (SQLException ignore) { } try { rs.isLast(); fail(); } catch (SQLException ignore) { } try { rs.beforeFirst(); fail(); } catch (SQLException ignore) { } try { rs.afterLast(); fail(); } catch (SQLException ignore) { } try { rs.first(); fail(); } catch (SQLException ignore) { } try { rs.last(); fail(); } catch (SQLException ignore) { } try { rs.next(); fail(); } catch (SQLException ignore) { } try { rs.getRow(); fail(); } catch (SQLException ignore) { } try { rs.getType(); fail(); } catch (SQLException ignore) { } try { rs.getConcurrency(); fail(); } catch (SQLException ignore) { } try { rs.rowUpdated(); fail(); } catch (SQLException ignore) { } try { rs.rowDeleted(); fail(); } catch (SQLException ignore) { } try { rs.rowInserted(); fail(); } catch (SQLException ignore) { } try { rs.getStatement(); fail(); } catch (SQLException ignore) { } try { rs.wasNull(); fail(); } catch (SQLException ignore) { } try { rs.getString(1); fail(); } catch (SQLException ignore) { } try { rs.getString("col1"); fail(); } catch (SQLException ignore) { } try { rs.getBoolean(1); fail(); } catch (SQLException ignore) { } try { rs.getBoolean("col1"); fail(); } catch (SQLException ignore) { } try { rs.getByte(1); fail(); } catch (SQLException ignore) { } try { rs.getByte("col1"); fail(); } catch (SQLException ignore) { } try { rs.getShort(1); fail(); } catch (SQLException ignore) { } try { rs.getShort("col1"); fail(); } catch (SQLException ignore) { } try { rs.getInt(1); fail(); } catch (SQLException ignore) { } try { rs.getInt("col1"); fail(); } catch (SQLException ignore) { } try { rs.getLong(1); fail(); } catch (SQLException ignore) { } try { rs.getLong("col1"); fail(); } catch (SQLException ignore) { } try { rs.getFloat(1); fail(); } catch (SQLException ignore) { } try { rs.getFloat("col1"); fail(); } catch (SQLException ignore) { } try { rs.getDouble(1); fail(); } catch (SQLException ignore) { } try { rs.getDouble("col1"); fail(); } catch (SQLException ignore) { } try { rs.getBigDecimal(1); fail(); } catch (SQLException ignore) { } try { rs.getBigDecimal("col1"); fail(); } catch (SQLException ignore) { } try { rs.getBytes(1); fail(); } catch (SQLException ignore) { } try { rs.getBytes("col1"); fail(); } catch (SQLException ignore) { } try { rs.getDate(1); fail(); } catch (SQLException ignore) { } try { rs.getDate(1, null); fail(); } catch (SQLException ignore) { } try { rs.getDate("col1"); fail(); } catch (SQLException ignore) { } try { rs.getDate("col1", null); fail(); } catch (SQLException ignore) { } try { rs.getTime(1); fail(); } catch (SQLException ignore) { } try { rs.getTime(1, null); fail(); } catch (SQLException ignore) { } try { rs.getTime("col1"); fail(); } catch (SQLException ignore) { } try { rs.getTime("col1", null); fail(); } catch (SQLException ignore) { } try { rs.getTimestamp(1); fail(); } catch (SQLException ignore) { } try { rs.getTimestamp(1, null); fail(); } catch (SQLException ignore) { } try { rs.getTimestamp("col1"); fail(); } catch (SQLException ignore) { } try { rs.getTimestamp("col1", null); fail(); } catch (SQLException ignore) { } try { rs.getAsciiStream(1); fail(); } catch (SQLException ignore) { } try { rs.getAsciiStream("col1"); fail(); } catch (SQLException ignore) { } try { rs.getUnicodeStream(1); fail(); } catch (SQLException ignore) { } try { rs.getUnicodeStream("col1"); fail(); } catch (SQLException ignore) { } try { rs.getBinaryStream(1); fail(); } catch (SQLException ignore) { } try { rs.getBinaryStream("col1"); fail(); } catch (SQLException ignore) { } try { rs.getCharacterStream(1); fail(); } catch (SQLException ignore) { } try { rs.getCharacterStream("col1"); fail(); } catch (SQLException ignore) { } try { rs.getMetaData(); fail(); } catch (SQLException ignore) { } try { rs.setFetchDirection(1); fail(); } catch (SQLException ignore) { } try { rs.getFetchDirection(); fail(); } catch (SQLException ignore) { } try { rs.setFetchSize(100); fail(); } catch (SQLException ignore) { } try { rs.getFetchSize(); fail(); } catch (SQLException ignore) { } try { rs.getHoldability(); fail(); } catch (SQLException ignore) { } statement.close(); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleAccountEntryTable.java
protected CFAccAccountEntryBuff unpackAccountEntryResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackAccountEntryResultSetToBuff"; int idxcol = 1; CFAccAccountEntryBuff buff = schema.getFactoryAccountEntry().newBuff(); {// w w w . j av a2 s.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(CFAccOracleSchema.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(CFAccOracleSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredTenantId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredAccountId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredEntryId(CFAccOracleSchema.convertUuidString(resultSet.getString(idxcol))); idxcol++; { UUID colVal = CFAccOracleSchema.convertUuidString(resultSet.getString(idxcol)); if (resultSet.wasNull()) { buff.setOptionalSplitEntryId(null); } else { buff.setOptionalSplitEntryId(colVal); } } idxcol++; buff.setRequiredEntryStamp(CFAccOracleSchema.convertTimestampString(resultSet.getString(idxcol))); idxcol++; buff.setRequiredDescription(resultSet.getString(idxcol)); idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalTransferTenantId(null); } else { buff.setOptionalTransferTenantId(colVal); } } idxcol++; { long colVal = resultSet.getLong(idxcol); if (resultSet.wasNull()) { buff.setOptionalTransferAccountId(null); } else { buff.setOptionalTransferAccountId(colVal); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalDebitCurrencyId(null); } else { buff.setOptionalDebitCurrencyId(colVal); } } idxcol++; { BigDecimal bival = resultSet.getBigDecimal(idxcol); if (resultSet.wasNull()) { buff.setOptionalDebit(null); } else { buff.setOptionalDebit(bival); } } idxcol++; { short colVal = resultSet.getShort(idxcol); if (resultSet.wasNull()) { buff.setOptionalCreditCurrencyId(null); } else { buff.setOptionalCreditCurrencyId(colVal); } } idxcol++; { BigDecimal bival = resultSet.getBigDecimal(idxcol); if (resultSet.wasNull()) { buff.setOptionalCredit(null); } else { buff.setOptionalCredit(bival); } } idxcol++; buff.setRequiredConvertedCurrencyId(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredConvertedAmount(resultSet.getBigDecimal(idxcol)); idxcol++; buff.setRequiredBalanceCurrencyId(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredBalance(resultSet.getBigDecimal(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
From source file:pagecode.RPTs.OffenceUtil.java
private void processOffenceInfoOld() { logger.info("In OffenceUtil::processOffenceInfoOld"); String selectSql = null;//from w ww . j a va2 s. c o m Connection iicfConnection = ReportsConnectionManager.getIICFConnection(); PreparedStatement preparedStatement = null; ResultSet resultSet = null; if (null != iicfConnection && true == isOffenceNumberValid()) { try { String dbLetterPrefix; //If Offence is Red Light Camera or parking tickets then use //the "P" database [The photo radar DB] in IMS i.e. "P" tables in IICF if ("997".equals(jurisdictionNumber) || "901".equals(jurisdictionNumber)) { dbLetterPrefix = "P"; } else { dbLetterPrefix = "O"; } selectSql = "SELECT " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_CRT_OFC AS OFCS_CRT_OFC, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_JRSDCTN_NUM AS OFCS_JRSDCTN_NUM, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_INFO_YY AS OFCS_INFO_YY, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_INFO_PREFIX AS OFCS_INFO_PREFIX, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_INFO_SUFFIX AS OFCS_INFO_SUFFIX, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_TRL_LANG_CD AS OFCS_TRL_LANG_CD, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_INTERP_LANG_CD AS OFCS_INTERP_LANG_CD, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "CNT." + dbLetterPrefix + "CNT_CNT_NUM AS OCNT_CNT_NUM, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "CNT." + dbLetterPrefix + "CNT_OFNC_DT AS OCNT_OFNC_DT, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_OFCR_BDG_NUM AS OFCS_OFCR_BDG_NUM, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_LIC_PLATE_NUM AS OFCS_LIC_PLATE_NUM, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_DRVR_LIC_PART_1 AS OFCS_DRVR_LIC_PART_1, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_DRVR_LIC_PART_2 AS OFCS_DRVR_LIC_PART_2, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_DRVR_LIC_PART_3 AS OFCS_DRVR_LIC_PART_3, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_ENF_AGCY AS OFCS_ENF_AGCY, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_SEX_CD AS OFCS_SEX_CD, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_BRTH_DT AS OFCS_BRTH_DT, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "CNT." + dbLetterPrefix + "CNT_CVOR_NUM AS OCNT_CVOR_NUM, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_ENF_AGCY_DIV_CD AS OFCS_ENF_AGCY_DIV_CD, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_GVN_NM AS OFCS_GVN_NM, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_INIT AS OFCS_INIT, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_SRNM AS OFCS_SRNM, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_ADDR_ST AS OFCS_ADDR_ST, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_ADDR_CTY AS OFCS_ADDR_CTY, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_ADDR_PROV AS OFCS_ADDR_PROV, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_ADDR_PSTL_CD AS OFCS_ADDR_PSTL_CD, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "CNT." + dbLetterPrefix + "CNT_TM AS OCNT_TM, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "CNT." + dbLetterPrefix + "CNT_LOCN_DESC AS OCNT_LOCN_DESC, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "CNT." + dbLetterPrefix + "CNT_STATU_CD AS OCNT_STATU_CD, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "CNT." + dbLetterPrefix + "CNT_SCTN_ID AS OCNT_SCTN_ID, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "CNT." + dbLetterPrefix + "CNT_SUB_SCTN_ID AS OCNT_SUB_SCTN_ID, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "CNT." + dbLetterPrefix + "CNT_PARA_ID AS OCNT_PARA_ID, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "CNT." + dbLetterPrefix + "CNT_OFNC_CLAS_ID AS OCNT_OFNC_CLAS_ID, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "CNT." + dbLetterPrefix + "CNT_BYLAW_CD AS OCNT_BYLAW_CD " + "FROM " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "CNT " + "WHERE " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "CNT." + dbLetterPrefix + "CNT_CNT_NUM = '0001' " + " AND " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_CRT_OFC = '" + courtOfficeId + "' " + " AND " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_JRSDCTN_NUM = '" + jurisdictionNumber + "' " + " AND " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_INFO_YY = '" + infoYear + "' " + " AND " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_INFO_PREFIX = '" + infoPrefix + "' " + " AND " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_INFO_SUFFIX = '" + infoSuffix + "' " + " " + " AND " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "CNT." + dbLetterPrefix + "FCS_CRT_OFC = '" + courtOfficeId + "' " + " AND " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "CNT." + dbLetterPrefix + "FCS_JRSDCTN_NUM = '" + jurisdictionNumber + "' " + " AND " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "CNT." + dbLetterPrefix + "FCS_INFO_YY = '" + infoYear + "' " + " AND " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "CNT." + dbLetterPrefix + "FCS_INFO_PREFIX = '" + infoPrefix + "' " + " AND " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "CNT." + dbLetterPrefix + "FCS_INFO_SUFFIX = '" + infoSuffix + "' "; selectSql += " "; logger.info("+++++SQL: " + selectSql); //TODO remove this if (true) { //return; } preparedStatement = iicfConnection.prepareStatement(selectSql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); resultSet = preparedStatement.executeQuery(); resultSet.last(); int resultSetCount = resultSet.getRow(); logger.info("resultSetCount: " + resultSetCount); resultSet.beforeFirst(); if (resultSetCount != 1) { throw new Exception("Offence NOT found or MORE than one found!!!"); } else { //move to first record resultSet.next(); paramOffenceNumber = ""; if (null != resultSet.getString("OFCS_CRT_OFC")) { paramOffenceNumber = resultSet.getString("OFCS_CRT_OFC").trim() + " "; } if (null != resultSet.getString("OFCS_JRSDCTN_NUM")) { paramOffenceNumber += resultSet.getString("OFCS_JRSDCTN_NUM").trim() + " "; } if (null != resultSet.getString("OFCS_INFO_YY")) { paramOffenceNumber += resultSet.getString("OFCS_INFO_YY").trim() + " "; } if (null != resultSet.getString("OFCS_INFO_PREFIX")) { paramOffenceNumber += resultSet.getString("OFCS_INFO_PREFIX").trim() + " "; } if (null != resultSet.getString("OFCS_INFO_SUFFIX")) { paramOffenceNumber += resultSet.getString("OFCS_INFO_SUFFIX").trim(); } if (null != resultSet.getString("OFCS_TRL_LANG_CD")) { String langChar = resultSet.getString("OFCS_TRL_LANG_CD").trim(); isEnglish = (true == langChar.equalsIgnoreCase("F") ? false : true); } //NOTE: if runAsStandAlone == true then assume it is always French if (true == runAsStandAlone) { this.isEnglish = false; } paramInterpreterLanguage = ""; if (null != resultSet.getString("OFCS_INTERP_LANG_CD") && !resultSet.getString("OFCS_INTERP_LANG_CD").trim().equals("")) { paramInterpreterLanguage = resultSet.getString("OFCS_INTERP_LANG_CD").trim(); InterpreterLanguageUtil interpreterLanguageUtil = new InterpreterLanguageUtil(); interpreterLanguageUtil.setIsEnglish(this.isEnglish()); interpreterLanguageUtil.setInterpreterLanguageUtil(paramInterpreterLanguage); paramInterpreterLanguage = interpreterLanguageUtil.getInterpreterLanguageDesc(); } IconDateUtil offenceDateUtil = new IconDateUtil(); offenceDateUtil.setIsEnglish(this.isEnglish); paramOffenceDate = ""; if (null != resultSet.getString("OCNT_OFNC_DT")) { offenceDateUtil.setIconDate(resultSet.getString("OCNT_OFNC_DT").trim()); paramOffenceDate = offenceDateUtil.getDateWithSlashes(); } paramOfficerNumber = ""; if (null != resultSet.getString("OFCS_OFCR_BDG_NUM")) { paramOfficerNumber = resultSet.getString("OFCS_OFCR_BDG_NUM").trim(); } paramDriversLicenseNumber = ""; if (null != resultSet.getString("OFCS_DRVR_LIC_PART_1") && null != resultSet.getString("OFCS_DRVR_LIC_PART_2") && null != resultSet.getString("OFCS_DRVR_LIC_PART_1")) { paramDriversLicenseNumber = resultSet.getString("OFCS_DRVR_LIC_PART_1").trim() + "-" + resultSet.getString("OFCS_DRVR_LIC_PART_2").trim() + "-" + resultSet.getString("OFCS_DRVR_LIC_PART_3").trim(); } paramPlateNumber = ""; if (null != resultSet.getString("OFCS_LIC_PLATE_NUM")) { paramPlateNumber = resultSet.getString("OFCS_LIC_PLATE_NUM").trim(); } paramEnforcementAgency = ""; if (null != resultSet.getString("OFCS_ENF_AGCY")) { paramEnforcementAgency = resultSet.getString("OFCS_ENF_AGCY").trim(); } paramSex = ""; if (null != resultSet.getString("OFCS_SEX_CD")) { paramSex = resultSet.getString("OFCS_SEX_CD").trim(); } paramDateOfBirth = ""; IconDateUtil dateOfBirthUtil = new IconDateUtil(); if (null != resultSet.getString("OFCS_BRTH_DT")) { dateOfBirthUtil.setIconDate(resultSet.getString("OFCS_BRTH_DT").trim()); paramDateOfBirth = dateOfBirthUtil.getDateWithSlashes(); } paramCVOR = ""; if (null != resultSet.getString("OCNT_CVOR_NUM")) { paramCVOR = resultSet.getString("OCNT_CVOR_NUM").trim(); } paramUnit = ""; if (null != resultSet.getString("OFCS_ENF_AGCY_DIV_CD")) { paramUnit = resultSet.getString("OFCS_ENF_AGCY_DIV_CD").trim(); } paramOffenderFullName = ""; if (null != resultSet.getString("OFCS_GVN_NM")) { paramOffenderFullName = resultSet.getString("OFCS_GVN_NM").trim() + " "; } if (null != resultSet.getString("OFCS_INIT")) { paramOffenderFullName += resultSet.getString("OFCS_INIT").trim() + " "; } if (null != resultSet.getString("OFCS_SRNM")) { paramOffenderFullName += resultSet.getString("OFCS_SRNM").trim(); } paramAddressLine1 = ""; if (null != resultSet.getString("OFCS_ADDR_ST")) { paramAddressLine1 = resultSet.getString("OFCS_ADDR_ST").trim(); } paramAddressLine2 = ""; if (null != resultSet.getString("OFCS_ADDR_CTY")) { paramAddressLine2 = resultSet.getString("OFCS_ADDR_CTY").trim(); } if (null != resultSet.getString("OFCS_ADDR_PROV")) { paramAddressLine2 += ", " + resultSet.getString("OFCS_ADDR_PROV").trim(); } if (null != resultSet.getString("OFCS_ADDR_PSTL_CD")) { paramAddressLine3 = resultSet.getString("OFCS_ADDR_PSTL_CD").trim(); } paramOffenceDay = paramOffenceMonth = paramOffenceYear = ""; if (null != resultSet.getString("OCNT_OFNC_DT")) { offenceDateUtil.setIconDate(resultSet.getString("OCNT_OFNC_DT").trim()); paramOffenceDay = offenceDateUtil.getStrDay(); paramOffenceMonth = offenceDateUtil.getStrMonth(); paramOffenceYear = offenceDateUtil.getStrYear(); } //offenceDateUtil = iconDateUtil; paramOffenceTime = ""; if (null != resultSet.getString("OCNT_TM")) { offenceDateUtil.setIconTime(resultSet.getString("OCNT_TM").trim()); paramOffenceTime = offenceDateUtil.getFormatedTime(); } paramOffenceLocation = ""; if (null != resultSet.getString("OCNT_LOCN_DESC")) { paramOffenceLocation = resultSet.getString("OCNT_LOCN_DESC").trim(); } String tempOCNT_STATU_CD, tempOCNT_SCTN_ID, tempOCNT_SUB_SCTN_ID, tempOCNT_PARA_ID, tempOCNT_OFNC_CLAS_ID, tempOCNT_BYLAW_CD; tempOCNT_STATU_CD = ""; if (null != resultSet.getString("OCNT_STATU_CD")) { tempOCNT_STATU_CD = resultSet.getString("OCNT_STATU_CD").trim(); } tempOCNT_SCTN_ID = ""; if (null != resultSet.getString("OCNT_SCTN_ID")) { tempOCNT_SCTN_ID = resultSet.getString("OCNT_SCTN_ID").trim(); } tempOCNT_SUB_SCTN_ID = null; if (null != resultSet.getString("OCNT_SUB_SCTN_ID")) { tempOCNT_SUB_SCTN_ID = resultSet.getString("OCNT_SUB_SCTN_ID").trim(); } tempOCNT_PARA_ID = null; if (null != resultSet.getString("OCNT_PARA_ID")) { tempOCNT_PARA_ID = resultSet.getString("OCNT_PARA_ID").trim(); } tempOCNT_OFNC_CLAS_ID = null; if (null != resultSet.getString("OCNT_OFNC_CLAS_ID")) { tempOCNT_OFNC_CLAS_ID = resultSet.getString("OCNT_OFNC_CLAS_ID").trim(); } tempOCNT_BYLAW_CD = null; if (null != resultSet.getString("OCNT_BYLAW_CD")) { tempOCNT_BYLAW_CD = resultSet.getString("OCNT_BYLAW_CD").trim(); } OffenceStatuteDescriptionUtil offenceStatuteDescriptionUtil = new OffenceStatuteDescriptionUtil(); offenceStatuteDescriptionUtil.setIsEnglish(this.isEnglish); offenceStatuteDescriptionUtil.setOffenceStatuteDescriptionUtil(tempOCNT_STATU_CD, tempOCNT_SCTN_ID, tempOCNT_SUB_SCTN_ID, tempOCNT_PARA_ID, tempOCNT_OFNC_CLAS_ID, tempOCNT_BYLAW_CD, offenceDateUtil); paramOffenceDesc = offenceStatuteDescriptionUtil.getOffenceDescription(); paramOffenceStatue = offenceStatuteDescriptionUtil.getStatuteDescription(); paramOffenceSection = tempOCNT_SCTN_ID; if (null != tempOCNT_SUB_SCTN_ID && !tempOCNT_SUB_SCTN_ID.equals("")) { paramOffenceSection += "(" + tempOCNT_SUB_SCTN_ID + ")"; } if (null != tempOCNT_PARA_ID && !tempOCNT_PARA_ID.equals("")) { paramOffenceSection += "(" + tempOCNT_PARA_ID + ")"; } if (null != tempOCNT_OFNC_CLAS_ID && !tempOCNT_OFNC_CLAS_ID.equals("")) { paramOffenceSection += "(" + tempOCNT_OFNC_CLAS_ID + ")"; } //clean up for reuse if (null != preparedStatement) { preparedStatement.close(); preparedStatement = null; } if (null != resultSet) { resultSet.close(); resultSet = null; } selectSql = "SELECT " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_CRT_OFC AS OFCS_CRT_OFC, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_JRSDCTN_NUM AS OFCS_JRSDCTN_NUM, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_INFO_YY AS OFCS_INFO_YY, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_INFO_PREFIX AS OFCS_INFO_PREFIX, " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_INFO_SUFFIX AS OFCS_INFO_SUFFIX, " + " " + ICON_SCHEMA_NAME + ".ICOSARRT.ARRT_TTL_FINE_AMT, " + " " + ICON_SCHEMA_NAME + ".ICOSARRT.ARRT_PRE_PD_FINE_TTL_AMT, " + " " + ICON_SCHEMA_NAME + ".ICOSARRT.ARRT_PRE_PD_COST_TTL_AMT " + "FROM " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS " + "INNER JOIN " + " " + ICON_SCHEMA_NAME + ".ICOSARRT " + " ON " + " ( " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_CRT_OFC = " + ICON_SCHEMA_NAME + ".ICOSARRT.ARRT_CRT_OFC" + " ) " + " AND " + " ( " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_JRSDCTN_NUM = " + ICON_SCHEMA_NAME + ".ICOSARRT.ARRT_JRSDCTN_NUM " + " ) " + " AND " + " ( " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_INFO_YY = " + ICON_SCHEMA_NAME + ".ICOSARRT.ARRT_INFO_YY " + " ) " + " AND " + " ( " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_INFO_PREFIX = " + ICON_SCHEMA_NAME + ".ICOSARRT.ARRT_INFO_PREFIX " + " ) " + " AND " + " ( " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_INFO_SUFFIX = " + ICON_SCHEMA_NAME + ".ICOSARRT.ARRT_INFO_SUFFIX " + " ) " + "WHERE " + " " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_CRT_OFC = '" + courtOfficeId + "' " + " AND " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_JRSDCTN_NUM = '" + jurisdictionNumber + "' " + " AND " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_INFO_YY = '" + infoYear + "' " + " AND " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_INFO_PREFIX = '" + infoPrefix + "' " + " AND " + ICON_SCHEMA_NAME + ".ICOS" + dbLetterPrefix + "FCS." + dbLetterPrefix + "FCS_INFO_SUFFIX = '" + infoSuffix + "' "; selectSql += " "; logger.info("+++++SQL: " + selectSql); preparedStatement = iicfConnection.prepareStatement(selectSql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); resultSet = preparedStatement.executeQuery(); resultSet.last(); resultSetCount = resultSet.getRow(); logger.info("resultSetCount: " + resultSetCount); resultSet.beforeFirst(); paramOffenceTotalPayable = ""; if (resultSetCount == 1) { resultSet.next(); // if(null != resultSet.getString("ARRT_TTL_FINE_AMT")){ // NumberFormat formatUS = NumberFormat.getCurrencyInstance(Locale.US); // //logger.info("formatUS: " + formatUS.format(resultSet.getDouble("ARRT_TTL_FINE_AMT")) ); // paramOffenceTotalPayable = formatUS.format(resultSet.getDouble("ARRT_TTL_FINE_AMT")); // } //ARRT_TTL_FINE_AMT, ARRT_PRE_PD_FINE_TTL_AMT, ARRT_PRE_PD_COST_TTL_AMT BigDecimal totalPayable; BigDecimal totalFineAmount = resultSet.getBigDecimal("ARRT_TTL_FINE_AMT"); BigDecimal totalPrePDFineAmount = resultSet.getBigDecimal("ARRT_PRE_PD_FINE_TTL_AMT"); BigDecimal totalPrePDCostAmount = resultSet.getBigDecimal("ARRT_PRE_PD_COST_TTL_AMT"); //these will never be null so NO need to check for null totalPayable = totalPrePDFineAmount.add(totalPrePDCostAmount); //IF(ARRT_PRE_PD_FINE_TTL_AMT + ARRT_PRE_PD_COST_TTL_AMT < 0) THEN if (totalPayable.compareTo(new BigDecimal("0.0")) < 0) { totalPayable = totalFineAmount; } NumberFormat formatUS = NumberFormat.getCurrencyInstance(Locale.US); paramOffenceTotalPayable = formatUS.format(totalPayable.doubleValue()); } } // if(resultSetCount != 1) } catch (SQLException sqlException) { sqlException.printStackTrace(); } catch (Exception e) { paramOffenceNumber = ""; paramOffenceDate = ""; paramOfficerNumber = ""; paramDriversLicenseNumber = ""; paramPlateNumber = ""; paramEnforcementAgency = ""; paramSex = ""; paramDateOfBirth = ""; paramCVOR = ""; paramUnit = ""; paramOffenderFullName = ""; paramAddressLine1 = ""; paramAddressLine2 = ""; paramAddressLine3 = ""; paramOffenceDay = ""; paramOffenceMonth = ""; paramOffenceYear = ""; paramOffenceTime = ""; paramOffenceLocation = ""; paramOffenceDesc = ""; paramOffenceStatue = ""; paramOffenceSection = ""; paramOffenceTotalPayable = ""; paramInterpreterLanguage = ""; e.printStackTrace(); } finally { // setDiscreteParameterValue(this, "paramOffenceNumber", "", paramOffenceNumber); // setDiscreteParameterValue(this, "paramOffenceDate", "", paramOffenceDate); // setDiscreteParameterValue(this, "paramOfficerNumber", "", paramOfficerNumber); // setDiscreteParameterValue(this, "paramDriversLicenseNumber", "", paramDriversLicenseNumber); // setDiscreteParameterValue(this, "paramPlateNumber", "", paramPlateNumber); // setDiscreteParameterValue(this, "paramEnforcementAgency", "", paramEnforcementAgency); // setDiscreteParameterValue(this, "paramSex", "", paramSex); // setDiscreteParameterValue(this, "paramDateOfBirth", "", paramDateOfBirth); // setDiscreteParameterValue(this, "paramCVOR", "", paramCVOR); // setDiscreteParameterValue(this, "paramUnit", "", paramUnit); // setDiscreteParameterValue(this, "paramOffenderFullName", "", paramOffenderFullName); // setDiscreteParameterValue(this, "paramAddressLine1", "", paramAddressLine1); // setDiscreteParameterValue(this, "paramAddressLine2", "", paramAddressLine2); // setDiscreteParameterValue(this, "paramAddressLine3", "", paramAddressLine3); // setDiscreteParameterValue(this, "paramOffenceDay", "", paramOffenceDay); // setDiscreteParameterValue(this, "paramOffenceMonth", "", paramOffenceMonth); // setDiscreteParameterValue(this, "paramOffenceYear", "", paramOffenceYear); // setDiscreteParameterValue(this, "paramOffenceTime", "", paramOffenceTime); // setDiscreteParameterValue(this, "paramOffenceLocation", "", paramOffenceLocation); // setDiscreteParameterValue(this, "paramOffenceDesc", "", paramOffenceDesc); // setDiscreteParameterValue(this, "paramOffenceStatue", "", paramOffenceStatue); // setDiscreteParameterValue(this, "paramOffenceSection", "", paramOffenceSection); // setDiscreteParameterValue(this, "paramOffenceTotalPayable", "", paramOffenceTotalPayable); // setDiscreteParameterValue(this, "paramTrialDay", "", paramTrialDay); // setDiscreteParameterValue(this, "parmaTrialMonth", "", parmaTrialMonth); // setDiscreteParameterValue(this, "paramTrailYear", "", paramTrailYear); // setDiscreteParameterValue(this, "paramTrailTimeHour", "", paramTrailTimeHour); // setDiscreteParameterValue(this, "paramTrailLocation", "", paramTrailLocationCourtOfficeId); // setDiscreteParameterValue(this, "paramIssuedAt", "", paramIssuedAt); // setDiscreteParameterValue(this, "paramIssuedDay", "", paramIssuedDay); // setDiscreteParameterValue(this, "paramIssuedMonth", "", paramIssuedMonth); // setDiscreteParameterValue(this, "paramIssuedYear", "", paramIssuedYear); // //Modified Oct 17, 2007 // setDiscreteParameterValue(this, "paramFormNumberLabel", "", paramFormNumberLabel); try { if (null != preparedStatement) { preparedStatement.close(); preparedStatement = null; } if (null != iicfConnection) { iicfConnection.close(); iicfConnection = null; } } catch (SQLException e1) { } } //try } //if(null != iicfConnection && true == isOffenceNumberValid()) }