use of org.neo4j.helpers.collection.CastingIterator in project neo4j by neo4j.
the class ConstraintEnforcingEntityOperations method nodeSetProperty.
@Override
public Property nodeSetProperty(KernelStatement state, long nodeId, DefinedProperty property) throws EntityNotFoundException, AutoIndexingKernelException, InvalidTransactionTypeKernelException, ConstraintValidationException {
try (Cursor<NodeItem> cursor = nodeCursorById(state, nodeId)) {
NodeItem node = cursor.get();
Iterator<ConstraintDescriptor> constraints = getConstraintsInvolvingProperty(state, property.propertyKeyId());
Iterator<UniquenessConstraintDescriptor> uniquenessConstraints = new CastingIterator<>(constraints, UniquenessConstraintDescriptor.class);
nodeSchemaMatcher.onMatchingSchema(state, uniquenessConstraints, node, property.propertyKeyId(), constraint -> {
validateNoExistingNodeWithExactValues(state, constraint, getAllPropertyValues(state, constraint.schema(), node, property), node.id());
});
}
return entityWriteOperations.nodeSetProperty(state, nodeId, property);
}
Aggregations