Search in sources :

Example 21 with DefinedProperty

use of org.neo4j.kernel.api.properties.DefinedProperty in project neo4j by neo4j.

the class TransactionToRecordStateVisitor method visitNodePropertyChanges.

@Override
public void visitNodePropertyChanges(long id, Iterator<StorageProperty> added, Iterator<StorageProperty> changed, Iterator<Integer> removed) throws ConstraintValidationException {
    while (removed.hasNext()) {
        recordState.nodeRemoveProperty(id, removed.next());
    }
    while (changed.hasNext()) {
        DefinedProperty prop = (DefinedProperty) changed.next();
        recordState.nodeChangeProperty(id, prop.propertyKeyId(), prop.value());
    }
    while (added.hasNext()) {
        DefinedProperty prop = (DefinedProperty) added.next();
        recordState.nodeAddProperty(id, prop.propertyKeyId(), prop.value());
    }
}
Also used : DefinedProperty(org.neo4j.kernel.api.properties.DefinedProperty)

Example 22 with DefinedProperty

use of org.neo4j.kernel.api.properties.DefinedProperty in project neo4j by neo4j.

the class TransactionToRecordStateVisitor method visitGraphPropertyChanges.

@Override
public void visitGraphPropertyChanges(Iterator<StorageProperty> added, Iterator<StorageProperty> changed, Iterator<Integer> removed) {
    while (removed.hasNext()) {
        recordState.graphRemoveProperty(removed.next());
    }
    while (changed.hasNext()) {
        DefinedProperty prop = (DefinedProperty) changed.next();
        recordState.graphChangeProperty(prop.propertyKeyId(), prop.value());
    }
    while (added.hasNext()) {
        DefinedProperty prop = (DefinedProperty) added.next();
        recordState.graphAddProperty(prop.propertyKeyId(), prop.value());
    }
}
Also used : DefinedProperty(org.neo4j.kernel.api.properties.DefinedProperty)

Example 23 with DefinedProperty

use of org.neo4j.kernel.api.properties.DefinedProperty in project neo4j by neo4j.

the class OrderedPropertyValues method toString.

@Override
public String toString() {
    StringBuilder sb = new StringBuilder();
    String sep = "( ";
    for (DefinedProperty property : properties) {
        sb.append(sep);
        sep = ", ";
        sb.append(quote(property.value()));
    }
    sb.append(" )");
    return sb.toString();
}
Also used : DefinedProperty(org.neo4j.kernel.api.properties.DefinedProperty)

Example 24 with DefinedProperty

use of org.neo4j.kernel.api.properties.DefinedProperty in project neo4j by neo4j.

the class StateOperationsAutoIndexingTest method shouldSignalNodePropertyChangedToAutoIndex.

@Test
public void shouldSignalNodePropertyChangedToAutoIndex() throws Exception {
    // Given
    DefinedProperty property = property(1, "Hello!");
    PropertyItem existingProperty = mock(PropertyItem.class);
    when(existingProperty.propertyKeyId()).thenReturn(property.propertyKeyId());
    when(existingProperty.value()).thenReturn("Goodbye!");
    NodeItem node = mock(NodeItem.class);
    when(node.labels()).thenReturn(PrimitiveIntCollections.emptySet());
    when(storeStmt.acquireSingleNodeCursor(1337)).thenReturn(cursor(node));
    when(storeLayer.nodeGetProperty(eq(storeStmt), any(NodeItem.class), eq(property.propertyKeyId()))).thenReturn(cursor(existingProperty));
    // When
    context.nodeSetProperty(stmt, 1337, property);
    // Then
    verify(nodeOps).propertyChanged(eq(writeOps), eq(1337L), any(Property.class), eq(property));
}
Also used : DefinedProperty(org.neo4j.kernel.api.properties.DefinedProperty) NodeItem(org.neo4j.storageengine.api.NodeItem) PropertyItem(org.neo4j.storageengine.api.PropertyItem) Property(org.neo4j.kernel.api.properties.Property) DefinedProperty(org.neo4j.kernel.api.properties.DefinedProperty) Test(org.junit.Test)

Example 25 with DefinedProperty

use of org.neo4j.kernel.api.properties.DefinedProperty in project neo4j by neo4j.

the class StateHandlingStatementOperations method graphRemoveProperty.

@Override
public Property graphRemoveProperty(KernelStatement state, int propertyKeyId) {
    Object existingPropertyValue = graphGetProperty(state, propertyKeyId);
    if (existingPropertyValue != null) {
        DefinedProperty existingProperty = Property.property(propertyKeyId, existingPropertyValue);
        state.txState().graphDoRemoveProperty(existingProperty);
        return existingProperty;
    }
    return Property.noGraphProperty(propertyKeyId);
}
Also used : DefinedProperty(org.neo4j.kernel.api.properties.DefinedProperty)

Aggregations

DefinedProperty (org.neo4j.kernel.api.properties.DefinedProperty)47 Test (org.junit.Test)23 Pair (org.neo4j.helpers.collection.Pair)9 IOException (java.io.IOException)8 InterruptedIOException (java.io.InterruptedIOException)8 PropertyBlock (org.neo4j.kernel.impl.store.record.PropertyBlock)8 PropertyRecord (org.neo4j.kernel.impl.store.record.PropertyRecord)8 ArrayMap (org.neo4j.kernel.impl.util.ArrayMap)8 PropertyItem (org.neo4j.storageengine.api.PropertyItem)8 NodeItem (org.neo4j.storageengine.api.NodeItem)7 RelationshipItem (org.neo4j.storageengine.api.RelationshipItem)7 Property (org.neo4j.kernel.api.properties.Property)6 PropertyEntry (org.neo4j.graphdb.event.PropertyEntry)4 DataWriteOperations (org.neo4j.kernel.api.DataWriteOperations)4 NodeUpdates (org.neo4j.kernel.api.index.NodeUpdates)4 NeoStores (org.neo4j.kernel.impl.store.NeoStores)4 StorageProperty (org.neo4j.storageengine.api.StorageProperty)4 Node (org.neo4j.graphdb.Node)3 Relationship (org.neo4j.graphdb.Relationship)3 Statement (org.neo4j.kernel.api.Statement)3