public static void addInsertToMutator( Mutator<ByteBuffer> m, Object columnFamily, Object key, Object columnName, Object columnValue, long timestamp ) { logBatchOperation( "Insert", columnFamily, key, columnName, columnValue, timestamp ); if ( columnName instanceof List<?> ) { columnName = DynamicComposite.toByteBuffer( ( List<?> ) columnName ); } if ( columnValue instanceof List<?> ) { columnValue = DynamicComposite.toByteBuffer( ( List<?> ) columnValue ); } HColumn<ByteBuffer, ByteBuffer> column = createColumn( bytebuffer( columnName ), bytebuffer( columnValue ), timestamp, be, be ); m.addInsertion( bytebuffer( key ), columnFamily.toString(), column ); }
public static void addDeleteToMutator( Mutator<ByteBuffer> m, Object columnFamily, Object key, Object columnName, long timestamp ) throws Exception { logBatchOperation( "Delete", columnFamily, key, columnName, null, timestamp ); if ( columnName instanceof List<?> ) { columnName = DynamicComposite.toByteBuffer( ( List<?> ) columnName ); } m.addDeletion( bytebuffer( key ), columnFamily.toString(), bytebuffer( columnName ), be, timestamp ); }
public void setColumn( Keyspace ko, Object columnFamily, Object key, Object columnName, Object columnValue, int ttl ) throws Exception { if ( db_logger.isTraceEnabled() ) { db_logger.trace( "setColumn cf={} key={} name={} value={}", columnFamily, key, columnName, columnValue ); } ByteBuffer name_bytes = null; if ( columnName instanceof List ) { name_bytes = DynamicComposite.toByteBuffer( ( List<?> ) columnName ); } else { name_bytes = bytebuffer( columnName ); } ByteBuffer value_bytes = null; if ( columnValue instanceof List ) { value_bytes = DynamicComposite.toByteBuffer( ( List<?> ) columnValue ); } else { value_bytes = bytebuffer( columnValue ); } HColumn<ByteBuffer, ByteBuffer> col = createColumn( name_bytes, value_bytes, be, be ); if ( ttl != 0 ) { col.setTtl( ttl ); } Mutator<ByteBuffer> m = CountingMutator.createFlushingMutator( ko, be ); m.insert( bytebuffer( key ), columnFamily.toString(), col ); }
name_bytes = DynamicComposite.toByteBuffer( ( List<?> ) name ); value_bytes = DynamicComposite.toByteBuffer( ( List<?> ) value );
start_bytes = DynamicComposite.toByteBuffer( ( List<?> ) start ); finish_bytes = DynamicComposite.toByteBuffer( ( List<?> ) finish );
cass.getColumn(cass.getApplicationKeyspace(applicationId), dictionaryCf, CassandraPersistenceUtils.key(entity.getUuid(), dictionaryName), entityHasDictionary ? bytebuffer(elementName) : DynamicComposite.toByteBuffer(elementName), be, be);
.setRange( DynamicComposite.toByteBuffer( entryName ), setGreaterThanEqualityFlag( new DynamicComposite( entryName ) ).serialize(), false, INDEX_ENTRY_LIST_COUNT ).execute().get().getColumns(); .toByteBuffer( entryName, indexValueCode( entryValue ), toIndexableValue( entryValue ), indexUpdate.getTimestampUuid(), name ), ByteBuffer.allocate( 0 ), timestamp, be, be ) );
for ( int i = 0; i < elementNames.length; i++ ) { columnNames[i] = entityHasDictionary ? bytebuffer( elementNames[i] ) : DynamicComposite.toByteBuffer( elementNames[i] );
assertTrue(c.get(2) instanceof ByteBuffer); b = DynamicComposite.toByteBuffer(1, "string", TimeUUIDUtils.getUniqueTimeUUIDinMillis()); c = DynamicComposite.fromByteBuffer(b); assertTrue(c.get(2) instanceof UUID); b = DynamicComposite.toByteBuffer((long) 1, "string", TimeUUIDUtils.getUniqueTimeUUIDinMillis()); c = DynamicComposite.fromByteBuffer(b); assertTrue(c.get(2) instanceof UUID); b = DynamicComposite.toByteBuffer((byte) 1, "string", UUID.randomUUID()); c = DynamicComposite.fromByteBuffer(b); assertTrue(c.get(0) instanceof BigInteger); assertTrue(c.get(2) instanceof UUID); b = DynamicComposite.toByteBuffer(Arrays.asList(Arrays.asList(0, 1, 2), 3, 4, 5, Arrays.asList(6, 7, 8))); c = DynamicComposite.fromByteBuffer(b); b = DynamicComposite.toByteBuffer("foo"); c = DynamicComposite.fromByteBuffer(b); b = c.getComponent(0).getBytes();