Code example for ResultSet

Methods: getClob, getString, getTimestamp

0
		public EventType buildEventSet(ResultSet rowSet, String source,List<ParamType> metaDataParamList)
				throws SQLException, IOException { 
			EventType visitDimensionType = new EventType();
 
			PatientIdType patientIdType = new PatientIdType();
			patientIdType.setValue(rowSet.getString("visit_patient_num"));
			patientIdType.setSource(source);
			visitDimensionType.setPatientId(patientIdType);
 
			EventType.EventId eventId = new EventType.EventId();
			eventId.setValue(rowSet.getString("visit_encounter_num"));
			eventId.setSource(source);
			visitDimensionType.setEventId(eventId);
			ParamTypeValueBuilder paramValBuilder = new ParamTypeValueBuilder();
			 
			if (eventDetailFlag) {
				for (Iterator<ParamType> metaParamIterator = metaDataParamList.iterator(); metaParamIterator.hasNext();) { 
					ParamType metaParamType = metaParamIterator.next();
					 
					if (metaParamType.getType().equalsIgnoreCase("string")) {
						visitDimensionType.getParam().add(paramValBuilder.buildParamType(metaParamType,"visit_","_name",rowSet));
					} else {  
						visitDimensionType.getParam().add(paramValBuilder.buildParamType(metaParamType,"visit_",null,rowSet));
					} 
				} 
 
				Date startDate = rowSet.getTimestamp("visit_start_date");
 
				if (startDate != null) {
					visitDimensionType.setStartDate(dtoFactory
							.getXMLGregorianCalendar(startDate.getTime()));
				} 
 
				Date endDate = rowSet.getTimestamp("visit_end_date");
 
				if (endDate != null) {
					visitDimensionType.setEndDate(dtoFactory
							.getXMLGregorianCalendar(endDate.getTime()));
				} 
			} 
 
			if (eventBlobFlag) {
				Clob visitClob = rowSet.getClob("visit_visit_blob");
 
				if (visitClob != null) {
					BlobType blobType = new BlobType();
					blobType.getContent()
							.add(JDBCUtil.getClobStringWithLinebreak(visitClob));
					visitDimensionType.setEventBlob(blobType);
				} 
			} 
 
			if (eventStatusFlag) {
				if (rowSet.getTimestamp("visit_update_date") != null) {
					visitDimensionType.setUpdateDate(dtoFactory
							.getXMLGregorianCalendar(rowSet.getTimestamp(
									"visit_update_date").getTime()));
				} 
 
				if (rowSet.getTimestamp("visit_download_date") != null) {
					visitDimensionType.setDownloadDate(dtoFactory
							.getXMLGregorianCalendar(rowSet.getTimestamp(
									"visit_download_date").getTime()));
				} 
 
				if (rowSet.getTimestamp("visit_import_date") != null) {
					visitDimensionType.setImportDate(dtoFactory
							.getXMLGregorianCalendar(rowSet.getTimestamp(
									"visit_import_date").getTime()));
				} 
 
				visitDimensionType.setSourcesystemCd(rowSet
						.getString("visit_sourcesystem_cd"));
 
				visitDimensionType.setUploadId(rowSet
						.getString("visit_upload_id"));
			} 
 
			return visitDimensionType;
		} 
	}