Ejemplo n.º 1
0
        // 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));
            }
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
            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);
            }
Ejemplo n.º 4
0
 internal FulltextSchemaDescriptor(SchemaDescriptor schema, Properties indexConfiguration)
 {
     this._schema             = schema;
     this._indexConfiguration = indexConfiguration;
 }
Ejemplo n.º 5
0
 public int?computeSpecific(SchemaDescriptor schema)
 {
     return(1 + 1 + 2 + 4 * Schema.EntityTokenIds.length + 2 + 4 * Schema.PropertyIds.length);                  // the actual property ids
 }
Ejemplo n.º 6
0
 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));
 }
Ejemplo n.º 7
0
 public static NodeKeyConstraintDescriptor NodeKeyForSchema(SchemaDescriptor schema)
 {
     return(Schema.computeWith(convertToNodeKeyConstraint));
 }
Ejemplo n.º 8
0
 public static UniquenessConstraintDescriptor UniqueForSchema(SchemaDescriptor schema)
 {
     return(Schema.computeWith(convertToUniquenessConstraint));
 }
Ejemplo n.º 9
0
 public static ConstraintDescriptor ExistsForSchema(SchemaDescriptor schema)
 {
     return(Schema.computeWith(convertToExistenceConstraint));
 }