@Test(expected = UnsupportedOperationException.class) public void writeLoadDeletePartial() throws ConnectionException { final Id applicationId = new SimpleId( "application" ); ApplicationScope context = new ApplicationScopeImpl( applicationId ); final UUID entityId = UUIDGenerator.newTimeUUID(); final UUID version = UUIDGenerator.newTimeUUID(); final String type = "test"; final Id id = new SimpleId( entityId, type ); Entity entity = new Entity( id ); EntityUtils.setVersion( entity, version ); BooleanField boolField = new BooleanField( "boolean", false ); DoubleField doubleField = new DoubleField( "double", 1d ); IntegerField intField = new IntegerField( "long", 1 ); LongField longField = new LongField( "int", 1l ); StringField stringField = new StringField( "name", "test" ); UUIDField uuidField = new UUIDField( "uuid", UUIDGenerator.newTimeUUID() ); entity.setField( boolField ); entity.setField( doubleField ); entity.setField( intField ); entity.setField( longField ); entity.setField( stringField ); entity.setField( uuidField ); MvccEntity saved = new MvccEntityImpl( id, version, MvccEntity.Status.PARTIAL, Optional.of( entity ) ); serializationStrategy.write( context, saved ).execute(); }
@Override public MutationBatch write( final ApplicationScope applicationScope, final MvccEntity entity ) { Preconditions.checkNotNull( applicationScope, "applicationScope is required" ); Preconditions.checkNotNull( entity, "entity is required" ); final UUID colName = entity.getVersion(); final Id entityId = entity.getId(); return doWrite( applicationScope, entityId, new RowOp() { @Override public void doOp( final ColumnListMutation<UUID> colMutation ) { colMutation.putColumn( colName, getEntitySerializer() .toByteBuffer( new EntityWrapper( entity.getStatus(), entity.getEntity() ) ) ); } } ); }
MvccEntitySerializationStrategyImpl implements MvccEntitySerializationStrategy { @Override public MutationBatch write( final ApplicationScope applicationScope, final MvccEntity entity ) { Preconditions.checkNotNull( applicationScope, "applicationScope is required" ); Preconditions.checkNotNull( entity, "entity is required" ); final UUID colName = entity.getVersion(); final Id entityId = entity.getId(); return doWrite( applicationScope, entityId, new RowOp() { @Override public void doOp( final ColumnListMutation<UUID> colMutation ) { colMutation.putColumn( colName, getEntitySerializer() .toByteBuffer( new EntityWrapper( entity.getStatus(), entity.getEntity() ) ) ); } } ); } }
MvccEntitySerializationStrategyImpl implements MvccEntitySerializationStrategy { @Override public MutationBatch write( final ApplicationScope applicationScope, final MvccEntity entity ) { Preconditions.checkNotNull( applicationScope, "applicationScope is required" ); Preconditions.checkNotNull( entity, "entity is required" ); final UUID colName = entity.getVersion(); final Id entityId = entity.getId(); return doWrite( applicationScope, entityId, new RowOp() { @Override public void doOp( final ColumnListMutation<UUID> colMutation ) { colMutation.putColumn( colName, getEntitySerializer() .toByteBuffer( new EntityWrapper( entity.getStatus(), entity.getEntity() ) ) ); } } ); } @Inject  MvccEntitySerializationStrategyImpl( final Keyspace keyspace, final SerializationFig serializationFig,
                                                final CassandraFig cassandraFig ); }
MvccEntitySerializationStrategyImpl implements MvccEntitySerializationStrategy { @Override public MutationBatch write( final ApplicationScope applicationScope, final MvccEntity entity ) { Preconditions.checkNotNull( applicationScope, "applicationScope is required" ); Preconditions.checkNotNull( entity, "entity is required" ); final UUID colName = entity.getVersion(); final Id entityId = entity.getId(); return doWrite( applicationScope, entityId, new RowOp() { @Override public void doOp( final ColumnListMutation<UUID> colMutation ) { colMutation.putColumn( colName, getEntitySerializer() .toByteBuffer( new EntityWrapper( entity.getStatus(), entity.getEntity() ) ) ); } } ); } @Inject  MvccEntitySerializationStrategyImpl( final Keyspace keyspace, final SerializationFig serializationFig,
                                                final CassandraFig cassandraFig ); @Override MutationBatch write( final ApplicationScope applicationScope, final MvccEntity entity ); @Override EntitySet load( final ApplicationScope applicationScope, final Collection<Id> entityIds,
                           final UUID maxVersion ); @Override Iterator<MvccEntity> loadDescendingHistory( final ApplicationScope applicationScope, final Id entityId,
                                                       final UUID version, final int fetchSize ); @Override Iterator<MvccEntity> loadAscendingHistory( final ApplicationScope applicationScope, final Id entityId,
                                                      final UUID version, final int fetchSize ); @Override Optional<MvccEntity> load( final ApplicationScope scope, final Id entityId ); @Override MutationBatch mark( final ApplicationScope applicationScope, final Id entityId, final UUID version ); @Override MutationBatch delete( final ApplicationScope applicationScope, final Id entityId, final UUID version ); @Override java.util.Collection getColumnFamilies(); @Override Collection<TableDefinition> getTables(); }
MvccEntitySerializationStrategyImpl implements MvccEntitySerializationStrategy { @Override public MutationBatch write( final ApplicationScope applicationScope, final MvccEntity entity ) { Preconditions.checkNotNull( applicationScope, "applicationScope is required" ); Preconditions.checkNotNull( entity, "entity is required" ); final UUID colName = entity.getVersion(); final Id entityId = entity.getId(); return doWrite( applicationScope, entityId, new RowOp() { @Override public void doOp( final ColumnListMutation<UUID> colMutation ) { colMutation.putColumn( colName, getEntitySerializer() .toByteBuffer( new EntityWrapper( entity.getStatus(), entity.getEntity() ) ) ); } } ); } @Inject  MvccEntitySerializationStrategyImpl( final Keyspace keyspace, final SerializationFig serializationFig,
                                                final CassandraFig cassandraFig ); @Override MutationBatch write( final ApplicationScope applicationScope, final MvccEntity entity ); @Override EntitySet load( final ApplicationScope applicationScope, final Collection<Id> entityIds,
                           final UUID maxVersion ); @Override Iterator<MvccEntity> loadDescendingHistory( final ApplicationScope applicationScope, final Id entityId,
                                                       final UUID version, final int fetchSize ); @Override Iterator<MvccEntity> loadAscendingHistory( final ApplicationScope applicationScope, final Id entityId,
                                                      final UUID version, final int fetchSize ); @Override Optional<MvccEntity> load( final ApplicationScope scope, final Id entityId ); @Override MutationBatch mark( final ApplicationScope applicationScope, final Id entityId, final UUID version ); @Override MutationBatch delete( final ApplicationScope applicationScope, final Id entityId, final UUID version ); @Override java.util.Collection getColumnFamilies(); @Override Collection<TableDefinition> getTables();  }