// try {
// DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
// Key parkey = entreading.getParent();
// Entity parent = datastore.get(parkey);
// String type = (String) parent.getProperty("type");
Reading reading = ofy().load().fromEntity(entreading);
if (reading == null) {
log.log(Level.SEVERE, "null reading");
}
Sensor sensor = ofy().load().now(reading.getSensor());
if (sensor == null) {
log.log(Level.SEVERE, "null sensor");
}
String sentitydate = getDateString(reading.getTimestamp());
String value = reading.getValue(); // value of reading
emit(sensor.getType() + ":" + sensor.getId() + ":" + sentitydate, value);
// emits the form: TEMPERATURE:38382834:20140417, 72
// where TYPE:SENSORID:DATE,READING
// } catch (EntityNotFoundException e) {
// }