use of org.neo4j.kernel.api.exceptions.PropertyNotFoundException in project neo4j by neo4j.
the class RelationshipProxy method getProperty.
@Override
public Object getProperty(String key) {
if (null == key) {
throw new IllegalArgumentException("(null) property key is not allowed");
}
try (Statement statement = actions.statement()) {
try {
int propertyId = statement.readOperations().propertyKeyGetForName(key);
if (propertyId == KeyReadOperations.NO_SUCH_PROPERTY_KEY) {
throw new NotFoundException(String.format("No such property, '%s'.", key));
}
Object value = statement.readOperations().relationshipGetProperty(getId(), propertyId);
if (value == null) {
throw new PropertyNotFoundException(propertyId, EntityType.RELATIONSHIP, getId());
}
return value;
} catch (EntityNotFoundException | PropertyNotFoundException e) {
throw new NotFoundException(e.getUserMessage(new StatementTokenNameLookup(statement.readOperations())), e);
}
}
}
use of org.neo4j.kernel.api.exceptions.PropertyNotFoundException in project neo4j by neo4j.
the class InternalAutoIndexOperations method propertyAdded.
@Override
public void propertyAdded(DataWriteOperations ops, long entityId, Property property) throws AutoIndexingKernelException {
if (enabled) {
try {
String name = propertyKeyLookup.getTokenById(property.propertyKeyId()).name();
if (propertyKeysToInclude.get().contains(name)) {
ensureIndexExists(ops);
type.add(ops, entityId, name, property.value());
}
} catch (LegacyIndexNotFoundKernelException | EntityNotFoundException | PropertyNotFoundException e) {
throw new AutoIndexingKernelException(e);
} catch (TokenNotFoundException e) {
// KernelException now
throw new AutoIndexingKernelException(new PropertyKeyIdNotFoundKernelException(property.propertyKeyId(), e));
}
}
}
use of org.neo4j.kernel.api.exceptions.PropertyNotFoundException in project neo4j by neo4j.
the class NodeProxy method getProperty.
@Override
public Object getProperty(String key) throws NotFoundException {
if (null == key) {
throw new IllegalArgumentException("(null) property key is not allowed");
}
try (Statement statement = actions.statement()) {
try {
int propertyKeyId = statement.readOperations().propertyKeyGetForName(key);
if (propertyKeyId == KeyReadOperations.NO_SUCH_PROPERTY_KEY) {
throw new NotFoundException(format("No such property, '%s'.", key));
}
Object value = statement.readOperations().nodeGetProperty(nodeId, propertyKeyId);
if (value == null) {
throw new PropertyNotFoundException(propertyKeyId, EntityType.NODE, nodeId);
}
return value;
} catch (EntityNotFoundException | PropertyNotFoundException e) {
throw new NotFoundException(e.getUserMessage(new StatementTokenNameLookup(statement.readOperations())), e);
}
}
}
use of org.neo4j.kernel.api.exceptions.PropertyNotFoundException 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.PropertyNotFoundException in project neo4j by neo4j.
the class GraphPropertiesProxy method getProperty.
@Override
public Object getProperty(String key) {
if (null == key) {
throw new IllegalArgumentException("(null) property key is not allowed");
}
try (Statement statement = actions.statement()) {
try {
int propertyKeyId = statement.readOperations().propertyKeyGetForName(key);
if (propertyKeyId == KeyReadOperations.NO_SUCH_PROPERTY_KEY) {
throw new NotFoundException(format("No such property, '%s'.", key));
}
Object value = statement.readOperations().graphGetProperty(propertyKeyId);
if (value == null) {
throw new PropertyNotFoundException(propertyKeyId, EntityType.GRAPH, -1);
}
return value;
} catch (PropertyNotFoundException e) {
throw new NotFoundException(e.getUserMessage(new StatementTokenNameLookup(statement.readOperations())), e);
}
}
}
Aggregations