List of usage examples for java.sql ResultSet wasNull
boolean wasNull() throws SQLException;
NULL
. From source file:org.zenoss.zep.dao.impl.EventDaoHelper.java
public Event eventMapper(ResultSet rs, final boolean isArchive) throws SQLException { TypeConverter<Long> timestampConverter = databaseCompatibility.getTimestampConverter(); Event.Builder eventBuilder = Event.newBuilder(); eventBuilder.setCreatedTime(timestampConverter.fromDatabaseType(rs, COLUMN_LAST_SEEN)); eventBuilder.setFingerprint(rs.getString(COLUMN_FINGERPRINT)); int eventGroupId = rs.getInt(COLUMN_EVENT_GROUP_ID); if (!rs.wasNull()) { eventBuilder.setEventGroup(daoCache.getEventGroupFromId(eventGroupId)); }// w w w . j a v a 2s . c o m int eventClassId = rs.getInt(COLUMN_EVENT_CLASS_ID); if (!rs.wasNull()) { eventBuilder.setEventClass(daoCache.getEventClassFromId(eventClassId)); } int eventClassKeyId = rs.getInt(COLUMN_EVENT_CLASS_KEY_ID); if (!rs.wasNull()) { eventBuilder.setEventClassKey(daoCache.getEventClassKeyFromId(eventClassKeyId)); } int eventKeyId = rs.getInt(COLUMN_EVENT_KEY_ID); if (!rs.wasNull()) { eventBuilder.setEventKey(daoCache.getEventKeyFromId(eventKeyId)); } String eventClassMappingUuid = uuidConverter.fromDatabaseType(rs, COLUMN_EVENT_CLASS_MAPPING_UUID); if (eventClassMappingUuid != null) { eventBuilder.setEventClassMappingUuid(eventClassMappingUuid); } eventBuilder.setSeverity(EventSeverity.valueOf(rs.getInt(COLUMN_SEVERITY_ID))); eventBuilder.setActor(deserializeEventActor(rs)); int monitorId = rs.getInt(COLUMN_MONITOR_ID); if (!rs.wasNull()) { eventBuilder.setMonitor(daoCache.getMonitorFromId(monitorId)); } int agentId = rs.getInt(COLUMN_AGENT_ID); if (!rs.wasNull()) { eventBuilder.setAgent(daoCache.getAgentFromId(agentId)); } int syslogFacility = rs.getInt(COLUMN_SYSLOG_FACILITY); if (!rs.wasNull()) { eventBuilder.setSyslogFacility(syslogFacility); } int syslogPriority = rs.getInt(COLUMN_SYSLOG_PRIORITY); if (!rs.wasNull()) { eventBuilder.setSyslogPriority(SyslogPriority.valueOf(syslogPriority)); } int ntEventCode = rs.getInt(COLUMN_NT_EVENT_CODE); if (!rs.wasNull()) { eventBuilder.setNtEventCode(ntEventCode); } eventBuilder.setSummary(rs.getString(COLUMN_SUMMARY)); eventBuilder.setMessage(rs.getString(COLUMN_MESSAGE)); String detailsJson = rs.getString(COLUMN_DETAILS_JSON); if (detailsJson != null && !detailsJson.isEmpty()) { try { List<EventDetail> details = JsonFormat.mergeAllDelimitedFrom(detailsJson, EventDetail.getDefaultInstance()); eventBuilder.addAllDetails(details); } catch (IOException e) { throw new SQLException(e); } } if (isArchive == true) { EventDetail archiveDetail = EventDetail.newBuilder().setName("is_archive").addValue("true").build(); eventBuilder.addDetails(archiveDetail); } String tagsJson = rs.getString(COLUMN_TAGS_JSON); if (tagsJson != null && !tagsJson.isEmpty()) { try { List<EventTag> tags = JsonFormat.mergeAllDelimitedFrom(tagsJson, EventTag.getDefaultInstance()); eventBuilder.addAllTags(tags); } catch (IOException e) { throw new SQLException(e); } } return eventBuilder.build(); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMySql.CFAccMySqlISOCountryTable.java
protected CFAccISOCountryBuff unpackISOCountryResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackISOCountryResultSetToBuff"; int idxcol = 1; CFAccISOCountryBuff buff = schema.getFactoryISOCountry().newBuff(); {//w w w .j a v a 2 s . 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(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.setRequiredId(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredISOCode(resultSet.getString(idxcol)); idxcol++; buff.setRequiredName(resultSet.getString(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstMySql.CFAstMySqlISOCountryTable.java
protected CFAstISOCountryBuff unpackISOCountryResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackISOCountryResultSetToBuff"; int idxcol = 1; CFAstISOCountryBuff buff = schema.getFactoryISOCountry().newBuff(); {/*from ww w . j ava 2s . 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(CFAstMySqlSchema.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(CFAstMySqlSchema.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.setRequiredId(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredISOCode(resultSet.getString(idxcol)); idxcol++; buff.setRequiredName(resultSet.getString(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskMSSql.CFAsteriskMSSqlISOCountryTable.java
protected CFSecurityISOCountryBuff unpackISOCountryResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackISOCountryResultSetToBuff"; int idxcol = 1; CFSecurityISOCountryBuff buff = schema.getFactoryISOCountry().newBuff(); {/*ww w.jav a2s .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(CFAsteriskMSSqlSchema.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(CFAsteriskMSSqlSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredId(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredISOCode(resultSet.getString(idxcol)); idxcol++; buff.setRequiredName(resultSet.getString(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskOracle.CFAsteriskOracleSecDeviceTable.java
protected CFSecuritySecDeviceBuff unpackSecDeviceResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackSecDeviceResultSetToBuff"; int idxcol = 1; CFSecuritySecDeviceBuff buff = schema.getFactorySecDevice().newBuff(); {//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(CFAsteriskOracleSchema.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(CFAsteriskOracleSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredSecUserId(CFAsteriskOracleSchema.convertUuidString(resultSet.getString(idxcol))); idxcol++; buff.setRequiredDevName(resultSet.getString(idxcol)); idxcol++; { String colVal = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setOptionalPubKey(null); } else { buff.setOptionalPubKey(colVal); } } idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswMySql.CFFswMySqlISOCountryTable.java
protected CFFswISOCountryBuff unpackISOCountryResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackISOCountryResultSetToBuff"; int idxcol = 1; CFFswISOCountryBuff buff = schema.getFactoryISOCountry().newBuff(); {/*from w w w.ja 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.setRequiredId(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredISOCode(resultSet.getString(idxcol)); idxcol++; buff.setRequiredName(resultSet.getString(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMSSql.CFAccMSSqlTldTable.java
protected CFAccTldBuff unpackTldResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackTldResultSetToBuff"; int idxcol = 1; CFAccTldBuff buff = schema.getFactoryTld().newBuff(); {//from w w w . j a va 2 s. 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(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.setRequiredTLDId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredName(resultSet.getString(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstMSSql.CFAstMSSqlTldTable.java
protected CFAstTldBuff unpackTldResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackTldResultSetToBuff"; int idxcol = 1; CFAstTldBuff buff = schema.getFactoryTld().newBuff(); {//from w w w . j a va 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(CFAstMSSqlSchema.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(CFAstMSSqlSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredTenantId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredTLDId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredName(resultSet.getString(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstMSSql.CFAstMSSqlTldTable.java
protected CFAstTldBuff unpackTldResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackTldResultSetToBuff"; int idxcol = 1; CFAstTldBuff buff = schema.getFactoryTld().newBuff(); {/*ww w .j ava2 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(CFAstMSSqlSchema.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(CFAstMSSqlSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredTenantId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredTldId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredName(resultSet.getString(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmMSSql.CFCrmMSSqlSecAppTable.java
protected CFCrmSecAppBuff unpackSecAppResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackSecAppResultSetToBuff"; int idxcol = 1; CFCrmSecAppBuff buff = schema.getFactorySecApp().newBuff(); {/*from w ww . j ava 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(CFCrmMSSqlSchema.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(CFCrmMSSqlSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredClusterId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredSecAppId(resultSet.getInt(idxcol)); idxcol++; buff.setRequiredJEEMountName(resultSet.getString(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }