// PRIVATE

        // READ INDEX

//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static org.neo4j.storageengine.api.schema.StoreIndexDescriptor readIndexRule(long id, ByteBuffer source) throws org.neo4j.internal.kernel.api.exceptions.schema.MalformedSchemaRuleException
        private static StoreIndexDescriptor ReadIndexRule(long id, ByteBuffer source)
        {
            IndexProviderDescriptor indexProvider = ReadIndexProviderDescriptor(source);
            sbyte             indexRuleType       = source.get();
            Optional <string> name;

            switch (indexRuleType)
            {
            case GENERAL_INDEX:
            {
                SchemaDescriptor schema = ReadSchema(source);
                name = ReadRuleName(source);
                return(IndexDescriptorFactory.forSchema(schema, name, indexProvider).withId(id));
            }

            case UNIQUE_INDEX:
            {
                long             owningConstraint = source.Long;
                SchemaDescriptor schema           = ReadSchema(source);
                name = ReadRuleName(source);
                IndexDescriptor descriptor = IndexDescriptorFactory.uniqueForSchema(schema, name, indexProvider);
                return(owningConstraint == NO_OWNING_CONSTRAINT_YET?descriptor.WithId(id) : descriptor.WithIds(id, owningConstraint));
            }

            default:
                throw new MalformedSchemaRuleException(format("Got unknown index rule type '%d'.", indexRuleType));
            }
        }
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (!(o is SchemaDescriptor))
            {
                return(false);
            }
            SchemaDescriptor that = ( SchemaDescriptor )o;

            return(Arrays.Equals(_entityTokens, that.EntityTokenIds) && _entityType == that.EntityType() && Arrays.Equals(_propertyIds, that.PropertyIds));
        }
            public override void ProcessSpecific(SchemaDescriptor schema)
            {
                Target.put(GENERIC_MULTI_TOKEN_TYPE);
                if (Schema.entityType() == EntityType.NODE)
                {
                    Target.put(SIMPLE_LABEL);
                }
                else
                {
                    Target.put(SIMPLE_REL_TYPE);
                }

                PutIds(Schema.EntityTokenIds);
                PutIds(Schema.PropertyIds);
            }
示例#4
0
 internal FulltextSchemaDescriptor(SchemaDescriptor schema, Properties indexConfiguration)
 {
     this._schema             = schema;
     this._indexConfiguration = indexConfiguration;
 }
 public int?computeSpecific(SchemaDescriptor schema)
 {
     return(1 + 1 + 2 + 4 * Schema.EntityTokenIds.length + 2 + 4 * Schema.PropertyIds.length);                  // the actual property ids
 }
 public ConstraintDescriptor computeSpecific(SchemaDescriptor schema)
 {
     throw new System.NotSupportedException(format("Cannot create existence constraint for schema '%s' of type %s", Schema.userDescription(SchemaUtil.idTokenNameLookup), Schema.GetType().Name));
 }
 public static NodeKeyConstraintDescriptor NodeKeyForSchema(SchemaDescriptor schema)
 {
     return(Schema.computeWith(convertToNodeKeyConstraint));
 }
 public static UniquenessConstraintDescriptor UniqueForSchema(SchemaDescriptor schema)
 {
     return(Schema.computeWith(convertToUniquenessConstraint));
 }
 public static ConstraintDescriptor ExistsForSchema(SchemaDescriptor schema)
 {
     return(Schema.computeWith(convertToExistenceConstraint));
 }