use of org.neo4j.internal.kernel.api.exceptions.PropertyKeyIdNotFoundKernelException in project neo4j by neo4j.
the class NodeEntity method getAllProperties.
public Map<String, Object> getAllProperties(NodeCursor nodes, PropertyCursor propertyCursor) {
KernelTransaction transaction = internalTransaction.kernelTransaction();
Map<String, Object> properties = new HashMap<>();
try {
TokenRead token = transaction.tokenRead();
if (nodes.isClosed() || nodes.nodeReference() != getId()) {
singleNode(transaction, nodes);
}
nodes.properties(propertyCursor);
while (propertyCursor.next()) {
properties.put(token.propertyKeyName(propertyCursor.propertyKey()), propertyCursor.propertyValue().asObjectCopy());
}
} catch (PropertyKeyIdNotFoundKernelException e) {
throw new IllegalStateException("Property key retrieved through kernel API should exist.", e);
}
return properties;
}
use of org.neo4j.internal.kernel.api.exceptions.PropertyKeyIdNotFoundKernelException in project neo4j by neo4j.
the class RelationshipEntity method getPropertyKeys.
@Override
public Iterable<String> getPropertyKeys() {
KernelTransaction transaction = internalTransaction.kernelTransaction();
List<String> keys = new ArrayList<>();
try {
RelationshipScanCursor relationships = transaction.ambientRelationshipCursor();
PropertyCursor properties = transaction.ambientPropertyCursor();
singleRelationship(transaction, relationships);
TokenRead token = transaction.tokenRead();
relationships.properties(properties);
while (properties.next()) {
keys.add(token.propertyKeyName(properties.propertyKey()));
}
} catch (PropertyKeyIdNotFoundKernelException e) {
throw new IllegalStateException("Property key retrieved through kernel API should exist.", e);
}
return keys;
}
use of org.neo4j.internal.kernel.api.exceptions.PropertyKeyIdNotFoundKernelException in project neo4j by neo4j.
the class RelationshipEntity method getAllProperties.
public Map<String, Object> getAllProperties(PropertyCursor propertyCursor) {
KernelTransaction transaction = internalTransaction.kernelTransaction();
Map<String, Object> properties = new HashMap<>();
try {
RelationshipScanCursor relationships = transaction.ambientRelationshipCursor();
TokenRead token = transaction.tokenRead();
singleRelationship(transaction, relationships);
relationships.properties(propertyCursor);
while (propertyCursor.next()) {
properties.put(token.propertyKeyName(propertyCursor.propertyKey()), propertyCursor.propertyValue().asObjectCopy());
}
} catch (PropertyKeyIdNotFoundKernelException e) {
throw new IllegalStateException("Property key retrieved through kernel API should exist.", e);
}
return properties;
}
use of org.neo4j.internal.kernel.api.exceptions.PropertyKeyIdNotFoundKernelException in project neo4j by neo4j.
the class TxStateTransactionDataSnapshot method snapshotModifiedNodes.
private void snapshotModifiedNodes(MemoryTracker memoryTracker, StorageNodeCursor node, StoragePropertyCursor properties, TokenRead tokenRead) throws PropertyKeyIdNotFoundKernelException {
for (NodeState nodeState : state.modifiedNodes()) {
Iterator<StorageProperty> added = nodeState.addedAndChangedProperties();
long nodeId = nodeState.getId();
while (added.hasNext()) {
StorageProperty property = added.next();
var entryView = createNodePropertyEntryView(memoryTracker, tokenRead, nodeId, property.propertyKeyId(), property.value(), committedValue(nodeState, property.propertyKeyId(), node, properties));
assignedNodeProperties.add(entryView);
}
nodeState.removedProperties().each(id -> {
try {
removedNodeProperties.add(createNodePropertyEntryView(memoryTracker, tokenRead, nodeId, id, null, committedValue(nodeState, id, node, properties)));
} catch (PropertyKeyIdNotFoundKernelException e) {
throw new IllegalStateException("Not existing node properties was modified for node " + nodeId, e);
}
});
final LongDiffSets labels = nodeState.labelDiffSets();
addLabelEntriesTo(nodeId, labels.getAdded(), assignedLabels);
addLabelEntriesTo(nodeId, labels.getRemoved(), removedLabels);
}
}
use of org.neo4j.internal.kernel.api.exceptions.PropertyKeyIdNotFoundKernelException in project neo4j by neo4j.
the class TxStateTransactionDataSnapshot method snapshotRemovedRelationships.
private void snapshotRemovedRelationships(MemoryTracker memoryTracker, StoragePropertyCursor properties, TokenRead tokenRead) {
state.addedAndRemovedRelationships().getRemoved().each(relId -> {
Relationship relationship = relationship(relId);
this.relationship.single(relId);
if (this.relationship.next()) {
this.relationship.properties(properties);
while (properties.next()) {
try {
removedRelationshipProperties.add(createRelationshipPropertyEntryView(memoryTracker, tokenRead, relationship, properties.propertyKey(), null, properties.propertyValue()));
} catch (PropertyKeyIdNotFoundKernelException e) {
throw new IllegalStateException("Not existing node properties was modified for relationship " + relId, e);
}
}
}
});
}
Aggregations