Esempio n. 1
0
 public void processSpecific(RelationTypeSchemaDescriptor schema)
 {
     foreach (int propertyId in Schema.PropertyIds)
     {
         RecordConstraint(Schema.RelTypeId, propertyId, outerInstance.relationships);
     }
 }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void processAllRelationshipProperties() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ProcessAllRelationshipProperties()
        {
            CreateAlistairAndStefanNodes();
            CopyUpdateVisitor     propertyUpdateVisitor = new CopyUpdateVisitor();
            RelationshipStoreScan relationshipStoreScan = new RelationshipStoreScan(new RecordStorageReader(_neoStores), _locks, propertyUpdateVisitor, new int[] { _relTypeId }, id => true);

            using (StorageRelationshipScanCursor relationshipScanCursor = _reader.allocateRelationshipScanCursor())
            {
                relationshipScanCursor.Single(1);
                relationshipScanCursor.Next();

                relationshipStoreScan.process(relationshipScanCursor);
            }

            EntityUpdates propertyUpdates = propertyUpdateVisitor.PropertyUpdates;

            assertNotNull("Visitor should contain container with updates.", propertyUpdates);

            RelationTypeSchemaDescriptor         index1  = SchemaDescriptorFactory.forRelType(0, 2);
            RelationTypeSchemaDescriptor         index2  = SchemaDescriptorFactory.forRelType(0, 3);
            RelationTypeSchemaDescriptor         index3  = SchemaDescriptorFactory.forRelType(0, 2, 3);
            RelationTypeSchemaDescriptor         index4  = SchemaDescriptorFactory.forRelType(1, 3);
            IList <RelationTypeSchemaDescriptor> indexes = Arrays.asList(index1, index2, index3, index4);

//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            assertThat(Iterables.map(IndexEntryUpdate::indexKey, propertyUpdates.ForIndexKeys(indexes)), containsInAnyOrder(index1, index2, index3));
        }
Esempio n. 3
0
        private ConstraintDefinition AsConstraintDefinition(ConstraintDescriptor constraint, TokenRead tokenRead)
        {
            // This was turned inside out. Previously a low-level constraint object would reference a public enum type
            // which made it impossible to break out the low-level component from kernel. There could be a lower level
            // constraint type introduced to mimic the public ConstraintType, but that would be a duplicate of it
            // essentially. Checking instanceof here is OKish since the objects it checks here are part of the
            // internal storage engine API.
            SilentTokenNameLookup lookup = new SilentTokenNameLookup(tokenRead);

            if (constraint is NodeExistenceConstraintDescriptor || constraint is NodeKeyConstraintDescriptor || constraint is UniquenessConstraintDescriptor)
            {
                SchemaDescriptor schemaDescriptor = constraint.Schema();
                int[]            entityTokenIds   = schemaDescriptor.EntityTokenIds;
                Label[]          labels           = new Label[entityTokenIds.Length];
                for (int i = 0; i < entityTokenIds.Length; i++)
                {
                    labels[i] = label(lookup.LabelGetName(entityTokenIds[i]));
                }
//JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter:
                string[] propertyKeys = Arrays.stream(schemaDescriptor.PropertyIds).mapToObj(lookup.propertyKeyGetName).toArray(string[] ::new);
                if (constraint is NodeExistenceConstraintDescriptor)
                {
                    return(new NodePropertyExistenceConstraintDefinition(_actions, labels[0], propertyKeys));
                }
                else if (constraint is UniquenessConstraintDescriptor)
                {
                    return(new UniquenessConstraintDefinition(_actions, new IndexDefinitionImpl(_actions, null, labels, propertyKeys, true)));
                }
                else
                {
                    return(new NodeKeyConstraintDefinition(_actions, new IndexDefinitionImpl(_actions, null, labels, propertyKeys, true)));
                }
            }
            else if (constraint is RelExistenceConstraintDescriptor)
            {
                RelationTypeSchemaDescriptor descriptor = ( RelationTypeSchemaDescriptor )constraint.Schema();
                return(new RelationshipPropertyExistenceConstraintDefinition(_actions, withName(lookup.RelationshipTypeGetName(descriptor.RelTypeId)), lookup.PropertyKeyGetName(descriptor.PropertyId)));
            }
            throw new System.ArgumentException("Unknown constraint " + constraint);
        }
Esempio n. 4
0
 public override void ProcessSpecific(RelationTypeSchemaDescriptor schema)
 {
     Engine.comparativeCheck(Records.relationshipType(Schema.RelTypeId), _validRelationshipType);
     CheckProperties(Schema.PropertyIds);
 }
Esempio n. 5
0
 public SchemaRule_Kind computeSpecific(RelationTypeSchemaDescriptor schema)
 {
     return(RELATIONSHIP_PROPERTY_EXISTENCE_CONSTRAINT);
 }