Пример #1
0
        // 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));
            }
        }
 public RelationshipPropertyExistenceException(RelationTypeSchemaDescriptor schema, ConstraintValidationException.Phase phase, long relationshipId) : base(ConstraintDescriptorFactory.existsForSchema(schema), phase, format("Relationship(%s)", relationshipId))
 {
     this._schema         = schema;
     this._relationshipId = relationshipId;
 }
Пример #3
0
 private CreateConstraintFailureException NodeKeyConstraintsNotAllowed(SchemaDescriptor descriptor)
 {
     // When creating a Node Key Constraint in Community Edition
     return(new CreateConstraintFailureException(ConstraintDescriptorFactory.existsForSchema(descriptor), ERROR_MESSAGE_NODE_KEY));
 }
Пример #4
0
 private CreateConstraintFailureException PropertyExistenceConstraintsNotAllowed(SchemaDescriptor descriptor)
 {
     // When creating a Property Existence Constraint in Community Edition
     return(new CreateConstraintFailureException(ConstraintDescriptorFactory.existsForSchema(descriptor), ERROR_MESSAGE_EXISTS));
 }
 public NodePropertyExistenceException(LabelSchemaDescriptor schema, ConstraintValidationException.Phase phase, long nodeId) : base(ConstraintDescriptorFactory.existsForSchema(schema), phase, format("Node(%d)", nodeId))
 {
     this._schema = schema;
     this._nodeId = nodeId;
 }