use of org.neo4j.kernel.api.exceptions.PropertyKeyIdNotFoundKernelException in project neo4j by neo4j.
the class InternalAutoIndexOperations method propertyChanged.
@Override
public void propertyChanged(DataWriteOperations ops, long entityId, Property oldProperty, Property newProperty) throws AutoIndexingKernelException {
if (enabled) {
try {
String name = propertyKeyLookup.getTokenById(oldProperty.propertyKeyId()).name();
if (propertyKeysToInclude.get().contains(name)) {
ensureIndexExists(ops);
type.remove(ops, entityId, name, oldProperty.value());
type.add(ops, entityId, name, newProperty.value());
}
} catch (LegacyIndexNotFoundKernelException | EntityNotFoundException | PropertyNotFoundException e) {
throw new AutoIndexingKernelException(e);
} catch (TokenNotFoundException e) {
// KernelException now
throw new AutoIndexingKernelException(new PropertyKeyIdNotFoundKernelException(oldProperty.propertyKeyId(), e));
}
}
}
use of org.neo4j.kernel.api.exceptions.PropertyKeyIdNotFoundKernelException in project neo4j by neo4j.
the class GraphPropertiesProxy method getAllProperties.
@Override
public Map<String, Object> getAllProperties() {
try (Statement statement = actions.statement()) {
Map<String, Object> properties = new HashMap<>();
ReadOperations readOperations = statement.readOperations();
PrimitiveIntIterator propertyKeys = readOperations.graphGetPropertyKeys();
while (propertyKeys.hasNext()) {
int propertyKeyId = propertyKeys.next();
properties.put(readOperations.propertyKeyGetName(propertyKeyId), readOperations.graphGetProperty(propertyKeyId));
}
return properties;
} catch (PropertyKeyIdNotFoundKernelException e) {
throw new IllegalStateException("Property key retrieved through kernel API should exist.", e);
}
}
use of org.neo4j.kernel.api.exceptions.PropertyKeyIdNotFoundKernelException in project neo4j by neo4j.
the class NodeProxy method getPropertyKeys.
@Override
public Iterable<String> getPropertyKeys() {
try (Statement statement = actions.statement()) {
List<String> keys = new ArrayList<>();
PrimitiveIntIterator properties = statement.readOperations().nodeGetPropertyKeys(getId());
while (properties.hasNext()) {
keys.add(statement.readOperations().propertyKeyGetName(properties.next()));
}
return keys;
} catch (EntityNotFoundException e) {
throw new NotFoundException("Node not found", e);
} catch (PropertyKeyIdNotFoundKernelException e) {
throw new IllegalStateException("Property key retrieved through kernel API should exist.", e);
}
}
use of org.neo4j.kernel.api.exceptions.PropertyKeyIdNotFoundKernelException in project neo4j by neo4j.
the class RelationshipProxy method getAllProperties.
@Override
public Map<String, Object> getAllProperties() {
try (Statement statement = actions.statement()) {
try (Cursor<RelationshipItem> relationship = statement.readOperations().relationshipCursorById(getId())) {
try (Cursor<PropertyItem> propertyCursor = statement.readOperations().relationshipGetProperties(relationship.get())) {
Map<String, Object> properties = new HashMap<>();
// Get all properties
while (propertyCursor.next()) {
String name = statement.readOperations().propertyKeyGetName(propertyCursor.get().propertyKeyId());
properties.put(name, propertyCursor.get().value());
}
return properties;
}
} catch (EntityNotFoundException e) {
throw new NotFoundException("Relationship not found", e);
}
} catch (PropertyKeyIdNotFoundKernelException e) {
throw new IllegalStateException("Property key retrieved through kernel API should exist.", e);
}
}
use of org.neo4j.kernel.api.exceptions.PropertyKeyIdNotFoundKernelException in project neo4j by neo4j.
the class RelationshipProxy method getPropertyKeys.
@Override
public Iterable<String> getPropertyKeys() {
try (Statement statement = actions.statement()) {
List<String> keys = new ArrayList<>();
PrimitiveIntIterator properties = statement.readOperations().relationshipGetPropertyKeys(getId());
while (properties.hasNext()) {
keys.add(statement.readOperations().propertyKeyGetName(properties.next()));
}
return keys;
} catch (EntityNotFoundException e) {
throw new NotFoundException("Relationship not found", e);
} catch (PropertyKeyIdNotFoundKernelException e) {
throw new IllegalStateException("Property key retrieved through kernel API should exist.");
}
}
Aggregations