Search in sources :

Example 21 with RelationshipItem

use of org.neo4j.storageengine.api.RelationshipItem in project neo4j by neo4j.

the class NeoStoresTest method relAddProperty.

private DefinedProperty relAddProperty(long relationshipId, int key, Object value) {
    DefinedProperty property = Property.property(key, value);
    Property oldProperty = Property.noRelationshipProperty(relationshipId, key);
    try (StorageStatement statement = storeLayer.newStatement();
        Cursor<RelationshipItem> cursor = statement.acquireSingleRelationshipCursor(relationshipId)) {
        if (cursor.next()) {
            Property fetched = getProperty(key, statement, cursor.get().nextPropertyId());
            if (fetched != null) {
                oldProperty = fetched;
            }
        }
    }
    transaction.relationshipDoReplaceProperty(relationshipId, oldProperty, property);
    return property;
}
Also used : DefinedProperty(org.neo4j.kernel.api.properties.DefinedProperty) StorageStatement(org.neo4j.storageengine.api.StorageStatement) Property(org.neo4j.kernel.api.properties.Property) DefinedProperty(org.neo4j.kernel.api.properties.DefinedProperty) RelationshipItem(org.neo4j.storageengine.api.RelationshipItem)

Aggregations

RelationshipItem (org.neo4j.storageengine.api.RelationshipItem)21 DefinedProperty (org.neo4j.kernel.api.properties.DefinedProperty)7 PropertyItem (org.neo4j.storageengine.api.PropertyItem)6 NodeItem (org.neo4j.storageengine.api.NodeItem)5 Test (org.junit.Test)4 Property (org.neo4j.kernel.api.properties.Property)4 KernelStatement (org.neo4j.kernel.impl.api.KernelStatement)3 StorageProperty (org.neo4j.storageengine.api.StorageProperty)3 NodeState (org.neo4j.storageengine.api.txstate.NodeState)3 IOException (java.io.IOException)2 InterruptedIOException (java.io.InterruptedIOException)2 HashMap (java.util.HashMap)2 NoSuchElementException (java.util.NoSuchElementException)2 DataWriteOperations (org.neo4j.kernel.api.DataWriteOperations)2 EntityNotFoundException (org.neo4j.kernel.api.exceptions.EntityNotFoundException)2 PropertyKeyIdNotFoundKernelException (org.neo4j.kernel.api.exceptions.PropertyKeyIdNotFoundKernelException)2 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 Cursor (org.neo4j.cursor.Cursor)1 NotFoundException (org.neo4j.graphdb.NotFoundException)1 Relationship (org.neo4j.graphdb.Relationship)1