src/org/ohmage/request/observer/StreamReadRequest.java
private void writeData(
			final JsonGenerator generator,
			final ColumnNode<String> columns)
			throws JsonGenerationException, IOException, DomainException {
		
		for(DataStream dataStream : results) {
			// Begin this data stream.
			generator.writeStartObject();
			
			// Write the meta-data.
			DataStream.MetaData metaData = dataStream.getMetaData();
			if(metaData != null) {
				generator.writeObjectFieldStart("metadata");
				
				String id = metaData.getId();
				if(id != null) {
					generator.writeStringField("id", id);
				}
				
				DateTime timestamp = metaData.getTimestamp();
				if(timestamp != null) {
					generator.writeStringField(
						"timestamp",
						ISODateTimeFormat.dateTime().print(timestamp));
				}
				
				Location location = metaData.getLocation();
				if(location != null) {
					generator.writeObjectFieldStart("location");
					location.streamJson(
						generator, 
						false, 
						LocationColumnKey.ALL_COLUMNS);
					generator.writeEndObject();
				}
				
				generator.writeEndObject();
			}
			
			// Write the data.
			handleGeneric(
				generator,
				dataStream.getData(), 
				columns, 
				"data");
			
			// End this data stream.
			generator.writeEndObject();
		}
	}
/**
	 * Writes the data points to the generator. The generator be at the point 
	 * where it has an array open.
	 * 
	 * @param generator The generator to write to.
	 * 
	 * @param columns The columns to write the data.
	 * 
	 * @throws JsonGenerationException There was an error generating the JSON.
	 * 								   Has the generator already opened an 
	 * 								   array?
	 * 
	 * @throws IOException There was an error writing to the generator.
	 * 
	 * @throws DomainException There was an error generating or reading a 
	 * 						   domain object.
	 */
Writes the data points to the generator. The generator be at the point
where it has an array open.

@param generator The generator to write to.

@param columns The columns to write the data.

@throws JsonGenerationException There was an error generating the JSON.

@throws IOException There was an error writing to the generator.

@throws DomainException There was an error generating or reading a
domain object.
Writes the data points to the generator . The generator be at the point where it has an array open . @param generator The generator to write to . @param columns The columns to write the data . @throws JsonGenerationException There was an error generating the JSON . @throws IOException There was an error writing to the generator . @throws DomainException There was an error generating or reading a domain object .
private void writeData(
			final JsonGenerator generator,
			final ColumnNode<String> columns)
			throws JsonGenerationException, IOException, DomainException {
		for(DataStream dataStream : results) {
			generator.writeStartObject();
			DataStream.MetaData metaData = dataStream.getMetaData();
			if(metaData != null) {
				generator.writeObjectFieldStart("metadata");
				String id = metaData.getId();
				if(id != null) {
					generator.writeStringField("id", id);
				}
				DateTime timestamp = metaData.getTimestamp();
				if(timestamp != null) {
					generator.writeStringField(
						"timestamp",
						ISODateTimeFormat.dateTime().print(timestamp));
				}
				Location location = metaData.getLocation();
				if(location != null) {
					generator.writeObjectFieldStart("location");
					location.streamJson(
						generator, 
						false, 
						LocationColumnKey.ALL_COLUMNS);
					generator.writeEndObject();
				}
				generator.writeEndObject();
			}
			handleGeneric(
				generator,
				dataStream.getData(), 
				columns, 
				"data");
			generator.writeEndObject();
		}
	}
private void writeData ( final JsonGenerator generator , final ColumnNode < String > columns ) throws JsonGenerationException , IOException , DomainException { for ( DataStream dataStream : results ) { generator . writeStartObject ( ) ; DataStream . MetaData metaData = dataStream . getMetaData ( ) ; if ( metaData != null ) { generator . writeObjectFieldStart ( "metadata" ) ; String id = metaData . getId ( ) ; if ( id != null ) { generator . writeStringField ( "id" , id ) ; } DateTime timestamp = metaData . getTimestamp ( ) ; if ( timestamp != null ) { generator . writeStringField ( "timestamp" , ISODateTimeFormat . dateTime ( ) . print ( timestamp ) ) ; } Location location = metaData . getLocation ( ) ; if ( location != null ) { generator . writeObjectFieldStart ( "location" ) ; location . streamJson ( generator , false , LocationColumnKey . ALL_COLUMNS ) ; generator . writeEndObject ( ) ; } generator . writeEndObject ( ) ; } handleGeneric ( generator , dataStream . getData ( ) , columns , "data" ) ; generator . writeEndObject ( ) ; } }
Writes the data points to the generator.
Writes the data points to the generator .
// Begin this data stream. // Write the meta-data. // Write the data. // End this data stream.