Search in sources :

Example 1 with NodePropertyConstraint

use of org.neo4j.kernel.api.constraints.NodePropertyConstraint in project neo4j by neo4j.

the class AlreadyConstrainedException method constructUserMessage.

private static String constructUserMessage(OperationContext context, TokenNameLookup tokenNameLookup, PropertyConstraint constraint) {
    switch(context) {
        case INDEX_CREATION:
            // is is safe to cast here because we only support indexes on nodes atm
            NodePropertyConstraint nodePropertyConstraint = (NodePropertyConstraint) constraint;
            NodePropertyDescriptor descriptor = nodePropertyConstraint.descriptor();
            return messageWithLabelAndPropertyName(tokenNameLookup, INDEX_CONTEXT_FORMAT, descriptor);
        case CONSTRAINT_CREATION:
            return ALREADY_CONSTRAINED_MESSAGE_PREFIX + constraint.userDescription(tokenNameLookup);
        default:
            return format(NO_CONTEXT_FORMAT, constraint);
    }
}
Also used : NodePropertyConstraint(org.neo4j.kernel.api.constraints.NodePropertyConstraint) NodePropertyDescriptor(org.neo4j.kernel.api.schema.NodePropertyDescriptor)

Aggregations

NodePropertyConstraint (org.neo4j.kernel.api.constraints.NodePropertyConstraint)1 NodePropertyDescriptor (org.neo4j.kernel.api.schema.NodePropertyDescriptor)1