Search in sources :

Example 1 with NodeExistenceConstraintDescriptor

use of org.neo4j.kernel.api.schema_new.constaints.NodeExistenceConstraintDescriptor in project neo4j by neo4j.

the class DataIntegrityValidatingStatementOperations method nodePropertyExistenceConstraintCreate.

@Override
public NodeExistenceConstraintDescriptor nodePropertyExistenceConstraintCreate(KernelStatement state, LabelSchemaDescriptor descriptor) throws AlreadyConstrainedException, CreateConstraintFailureException, RepeatedPropertyInCompositeSchemaException {
    assertValidDescriptor(descriptor, OperationContext.CONSTRAINT_CREATION);
    ConstraintDescriptor constraint = ConstraintDescriptorFactory.existsForSchema(descriptor);
    assertConstraintDoesNotExist(state, constraint);
    return schemaWriteDelegate.nodePropertyExistenceConstraintCreate(state, descriptor);
}
Also used : UniquenessConstraintDescriptor(org.neo4j.kernel.api.schema_new.constaints.UniquenessConstraintDescriptor) NodeExistenceConstraintDescriptor(org.neo4j.kernel.api.schema_new.constaints.NodeExistenceConstraintDescriptor) ConstraintDescriptor(org.neo4j.kernel.api.schema_new.constaints.ConstraintDescriptor) RelExistenceConstraintDescriptor(org.neo4j.kernel.api.schema_new.constaints.RelExistenceConstraintDescriptor)

Example 2 with NodeExistenceConstraintDescriptor

use of org.neo4j.kernel.api.schema_new.constaints.NodeExistenceConstraintDescriptor in project neo4j by neo4j.

the class StateHandlingStatementOperations method nodePropertyExistenceConstraintCreate.

@Override
public NodeExistenceConstraintDescriptor nodePropertyExistenceConstraintCreate(KernelStatement state, LabelSchemaDescriptor descriptor) throws CreateConstraintFailureException {
    NodeExistenceConstraintDescriptor constraint = ConstraintDescriptorFactory.existsForSchema(descriptor);
    state.txState().constraintDoAdd(constraint);
    return constraint;
}
Also used : NodeExistenceConstraintDescriptor(org.neo4j.kernel.api.schema_new.constaints.NodeExistenceConstraintDescriptor)

Aggregations

NodeExistenceConstraintDescriptor (org.neo4j.kernel.api.schema_new.constaints.NodeExistenceConstraintDescriptor)2 ConstraintDescriptor (org.neo4j.kernel.api.schema_new.constaints.ConstraintDescriptor)1 RelExistenceConstraintDescriptor (org.neo4j.kernel.api.schema_new.constaints.RelExistenceConstraintDescriptor)1 UniquenessConstraintDescriptor (org.neo4j.kernel.api.schema_new.constaints.UniquenessConstraintDescriptor)1