use of org.neo4j.server.rest.repr.ConstraintDefinitionRepresentation in project neo4j by neo4j.
the class DatabaseActions method createPropertyUniquenessConstraint.
public ConstraintDefinitionRepresentation createPropertyUniquenessConstraint(String labelName, Iterable<String> propertyKeys) {
ConstraintCreator constraintCreator = graphDb.schema().constraintFor(label(labelName));
for (String key : propertyKeys) {
constraintCreator = constraintCreator.assertPropertyIsUnique(key);
}
ConstraintDefinition constraintDefinition = constraintCreator.create();
return new ConstraintDefinitionRepresentation(constraintDefinition);
}
use of org.neo4j.server.rest.repr.ConstraintDefinitionRepresentation in project neo4j by neo4j.
the class TransactionWrappedDatabaseActions method createPropertyUniquenessConstraint.
@Override
public ConstraintDefinitionRepresentation createPropertyUniquenessConstraint(String labelName, Iterable<String> propertyKeys) {
try (Transaction transaction = graph.beginTx()) {
ConstraintDefinitionRepresentation constraintDefinitionRepresentation = super.createPropertyUniquenessConstraint(labelName, propertyKeys);
transaction.success();
return constraintDefinitionRepresentation;
}
}
Aggregations