Package me.prettyprint.hector.api.mutation

Examples of me.prettyprint.hector.api.mutation.Mutator


        ExtensibleTypeInferringSerializer.addSerializer(Reading.class, ReadingSerializer.get());
    }

    @Override
    public void addReadings(final List<Reading> readings) {
        Mutator mutator = HFactory.createMutator(keyspace, genericOutputSerializer);

        for (Reading reading : readings) {
            HColumn column = HFactory.createColumn(reading.getTimestamp(),
                    reading,
                    genericOutputSerializer,
                    genericOutputSerializer).setTtl(ttl);

            mutator.addInsertion(reading.getSensorId(), columnFamilyName, column);
        }

        mutator.execute();
    }
View Full Code Here


        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();
    }
View Full Code Here

TOP

Related Classes of me.prettyprint.hector.api.mutation.Mutator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.