// READ CONSTRAINT //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static ConstraintRule readConstraintRule(long id, ByteBuffer source) throws org.neo4j.internal.kernel.api.exceptions.schema.MalformedSchemaRuleException private static ConstraintRule ReadConstraintRule(long id, ByteBuffer source) { SchemaDescriptor schema; sbyte constraintRuleType = source.get(); string name; switch (constraintRuleType) { case EXISTS_CONSTRAINT: schema = ReadSchema(source); name = ReadRuleName(source).orElse(null); return(ConstraintRule.ConstraintRuleConflict(id, ConstraintDescriptorFactory.existsForSchema(schema), name)); case UNIQUE_CONSTRAINT: long ownedUniqueIndex = source.Long; schema = ReadSchema(source); UniquenessConstraintDescriptor descriptor = ConstraintDescriptorFactory.uniqueForSchema(schema); name = ReadRuleName(source).orElse(null); return(ConstraintRule.ConstraintRuleConflict(id, descriptor, ownedUniqueIndex, name)); case UNIQUE_EXISTS_CONSTRAINT: long ownedNodeKeyIndex = source.Long; schema = ReadSchema(source); NodeKeyConstraintDescriptor nodeKeyConstraintDescriptor = ConstraintDescriptorFactory.nodeKeyForSchema(schema); name = ReadRuleName(source).orElse(null); return(ConstraintRule.ConstraintRuleConflict(id, nodeKeyConstraintDescriptor, ownedNodeKeyIndex, name)); default: throw new MalformedSchemaRuleException(format("Got unknown constraint rule type '%d'.", constraintRuleType)); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void assertParseNodeKeyConstraintRule(String serialized, String name) throws org.neo4j.internal.kernel.api.exceptions.schema.MalformedSchemaRuleException private void AssertParseNodeKeyConstraintRule(string serialized, string name) { // GIVEN long ruleId = 1; int propertyKey = 3; int labelId = 55; long ownedIndexId = 2; NodeKeyConstraintDescriptor constraint = ConstraintDescriptorFactory.nodeKeyForLabel(labelId, propertyKey); sbyte[] bytes = DecodeBase64(serialized); // WHEN ConstraintRule deserialized = AssertConstraintRule(SchemaRuleSerialization.Deserialize(ruleId, ByteBuffer.wrap(bytes))); // THEN assertThat(deserialized.Id, equalTo(ruleId)); assertThat(deserialized.ConstraintDescriptor, equalTo(constraint)); assertThat(deserialized.Schema(), equalTo(constraint.Schema())); assertThat(deserialized.OwnedIndex, equalTo(ownedIndexId)); assertThat(deserialized.Name, @is(name)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public org.neo4j.kernel.impl.store.record.ConstraintRule createNodeKeyConstraintRule(long ruleId, org.neo4j.kernel.api.schema.constraints.NodeKeyConstraintDescriptor descriptor, long indexId) throws org.neo4j.internal.kernel.api.exceptions.schema.CreateConstraintFailureException public override ConstraintRule CreateNodeKeyConstraintRule(long ruleId, NodeKeyConstraintDescriptor descriptor, long indexId) { throw NodeKeyConstraintsNotAllowed(descriptor.Schema()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public abstract org.neo4j.kernel.impl.store.record.ConstraintRule createNodeKeyConstraintRule(long ruleId, org.neo4j.kernel.api.schema.constraints.NodeKeyConstraintDescriptor descriptor, long indexId) throws org.neo4j.internal.kernel.api.exceptions.schema.CreateConstraintFailureException; public abstract ConstraintRule CreateNodeKeyConstraintRule(long ruleId, NodeKeyConstraintDescriptor descriptor, long indexId);
public override ConstraintRule CreateNodeKeyConstraintRule(long ruleId, NodeKeyConstraintDescriptor descriptor, long indexId) { return(ConstraintRule.constraintRule(ruleId, descriptor, indexId)); }