Examples of DynamicComposite


Examples of me.prettyprint.hector.api.beans.DynamicComposite

        final HColumn<Long, DynamicComposite> entryColumn = HFactory.createColumn(timestamp, CassidyUtils.toComposite(context.serializerRegistry(), indexValues), LONG_SERIALIZER, DYNAMIC_COMPOSITE_SERIALIZER);
        entryMutator.addInsertion(entryKey(itemKey), entryColumnFamily, entryColumn);
    }

    private DynamicComposite entryKey(K itemKey) {
        DynamicComposite entryKey = new DynamicComposite();
        entryKey.addComponent(itemKey, keySerializer);
        entryKey.addComponent(indexName, STRING_SERIALIZER);
        return entryKey;
    }
View Full Code Here

Examples of me.prettyprint.hector.api.beans.DynamicComposite

        return entryKey;
    }

    private void insertIndexColumn(K itemKey, long timestamp, List<Object> indexValues, Mutator<String> indexMutator) {
        LOGGER.debug("Indexing key {} with values {}...", itemKey, indexValues);
        DynamicComposite indexColumnName = CassidyUtils.toComposite(context.serializerRegistry(), indexValues);
        indexColumnName.addComponent(itemKey, keySerializer);
        indexColumnName.addComponent(timestamp, LONG_SERIALIZER);
        LOGGER.debug("Creating '{}' index column with name {} and value {}...", indexName, indexColumnName, itemKey);
        final HColumn<DynamicComposite, K> indexColumn = HFactory.createColumn(indexColumnName, itemKey, DYNAMIC_COMPOSITE_SERIALIZER, keySerializer);
        indexMutator.addInsertion(indexName, indexColumnFamily, indexColumn);
    }
View Full Code Here

Examples of me.prettyprint.hector.api.beans.DynamicComposite

        final HColumn<DynamicComposite, K> indexColumn = HFactory.createColumn(indexColumnName, itemKey, DYNAMIC_COMPOSITE_SERIALIZER, keySerializer);
        indexMutator.addInsertion(indexName, indexColumnFamily, indexColumn);
    }

    private void performCleanup(K key, Mutator<String> indexMutator, Mutator<DynamicComposite> entryMutator) {
        final DynamicComposite entryKey = entryKey(key);
        final List<HColumn<Long, DynamicComposite>> entries = getEntries(entryKey);
        for (HColumn<Long, DynamicComposite> entry : entries) {
            final Long entryTimestamp = entry.getName();

            DynamicComposite indexColumnName = new DynamicComposite();
            appendComponents(entry.getValue(), indexColumnName);
            indexColumnName.addComponent(key, keySerializer);
            indexColumnName.addComponent(entryTimestamp, LONG_SERIALIZER);

            indexMutator.addDeletion(indexName, indexColumnFamily, indexColumnName, DYNAMIC_COMPOSITE_SERIALIZER);
            entryMutator.addDeletion(entryKey, entryColumnFamily, entryTimestamp, LONG_SERIALIZER);
        }
    }
View Full Code Here

Examples of me.prettyprint.hector.api.beans.DynamicComposite

        }
    }

    @SuppressWarnings("unchecked")
    public static DynamicComposite toComposite(SerializerRegistry registry, Iterable<?> values) {
        DynamicComposite composite = new DynamicComposite();
        for (Object value : values) {
            if (value == null) {
                composite.addComponent(NULL_VALUE, NULL_SERIALIZER);
            } else {
                composite.addComponent(value, (Serializer<Object>) registry.getSerializer(value.getClass()));
            }
        }
        return composite;
    }
View Full Code Here

Examples of me.prettyprint.hector.api.beans.DynamicComposite

    @Override
    public List<HColumn<DynamicComposite, ?>> toColumns(V object) {
        List<AssemblyStep> steps = disassemblerService.disassemble(object);
        List<HColumn<DynamicComposite, ?>> columns = new ArrayList<>(steps.size());
        for (AssemblyStep step : steps) {
            final DynamicComposite name = new DynamicComposite(columns.size(), step.getClass().getName());
            final Object columnValue = step.getColumnValue();
            final HColumn<DynamicComposite, ?> column = createColumn(name, columnValue);
            columns.add(column);
        }
        return columns;
View Full Code Here

Examples of me.prettyprint.hector.api.beans.DynamicComposite

    @Override
    public List<HColumn<DynamicComposite, ?>> toColumns(V object) {
        List<AssemblyStep> steps = disassemblerService.disassemble(object);
        List<HColumn<DynamicComposite, ?>> columns = new ArrayList<HColumn<DynamicComposite, ?>>(steps.size());
        for (AssemblyStep step : steps) {
            final DynamicComposite name = new DynamicComposite(columns.size(), step.getClass().getName());
            ColumnValueDefinition<?> valueDefinition = step.toColumnDefinition();
            final HColumn<DynamicComposite, ?> column = createColumn(name, valueDefinition);
            LOGGER.debug("Adding column {} with value {}...", name, column.getValue());
            columns.add(column);
        }
View Full Code Here

Examples of org.caffinitas.mapper.core.DynamicComposite

    public void dynamic_insertAndLoad() throws Exception {
        PersistenceSession session = persistenceManager.createSession();
        try {
            DynamicCompEntity inst = new DynamicCompEntity();
            inst.setId(11);
            DynamicComposite dyn = new DynamicComposite();
            dyn.addBool(true);
            dyn.addUtf8String("Ursus");
            dyn.addInt(42);
            inst.setDyn(dyn);
            session.insert(inst);

            DynamicCompEntity loaded = session.loadOne(DynamicCompEntity.class, 11);
            Assert.assertNotNull(loaded);
            dyn = loaded.getDyn();
            Assert.assertNotNull(dyn);
            Assert.assertEquals(dyn.size(), 3);
            Assert.assertEquals(dyn.getType(0), DataType.cboolean());
            Assert.assertEquals(dyn.getType(1), DataType.text());
            Assert.assertEquals(dyn.getType(2), DataType.cint());
            Assert.assertEquals(dyn.getBool(0), true);
            Assert.assertEquals(dyn.getString(1), "Ursus");
            Assert.assertEquals(dyn.getInt(2), 42);
        } finally {session.close();}
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.