private Command visitIndexRemoveCommand( ReadableChannel channel ) throws IOException { IndexCommandHeader header = readIndexCommandHeader( channel ); Number entityId = header.entityIdNeedsLong ? channel.getLong() : channel.getInt(); Object value = readIndexValue( header.valueType, channel ); RemoveCommand command = new RemoveCommand(); command.init( header.indexNameId, header.entityType, entityId.longValue(), header.keyId, value ); return command; }
private Command visitIndexRemoveCommand( ReadableChannel channel ) throws IOException { IndexCommandHeader header = readIndexCommandHeader( channel ); Number entityId = header.entityIdNeedsLong ? channel.getLong() : channel.getInt(); Object value = readIndexValue( header.valueType, channel ); RemoveCommand command = new RemoveCommand(); command.init( header.indexNameId, header.entityType, entityId.longValue(), header.keyId, value ); return command; }
private Command visitIndexRemoveCommand( ReadableChannel channel ) throws IOException { IndexCommandHeader header = readIndexCommandHeader( channel ); Number entityId = header.entityIdNeedsLong ? channel.getLong() : channel.getInt(); Object value = readIndexValue( header.valueType, channel ); RemoveCommand command = new RemoveCommand(); command.init( header.indexNameId, header.entityType, entityId.longValue(), header.keyId, value ); return command; }
private Command visitIndexRemoveCommand( ReadableChannel channel ) throws IOException { IndexCommandHeader header = readIndexCommandHeader( channel ); Number entityId = header.entityIdNeedsLong ? channel.getLong() : channel.getInt(); Object value = readIndexValue( header.valueType, channel ); RemoveCommand command = new RemoveCommand(); command.init( header.indexNameId, header.entityType, entityId.longValue(), header.keyId, value ); return command; }
@Override public void removeRelationship( String indexName, long id, String keyOrNull, Object valueOrNull ) { RemoveCommand command = new RemoveCommand(); command.init( definitions().getOrAssignIndexNameId( indexName ), IndexEntityType.Relationship.id(), id, definitions().getOrAssignKeyId( keyOrNull ), valueOrNull ); addCommand( indexName, command ); }
@Override public void removeNode( String indexName, long id, String keyOrNull, Object valueOrNull ) { RemoveCommand command = new RemoveCommand(); command.init( definitions().getOrAssignIndexNameId( indexName ), IndexEntityType.Node.id(), id, definitions().getOrAssignKeyId( keyOrNull ), valueOrNull ); addCommand( indexName, command ); }
private Command visitIndexRemoveCommand( ReadableChannel channel ) throws IOException { IndexCommandHeader header = readIndexCommandHeader( channel ); Number entityId = header.entityIdNeedsLong ? channel.getLong() : channel.getInt(); Object value = readIndexValue( header.valueType, channel ); RemoveCommand command = new RemoveCommand(); command.init( header.indexNameId, header.entityType, entityId.longValue(), header.keyId, value ); return command; }
private Command visitIndexRemoveCommand( ReadableChannel channel ) throws IOException { IndexCommandHeader header = readIndexCommandHeader( channel ); Number entityId = header.entityIdNeedsLong ? channel.getLong() : channel.getInt(); Object value = readIndexValue( header.valueType, channel ); RemoveCommand command = new RemoveCommand(); command.init( header.indexNameId, header.entityType, entityId.longValue(), header.keyId, value ); return command; }
private Command visitIndexRemoveCommand( ReadableChannel channel ) throws IOException { IndexCommandHeader header = readIndexCommandHeader( channel ); Number entityId = header.entityIdNeedsLong ? channel.getLong() : channel.getInt(); Object value = readIndexValue( header.valueType, channel ); RemoveCommand command = new RemoveCommand(); command.init( header.indexNameId, header.entityType, entityId.longValue(), header.keyId, value ); return command; }
@Test public void shouldReadNoKeyIdAsMinusOne() throws Exception { // GIVEN InMemoryClosableChannel channel = new InMemoryClosableChannel(); IndexDefineCommand definitions = new IndexDefineCommand(); int indexNameId = 10; definitions.init( ObjectIntHashMap.newWithKeysValues( "myindex", indexNameId ), new ObjectIntHashMap<>() ); definitions.serialize( channel ); RemoveCommand removeCommand = new IndexCommand.RemoveCommand(); removeCommand.init( indexNameId, IndexEntityType.Node.id(), 1234, -1, null ); removeCommand.serialize( channel ); // WHEN PhysicalLogCommandReaderV2_2_4 reader = new PhysicalLogCommandReaderV2_2_4(); assertTrue( reader.read( channel ) instanceof IndexDefineCommand ); RemoveCommand readRemoveCommand = (RemoveCommand) reader.read( channel ); // THEN assertEquals( removeCommand.getIndexNameId(), readRemoveCommand.getIndexNameId() ); assertEquals( removeCommand.getEntityType(), readRemoveCommand.getEntityType() ); assertEquals( removeCommand.getEntityId(), readRemoveCommand.getEntityId() ); assertEquals( removeCommand.getKeyId(), readRemoveCommand.getKeyId() ); assertNull( removeCommand.getValue() ); } }
private static Command removeRelationship( int index, long id, int key, Object value ) { IndexCommand.RemoveCommand command = new IndexCommand.RemoveCommand(); command.init( index, IndexEntityType.Relationship.id(), id, key, value ); return command; }
@Override public void removeRelationship( String indexName, long id, String keyOrNull, Object valueOrNull ) { RemoveCommand command = new RemoveCommand(); command.init( definitions().getOrAssignIndexNameId( indexName ), IndexEntityType.Relationship.id(), id, definitions().getOrAssignKeyId( keyOrNull ), valueOrNull ); addCommand( indexName, command ); }
private Command visitIndexRemoveCommand( ReadableChannel channel ) throws IOException { IndexCommandHeader header = readIndexCommandHeader( channel ); Number entityId = header.entityIdNeedsLong ? channel.getLong() : channel.getInt(); Object value = readIndexValue( header.valueType, channel ); RemoveCommand command = new RemoveCommand(); command.init( header.indexNameId, header.entityType, entityId.longValue(), header.keyId, value ); return command; }
private static Command removeNode( int index, long id, int key, Object value ) { IndexCommand.RemoveCommand command = new IndexCommand.RemoveCommand(); command.init( index, IndexEntityType.Node.id(), id, key, value ); return command; }
@Override public void removeNode( String indexName, long id, String keyOrNull, Object valueOrNull ) { RemoveCommand command = new RemoveCommand(); command.init( definitions().getOrAssignIndexNameId( indexName ), IndexEntityType.Node.id(), id, definitions().getOrAssignKeyId( keyOrNull ), valueOrNull ); addCommand( indexName, command ); }