use of org.neo4j.kernel.api.constraints.RelationshipPropertyExistenceConstraint in project neo4j by neo4j.
the class GraphDbStructureGuide method showUniqueConstraints.
private void showUniqueConstraints(DbStructureVisitor visitor, ReadOperations read, TokenNameLookup nameLookup) {
Iterator<ConstraintDescriptor> constraints = read.constraintsGetAll();
while (constraints.hasNext()) {
PropertyConstraint constraint = ConstraintBoundary.map(constraints.next());
String userDescription = constraint.userDescription(nameLookup);
if (constraint instanceof UniquenessConstraint) {
visitor.visitUniqueConstraint((UniquenessConstraint) constraint, userDescription);
} else if (constraint instanceof NodePropertyExistenceConstraint) {
NodePropertyExistenceConstraint existenceConstraint = (NodePropertyExistenceConstraint) constraint;
visitor.visitNodePropertyExistenceConstraint(existenceConstraint, userDescription);
} else if (constraint instanceof RelationshipPropertyExistenceConstraint) {
RelationshipPropertyExistenceConstraint existenceConstraint = (RelationshipPropertyExistenceConstraint) constraint;
visitor.visitRelationshipPropertyExistenceConstraint(existenceConstraint, userDescription);
} else {
throw new IllegalArgumentException("Unknown constraint type: " + constraint.getClass() + ", " + "constraint: " + constraint);
}
}
}
Aggregations