use of org.neo4j.kernel.api.schema_new.SchemaDescriptor in project neo4j by neo4j.
the class SchemaRuleSerialization method readConstraintRule.
// READ CONSTRAINT
private static ConstraintRule readConstraintRule(long id, ByteBuffer source) throws MalformedSchemaRuleException {
SchemaDescriptor schema;
byte constraintRuleType = source.get();
String name;
switch(constraintRuleType) {
case EXISTS_CONSTRAINT:
schema = readSchema(source);
name = readRuleName(id, ConstraintRule.class, source);
return ConstraintRule.constraintRule(id, ConstraintDescriptorFactory.existsForSchema(schema), name);
case UNIQUE_CONSTRAINT:
long ownedIndex = source.getLong();
schema = readSchema(source);
UniquenessConstraintDescriptor descriptor = ConstraintDescriptorFactory.uniqueForSchema(schema);
name = readRuleName(id, ConstraintRule.class, source);
return ConstraintRule.constraintRule(id, descriptor, ownedIndex, name);
default:
throw new MalformedSchemaRuleException(format("Got unknown constraint rule type '%d'.", constraintRuleType));
}
}
Aggregations