src/org/ohmage/query/impl/ObserverQueries.java
@Override
						public DataStream mapRow(
								final ResultSet rs, 
								final int rowNum)
								throws SQLException {
							
							MetaData.Builder metaDataBuilder =
								new MetaData.Builder();
							
							String id = rs.getString("osd.uid");
							if(id != null) {
								metaDataBuilder.setId(id);
							}
							
							Long time = rs.getLong("osd.time");
							if(time != null) {
								metaDataBuilder.setTimestamp(
									new DateTime(
										time,
										DateTimeZone.forID(
											rs.getString("osd.time_zone"))));
							}
							
							String locationTimestampString = 
								rs.getString("location_timestamp");
							if(locationTimestampString != null) {
								Location location;
								try {
									location =
										new Location(
											ISODateTimeFormat
												.dateTime()
												.parseDateTime(
													rs.getString(
														"osd.location_timestamp")),
											rs.getDouble("osd.location_latitude"),
											rs.getDouble("osd.location_longitude"),
											rs.getDouble("osd.location_accuracy"),
											rs.getString("osd.location_provider"));
								}
								catch(IllegalArgumentException e) {
									throw new SQLException(
										"The timestamp in the database is corrupted.",
										e);
								}
								catch(NullPointerException e) {
									throw new SQLException(
										"A double in the database is corrupted.",
										e);
								}
								catch(DomainException e) {
									throw new SQLException(
										"Could not create the location object.",
										e);
								}
								
								metaDataBuilder.setLocation(location);
							}
							
							JsonNode data;
							try {
								JsonParser parser =
									jsonFactory
										.createJsonParser(
											rs.getString("osd.data"));
								data = parser.readValueAsTree();
							}
							catch(JsonParseException e) {
								throw new SQLException(
									"The data in the database is invalid: " +
										id,
									e);
							}
							catch(IOException e) {
								throw new SQLException(
									"There was a problem reading the data: " +
										id,
									e);
							}
							
							try {
								return new DataStream(
									stream, 
									metaDataBuilder.build(), 
									data);
							}
							catch(DomainException e) {
								throw new SQLException(
									"Could not create the data stream.",
									e);
							}
						}
/**
						 * Decodes the resulting data into a data stream.
						 */
Decodes the resulting data into a data stream.
Decodes the resulting data into a data stream .
@Override
						public DataStream mapRow(
								final ResultSet rs, 
								final int rowNum)
								throws SQLException {
							MetaData.Builder metaDataBuilder =
								new MetaData.Builder();
							String id = rs.getString("osd.uid");
							if(id != null) {
								metaDataBuilder.setId(id);
							}
							Long time = rs.getLong("osd.time");
							if(time != null) {
								metaDataBuilder.setTimestamp(
									new DateTime(
										time,
										DateTimeZone.forID(
											rs.getString("osd.time_zone"))));
							}
							String locationTimestampString = 
								rs.getString("location_timestamp");
							if(locationTimestampString != null) {
								Location location;
								try {
									location =
										new Location(
											ISODateTimeFormat
												.dateTime()
												.parseDateTime(
													rs.getString(
														"osd.location_timestamp")),
											rs.getDouble("osd.location_latitude"),
											rs.getDouble("osd.location_longitude"),
											rs.getDouble("osd.location_accuracy"),
											rs.getString("osd.location_provider"));
								}
								catch(IllegalArgumentException e) {
									throw new SQLException(
										"The timestamp in the database is corrupted.",
										e);
								}
								catch(NullPointerException e) {
									throw new SQLException(
										"A double in the database is corrupted.",
										e);
								}
								catch(DomainException e) {
									throw new SQLException(
										"Could not create the location object.",
										e);
								}
								metaDataBuilder.setLocation(location);
							}
							JsonNode data;
							try {
								JsonParser parser =
									jsonFactory
										.createJsonParser(
											rs.getString("osd.data"));
								data = parser.readValueAsTree();
							}
							catch(JsonParseException e) {
								throw new SQLException(
									"The data in the database is invalid: " +
										id,
									e);
							}
							catch(IOException e) {
								throw new SQLException(
									"There was a problem reading the data: " +
										id,
									e);
							}
							try {
								return new DataStream(
									stream, 
									metaDataBuilder.build(), 
									data);
							}
							catch(DomainException e) {
								throw new SQLException(
									"Could not create the data stream.",
									e);
							}
						}
@ Override public DataStream mapRow ( final ResultSet rs , final int rowNum ) throws SQLException { MetaData . Builder metaDataBuilder = new MetaData . Builder ( ) ; String id = rs . getString ( "osd.uid" ) ; if ( id != null ) { metaDataBuilder . setId ( id ) ; } Long time = rs . getLong ( "osd.time" ) ; if ( time != null ) { metaDataBuilder . setTimestamp ( new DateTime ( time , DateTimeZone . forID ( rs . getString ( "osd.time_zone" ) ) ) ) ; } String locationTimestampString = rs . getString ( "location_timestamp" ) ; if ( locationTimestampString != null ) { Location location ; try { location = new Location ( ISODateTimeFormat . dateTime ( ) . parseDateTime ( rs . getString ( "osd.location_timestamp" ) ) , rs . getDouble ( "osd.location_latitude" ) , rs . getDouble ( "osd.location_longitude" ) , rs . getDouble ( "osd.location_accuracy" ) , rs . getString ( "osd.location_provider" ) ) ; } catch ( IllegalArgumentException e ) { throw new SQLException ( "The timestamp in the database is corrupted." , e ) ; } catch ( NullPointerException e ) { throw new SQLException ( "A double in the database is corrupted." , e ) ; } catch ( DomainException e ) { throw new SQLException ( "Could not create the location object." , e ) ; } metaDataBuilder . setLocation ( location ) ; } JsonNode data ; try { JsonParser parser = jsonFactory . createJsonParser ( rs . getString ( "osd.data" ) ) ; data = parser . readValueAsTree ( ) ; } catch ( JsonParseException e ) { throw new SQLException ( "The data in the database is invalid: " + id , e ) ; } catch ( IOException e ) { throw new SQLException ( "There was a problem reading the data: " + id , e ) ; } try { return new DataStream ( stream , metaDataBuilder . build ( ) , data ) ; } catch ( DomainException e ) { throw new SQLException ( "Could not create the data stream." , e ) ; } }
Decodes the resulting data into a data stream.
Decodes the resulting data into a data stream .