ExtensibleTypeInferringSerializer.addSerializer(BigDecimal.class, BigDecimalSerializer.get());
}
@Override
public void addReadings(final List<Reading> readings) {
Mutator mutator = HFactory.createMutator(keyspace, genericOutputSerializer);
for (Reading reading : readings) {
HColumn temperatureColumn = HFactory.createColumn(temperatureNameColumnName,
reading.getTemperature(),
genericOutputSerializer,
genericOutputSerializer).setTtl(ttl);
HColumn windSpeedColumn = HFactory.createColumn(windSpeedNameColumnName,
reading.getWindSpeed(),
genericOutputSerializer,
genericOutputSerializer).setTtl(ttl);
HColumn windDirectionColumn = HFactory.createColumn(windDirectionNameColumnName,
reading.getDirection(),
genericOutputSerializer,
genericOutputSerializer).setTtl(ttl);
HColumn humidityColumn = HFactory.createColumn(humidityNameColumnName,
reading.getHumidity(),
genericOutputSerializer,
genericOutputSerializer).setTtl(ttl);
HColumn badAirQualityDetectedColumn = HFactory.createColumn(badAirQualityDetectedNameColumnName,
reading.getBadAirQualityDetected(),
genericOutputSerializer,
genericOutputSerializer).setTtl(ttl);
List columnList = new ArrayList();
columnList.add(temperatureColumn);
columnList.add(windSpeedColumn);
columnList.add(windDirectionColumn);
columnList.add(humidityColumn);
columnList.add(badAirQualityDetectedColumn);
HSuperColumn superColumn = HFactory.createSuperColumn(reading.getTimestamp(),
columnList,
genericOutputSerializer,
genericOutputSerializer,
genericOutputSerializer);
mutator.addInsertion(reading.getSensorId(), columnFamilyName, superColumn);
}
mutator.execute();
}