Search in sources :

Example 1 with AutoIndexingKernelException

use of org.neo4j.kernel.api.exceptions.legacyindex.AutoIndexingKernelException in project neo4j by neo4j.

the class RelationshipProxy method setProperty.

@Override
public void setProperty(String key, Object value) {
    try (Statement statement = actions.statement()) {
        int propertyKeyId = statement.tokenWriteOperations().propertyKeyGetOrCreateForName(key);
        statement.dataWriteOperations().relationshipSetProperty(getId(), Property.property(propertyKeyId, value));
    } catch (IllegalArgumentException e) {
        // Trying to set an illegal value is a critical error - fail this transaction
        actions.failTransaction();
        throw e;
    } catch (EntityNotFoundException e) {
        throw new NotFoundException(e);
    } catch (IllegalTokenNameException e) {
        // TODO: Maybe throw more context-specific error than just IllegalArgument
        throw new IllegalArgumentException(e);
    } catch (InvalidTransactionTypeKernelException e) {
        throw new ConstraintViolationException(e.getMessage(), e);
    } catch (AutoIndexingKernelException e) {
        throw new IllegalStateException("Auto indexing encountered a failure while setting property: " + e.getMessage(), e);
    }
}
Also used : Statement(org.neo4j.kernel.api.Statement) InvalidTransactionTypeKernelException(org.neo4j.kernel.api.exceptions.InvalidTransactionTypeKernelException) NotFoundException(org.neo4j.graphdb.NotFoundException) EntityNotFoundException(org.neo4j.kernel.api.exceptions.EntityNotFoundException) PropertyNotFoundException(org.neo4j.kernel.api.exceptions.PropertyNotFoundException) ConstraintViolationException(org.neo4j.graphdb.ConstraintViolationException) EntityNotFoundException(org.neo4j.kernel.api.exceptions.EntityNotFoundException) IllegalTokenNameException(org.neo4j.kernel.api.exceptions.schema.IllegalTokenNameException) AutoIndexingKernelException(org.neo4j.kernel.api.exceptions.legacyindex.AutoIndexingKernelException)

Example 2 with AutoIndexingKernelException

use of org.neo4j.kernel.api.exceptions.legacyindex.AutoIndexingKernelException 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));
        }
    }
}
Also used : PropertyNotFoundException(org.neo4j.kernel.api.exceptions.PropertyNotFoundException) LegacyIndexNotFoundKernelException(org.neo4j.kernel.api.exceptions.legacyindex.LegacyIndexNotFoundKernelException) EntityNotFoundException(org.neo4j.kernel.api.exceptions.EntityNotFoundException) TokenNotFoundException(org.neo4j.kernel.impl.core.TokenNotFoundException) AutoIndexingKernelException(org.neo4j.kernel.api.exceptions.legacyindex.AutoIndexingKernelException) PropertyKeyIdNotFoundKernelException(org.neo4j.kernel.api.exceptions.PropertyKeyIdNotFoundKernelException)

Example 3 with AutoIndexingKernelException

use of org.neo4j.kernel.api.exceptions.legacyindex.AutoIndexingKernelException in project neo4j by neo4j.

the class InternalAutoIndexOperations method propertyRemoved.

@Override
public void propertyRemoved(DataWriteOperations ops, long entityId, int propertyKey) throws AutoIndexingKernelException {
    if (enabled) {
        try {
            String name = propertyKeyLookup.getTokenById(propertyKey).name();
            if (propertyKeysToInclude.get().contains(name)) {
                ensureIndexExists(ops);
                type.remove(ops, entityId, name);
            }
        } catch (LegacyIndexNotFoundKernelException | EntityNotFoundException e) {
            throw new AutoIndexingKernelException(e);
        } catch (TokenNotFoundException e) {
            // KernelException now
            throw new AutoIndexingKernelException(new PropertyKeyIdNotFoundKernelException(propertyKey, e));
        }
    }
}
Also used : LegacyIndexNotFoundKernelException(org.neo4j.kernel.api.exceptions.legacyindex.LegacyIndexNotFoundKernelException) EntityNotFoundException(org.neo4j.kernel.api.exceptions.EntityNotFoundException) TokenNotFoundException(org.neo4j.kernel.impl.core.TokenNotFoundException) AutoIndexingKernelException(org.neo4j.kernel.api.exceptions.legacyindex.AutoIndexingKernelException) PropertyKeyIdNotFoundKernelException(org.neo4j.kernel.api.exceptions.PropertyKeyIdNotFoundKernelException)

Example 4 with AutoIndexingKernelException

use of org.neo4j.kernel.api.exceptions.legacyindex.AutoIndexingKernelException in project neo4j by neo4j.

the class InternalAutoIndexOperations method entityRemoved.

@Override
public void entityRemoved(DataWriteOperations ops, long entityId) throws AutoIndexingKernelException {
    if (enabled) {
        try {
            ensureIndexExists(ops);
            type.remove(ops, entityId);
        } catch (LegacyIndexNotFoundKernelException | EntityNotFoundException e) {
            throw new AutoIndexingKernelException(e);
        }
    }
}
Also used : LegacyIndexNotFoundKernelException(org.neo4j.kernel.api.exceptions.legacyindex.LegacyIndexNotFoundKernelException) EntityNotFoundException(org.neo4j.kernel.api.exceptions.EntityNotFoundException) AutoIndexingKernelException(org.neo4j.kernel.api.exceptions.legacyindex.AutoIndexingKernelException)

Example 5 with AutoIndexingKernelException

use of org.neo4j.kernel.api.exceptions.legacyindex.AutoIndexingKernelException 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));
        }
    }
}
Also used : PropertyNotFoundException(org.neo4j.kernel.api.exceptions.PropertyNotFoundException) LegacyIndexNotFoundKernelException(org.neo4j.kernel.api.exceptions.legacyindex.LegacyIndexNotFoundKernelException) EntityNotFoundException(org.neo4j.kernel.api.exceptions.EntityNotFoundException) TokenNotFoundException(org.neo4j.kernel.impl.core.TokenNotFoundException) AutoIndexingKernelException(org.neo4j.kernel.api.exceptions.legacyindex.AutoIndexingKernelException) PropertyKeyIdNotFoundKernelException(org.neo4j.kernel.api.exceptions.PropertyKeyIdNotFoundKernelException)

Aggregations

EntityNotFoundException (org.neo4j.kernel.api.exceptions.EntityNotFoundException)5 AutoIndexingKernelException (org.neo4j.kernel.api.exceptions.legacyindex.AutoIndexingKernelException)5 LegacyIndexNotFoundKernelException (org.neo4j.kernel.api.exceptions.legacyindex.LegacyIndexNotFoundKernelException)4 PropertyKeyIdNotFoundKernelException (org.neo4j.kernel.api.exceptions.PropertyKeyIdNotFoundKernelException)3 PropertyNotFoundException (org.neo4j.kernel.api.exceptions.PropertyNotFoundException)3 TokenNotFoundException (org.neo4j.kernel.impl.core.TokenNotFoundException)3 ConstraintViolationException (org.neo4j.graphdb.ConstraintViolationException)1 NotFoundException (org.neo4j.graphdb.NotFoundException)1 Statement (org.neo4j.kernel.api.Statement)1 InvalidTransactionTypeKernelException (org.neo4j.kernel.api.exceptions.InvalidTransactionTypeKernelException)1 IllegalTokenNameException (org.neo4j.kernel.api.exceptions.schema.IllegalTokenNameException)1