use of org.neo4j.kernel.api.properties.Property in project neo4j by neo4j.
the class NeoStoreIndexStoreViewTest method shouldReadProperties.
@Test
public void shouldReadProperties() throws EntityNotFoundException {
Property property = storeView.getProperty(alistair.getId(), propertyKeyId);
assertTrue(property.valueEquals("Alistair"));
}
use of org.neo4j.kernel.api.properties.Property in project neo4j by neo4j.
the class CompositeDuplicateCheckingCollector method doCollect.
@Override
protected void doCollect(int doc) throws IOException, KernelException, IndexEntryConflictException {
Document document = reader.document(doc);
long nodeId = LuceneDocumentStructure.getNodeId(document);
Property[] properties = new Property[propertyKeyIds.length];
Object[] values = new Object[propertyKeyIds.length];
for (int i = 0; i < properties.length; i++) {
properties[i] = accessor.getProperty(nodeId, propertyKeyIds[i]);
values[i] = properties[i].value();
}
// We either have to find the first conflicting entry set element,
// or append one for the property we just fetched:
CompositeEntrySet current = actualValues;
scan: do {
for (int i = 0; i < CompositeEntrySet.INCREMENT; i++) {
Object[] currentValues = current.values[i];
if (current.nodeId[i] == StatementConstants.NO_SUCH_NODE) {
current.values[i] = values;
current.nodeId[i] = nodeId;
if (i == CompositeEntrySet.INCREMENT - 1) {
current.next = new CompositeEntrySet();
}
break scan;
} else if (propertyValuesEqual(properties, currentValues)) {
throw new IndexEntryConflictException(current.nodeId[i], nodeId, OrderedPropertyValues.ofUndefined(currentValues));
}
}
current = current.next;
} while (current != null);
}
use of org.neo4j.kernel.api.properties.Property in project neo4j by neo4j.
the class DuplicateCheckingCollector method doCollect.
protected void doCollect(int doc) throws IOException, KernelException, IndexEntryConflictException {
Document document = reader.document(doc);
long nodeId = LuceneDocumentStructure.getNodeId(document);
Property property = accessor.getProperty(nodeId, propertyKeyId);
// We either have to find the first conflicting entry set element,
// or append one for the property we just fetched:
EntrySet current = actualValues;
scan: do {
for (int i = 0; i < EntrySet.INCREMENT; i++) {
Object value = current.value[i];
if (current.nodeId[i] == StatementConstants.NO_SUCH_NODE) {
current.value[i] = property.value();
current.nodeId[i] = nodeId;
if (i == EntrySet.INCREMENT - 1) {
current.next = new EntrySet();
}
break scan;
} else if (property.valueEquals(value)) {
throw new IndexEntryConflictException(current.nodeId[i], nodeId, value);
}
}
current = current.next;
} while (current != null);
}
use of org.neo4j.kernel.api.properties.Property in project neo4j by neo4j.
the class StateOperationsAutoIndexingTest method shouldSignalRelationshipPropertyChangedToAutoIndex.
@Test
public void shouldSignalRelationshipPropertyChangedToAutoIndex() throws Exception {
// Given
int propertyKeyId = 1;
DefinedProperty property = property(propertyKeyId, "Hello!");
PropertyItem existingProperty = mock(PropertyItem.class);
when(existingProperty.propertyKeyId()).thenReturn(property.propertyKeyId());
when(existingProperty.value()).thenReturn("Goodbye!");
RelationshipItem relationship = mock(RelationshipItem.class);
when(storeStmt.acquireSingleRelationshipCursor(1337)).thenReturn(cursor(relationship));
when(storeLayer.relationshipGetProperty(storeStmt, relationship, propertyKeyId)).thenReturn(cursor(existingProperty));
// When
context.relationshipSetProperty(stmt, 1337, property);
// Then
verify(relOps).propertyChanged(eq(writeOps), eq(1337L), any(Property.class), eq(property));
}
use of org.neo4j.kernel.api.properties.Property 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;
}
Aggregations