Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldContainFedRelationshipUpdate() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldContainFedRelationshipUpdate()
        {
            OnlineIndexUpdates onlineIndexUpdates = new OnlineIndexUpdates(_nodeStore, _relationshipStore, _indexingService, _propertyPhysicalToLogicalConverter);

            long relId = 0;
            RelationshipRecord inUse    = GetRelationship(relId, true, ENTITY_TOKEN);
            Value propertyValue         = Values.of("hej");
            long  propertyId            = CreateRelationshipProperty(inUse, propertyValue, 1);
            RelationshipRecord notInUse = GetRelationship(relId, false, ENTITY_TOKEN);

            _relationshipStore.updateRecord(inUse);

            Command.RelationshipCommand relationshipCommand = new Command.RelationshipCommand(inUse, notInUse);
            PropertyRecord propertyBlocks = new PropertyRecord(propertyId);

            propertyBlocks.RelId = relId;
            Command.PropertyCommand propertyCommand = new Command.PropertyCommand(_recordAccess.getIfLoaded(propertyId).forReadingData(), propertyBlocks);

            StoreIndexDescriptor indexDescriptor = forSchema(multiToken(_entityTokens, RELATIONSHIP, 1, 4, 6), EMPTY.ProviderDescriptor).withId(0);

            _indexingService.createIndexes(indexDescriptor);
            _indexingService.getIndexProxy(indexDescriptor.Schema()).awaitStoreScanCompleted(0, MILLISECONDS);

            onlineIndexUpdates.Feed(NodeGroup(null), RelationshipGroup(relationshipCommand, propertyCommand));
            assertTrue(onlineIndexUpdates.HasUpdates());
            IEnumerator <IndexEntryUpdate <SchemaDescriptor> > iterator = onlineIndexUpdates.GetEnumerator();

//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            assertEquals(iterator.next(), IndexEntryUpdate.remove(relId, indexDescriptor, propertyValue, null, null));
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            assertFalse(iterator.hasNext());
        }
        private void CheckProperty(NodeRecord record, CheckerEngine <NodeRecord, Org.Neo4j.Consistency.report.ConsistencyReport_NodeConsistencyReport> engine, ICollection <PropertyRecord> props)
        {
            if (!Record.NO_NEXT_PROPERTY.@is(record.NextProp))
            {
                PropertyRecord firstProp = props.GetEnumerator().next();
                if (!Record.NO_PREVIOUS_PROPERTY.@is(firstProp.PrevProp))
                {
                    engine.Report().propertyNotFirstInChain(firstProp);
                }

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.eclipse.collections.api.set.primitive.MutableIntSet keys = new org.eclipse.collections.impl.set.mutable.primitive.IntHashSet();
                MutableIntSet keys = new IntHashSet();
                foreach (PropertyRecord property in props)
                {
                    if (!property.InUse())
                    {
                        engine.Report().propertyNotInUse(property);
                    }
                    else
                    {
                        foreach (int key in ChainCheck.keys(property))
                        {
                            if (!keys.add(key))
                            {
                                engine.Report().propertyKeyNotUniqueInChain();
                            }
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        private void UpdateLayoutProperties(string typeName, LayoutRecord layoutRecord, IEnumerable <string> properties)
        {
            layoutRecord.Properties.Clear();
            if (properties == null)
            {
                return;
            }
            string       category    = typeName + "ContentFields";
            const string settingName = "CoeveryTextFieldSettings.IsDispalyField";
            var          allFields   = _contentDefinitionManager.GetPartDefinition(typeName).Fields.ToList();

            foreach (var property in properties)
            {
                var field = allFields.FirstOrDefault(c => c.Name == property);
                if (field == null)
                {
                    continue;
                }
                var propertyRecord = new PropertyRecord {
                    Category      = category,
                    Type          = string.Format("{0}.{1}.", typeName, property),
                    Description   = field.DisplayName,
                    Position      = layoutRecord.Properties.Count,
                    LinkToContent = field.Settings.ContainsKey(settingName) && bool.Parse(field.Settings[settingName])
                };
                layoutRecord.Properties.Add(propertyRecord);
            }
        }
            public bool Purge(bool purgeAll)
            {
                bool foundDirt = false;

                if (!purgeAll)
                {
                    // copy the keys into a separate array, so that later on
                    // we can change the dictionary while iterating over the keys
                    ICollection ic   = _dict.Keys;
                    String[]    keys = new String[ic.Count];
                    ic.CopyTo(keys, 0);

                    for (int i = keys.Length - 1; i >= 0; --i)
                    {
                        if (keys[i] == AllListenersKey)
                        {
                            continue;       // ignore the special entry for now
                        }
                        // for each key, remove dead entries in its list
                        PropertyRecord pr = (PropertyRecord)_dict[keys[i]];
                        if (pr.Purge())
                        {
                            foundDirt = true;
                        }

                        // if there are no more entries, remove the key
                        if (pr.IsEmpty)
                        {
                            pr.StopListening(_type);
                            _dict.Remove(keys[i]);
                        }
                    }

                    if (foundDirt)
                    {
                        // if any entries were purged, invalidate the special entry
                        _dict.Remove(AllListenersKey);
                        _proposedAllListenersList = null;
                    }

                    if (IsEmpty)
                    {
                        StopListening();
                    }
                }
                else
                {
                    // stop listening.  List cleanup is handled by Purge()
                    foundDirt = true;
                    StopListening();

                    foreach (DictionaryEntry de in _dict)
                    {
                        PropertyRecord pr = (PropertyRecord)de.Value;
                        pr.StopListening(_type);
                    }
                }

                return(foundDirt);
            }
        private bool MakeDtoLine(string currentLine, string searchType)
        {
            string padding = "      ";

            currentLine = currentLine.Replace(@"?", "questionmark");
            searchType  = searchType.Replace(@"?", "questionmark");

            if (currentLine.Contains("public " + searchType + " "))
            {
                Regex regex = new Regex(@"(?<=\bpublic " + searchType + @" )(\w+)");
                Match match = regex.Match(currentLine);

                if (match.Success)
                {
                    PropertyRecord.Add(match.Value);

                    var neLine = padding + @"public " + searchType + " " + match.Value +
                                 " { get => _current." + match.Value +
                                 "; set { _current." + match.Value + " = value; OnPropertyChanged(); } }";

                    neLine     = neLine.Replace("questionmark", @"?");
                    searchType = searchType.Replace("questionmark", @"?");


                    CloneLines.Add(padding + padding + match.Value + " = this." + match.Value + ",");

                    return(true);
                }
            }



            return(false);
        }
Esempio n. 6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldIterateOverBlocks()
        public virtual void ShouldIterateOverBlocks()
        {
            // GIVEN
            PropertyRecord record = new PropertyRecord(0);

            PropertyBlock[] blocks = new PropertyBlock[3];
            for (int i = 0; i < blocks.Length; i++)
            {
                blocks[i] = new PropertyBlock();
                record.AddPropertyBlock(blocks[i]);
            }

            // WHEN
            IEnumerator <PropertyBlock> iterator = record.GetEnumerator();

            // THEN
            foreach (PropertyBlock block in blocks)
            {
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertTrue(iterator.hasNext());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertEquals(block, iterator.next());
            }
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            assertFalse(iterator.hasNext());
        }
 public BAMLConverterMemberReference(BAMLAnalyzer.XmlNsContext xmlnsCtx, TypeSig sig, IDnlibDef member, PropertyRecord rec)
 {
     this.xmlnsCtx = xmlnsCtx;
     this.sig      = sig;
     this.member   = member;
     this.rec      = rec;
 }
Esempio n. 8
0
        private bool PropertyFitsInside(int newBlockSizeInBytes, PropertyRecord propRecord)
        {
            int propSize = propRecord.Size();

            Debug.Assert(propSize >= 0, propRecord);
            return(propSize + newBlockSizeInBytes <= PropertyType.PayloadSize);
        }
Esempio n. 9
0
        private void UpdateLayoutProperties(string entityName, ref LayoutRecord layout, string category, string settingName, IEnumerable <string> pickedFileds)
        {
            var          allFields       = _contentDefinitionManager.GetPartDefinition(entityName).Fields.ToList();
            const string fieldTypeFormat = "{0}.{1}.";

            foreach (var property in pickedFileds)
            {
                var names         = property.Split('.');
                var propertyMatch = string.Format(fieldTypeFormat, names[0], names[1]);
                var field         = allFields.FirstOrDefault(c =>
                                                             string.Format(fieldTypeFormat, entityName, c.Name) == propertyMatch);
                if (field == null)
                {
                    continue;
                }
                var fieldStateProvider = _fieldToPropertyStateProviders.FirstOrDefault(provider => provider.CanHandle(field.FieldDefinition.Name));
                if (fieldStateProvider == null)
                {
                    throw new NotSupportedException("The field type \"" + field.FieldDefinition.Name + "\" is not supported!");
                }
                var propertyRecord = new PropertyRecord {
                    Category      = category,
                    Type          = property,
                    Description   = field.DisplayName,
                    Position      = layout.Properties.Count,
                    State         = fieldStateProvider.GetPropertyState(field.FieldDefinition.Name, property, field.Settings),
                    LinkToContent = field.Settings.ContainsKey(settingName) && bool.Parse(field.Settings[settingName])
                };
                layout.Properties.Add(propertyRecord);
            }
        }
Esempio n. 10
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private boolean visitPropertyRecordChain(long firstPropertyRecordId, org.neo4j.helpers.collection.Visitor<org.neo4j.kernel.impl.store.record.PropertyRecord,RuntimeException> visitor) throws CircularPropertyRecordChainException
        private bool VisitPropertyRecordChain(long firstPropertyRecordId, Visitor <PropertyRecord, Exception> visitor)
        {
            if (Record.NO_NEXT_PROPERTY.@is(firstPropertyRecordId))
            {
                return(false);
            }

            MutableLongSet visitedPropertyRecordIds = new LongHashSet(8);

            visitedPropertyRecordIds.add(firstPropertyRecordId);
            long nextProp = firstPropertyRecordId;

            while (!Record.NO_NEXT_PROPERTY.@is(nextProp))
            {
                PropertyRecord propRecord = _propertyStore.getRecord(nextProp, _propertyStore.newRecord(), FORCE);
                nextProp = propRecord.NextProp;
                if (!Record.NO_NEXT_PROPERTY.@is(nextProp) && !visitedPropertyRecordIds.add(nextProp))
                {
                    throw new CircularPropertyRecordChainException(propRecord);
                }
                if (visitor.Visit(propRecord))
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 11
0
        void DisassembleRecord(BamlContext ctx, PropertyRecord record)
        {
            WriteText("AttributeId=");
            WriteAttributeId(ctx, record.AttributeId);

            WriteText(", Value=");
            WriteString(record.Value);
        }
        private bool MakePropertyLine(string currentLine, string searchToken, string defaultValue)
        {
            string padding = "      ";

            currentLine = currentLine.Replace(@"?", "questionmark");
            searchToken = searchToken.Replace(@"?", "questionmark");

            if (currentLine.Contains("public " + searchToken + " "))
            {
                Regex regex = new Regex(@"(?<=\bpublic " + searchToken + @" )(\w+)");
                Match match = regex.Match(currentLine);

                if (match.Success)
                {
                    PropertyRecord.Add(match.Value);

                    var neLine = padding + @"public Property<" + searchToken + "> " + match.Value +
                                 " { get; set; } = new Property<" + searchToken +
                                 ">(){" + defaultValue + "};";

                    neLine      = neLine.Replace("questionmark", @"?");
                    searchToken = searchToken.Replace("questionmark", @"?");


                    TargetLines.Add(neLine);

                    //this.ID = Property<int>.Make(test.ID);
                    var makeLine = padding + @"this." + match.Value + " = Property<" + searchToken + ">.Make(test." + match.Value + ");";

                    MakeLines.Add(makeLine);

                    //ConvertToDtoLines

                    var convertLine = padding + "returnVal." + match.Value + " = " + match.Value + ".Value;";

                    ConvertToDtoLines.Add(convertLine);


                    var cloneLines = padding + "" + match.Value + " = this." + match.Value + ";";


                    CloneLines.Add(cloneLines);


                    var resetLine = padding + "" + match.Value + ".Revert();";

                    ResetLines.Add(resetLine);

                    return(true);
                }
            }



            return(false);
        }
Esempio n. 13
0
        private static void AddBlock(PropertyRecord record, int key, int value)
        {
            PropertyBlock block = new PropertyBlock();

            PropertyStore.EncodeValue(block, key, Values.of(value), null, null, true);
            foreach (long valueBlock in block.ValueBlocks)
            {
                record.AddLoadedBlock(valueBlock);
            }
        }
Esempio n. 14
0
 public NodeImporter(BatchingNeoStores stores, IdMapper idMapper, Monitor monitor) : base(stores, monitor)
 {
     this._labelTokenRepository = stores.LabelRepository;
     this._idMapper             = idMapper;
     this._nodeStore            = stores.NodeStore;
     this._nodeRecord           = _nodeStore.newRecord();
     this._nodeIds          = new BatchingIdGetter(_nodeStore);
     this._idPropertyStore  = stores.TemporaryPropertyStore;
     this._idPropertyRecord = _idPropertyStore.newRecord();
     _nodeRecord.InUse      = true;
 }
Esempio n. 15
0
 private void RemoveProperty(PrimitiveRecord primitive, PropertyRecord host, PropertyBlock block)
 {
     host.RemovePropertyBlock(block.KeyIndexId);
     host.Changed = primitive;
     foreach (DynamicRecord record in block.ValueRecords)
     {
         Debug.Assert(record.InUse());
         record.SetInUse(false, block.Type.intValue());
         host.AddDeletedRecord(record);
     }
 }
Esempio n. 16
0
            // Rebuilds the propertyRecords and missingParameters collections.
            private void RefreshPropertyRecords(EditorEventRef eventRef)
            {
                propertyRecords.Clear();

                foreach (SerializedObject serializedTarget in serializedTargets)
                {
                    SerializedProperty paramsProperty = serializedTarget.FindProperty("Params");

                    foreach (SerializedProperty parameterProperty in paramsProperty)
                    {
                        string             name          = parameterProperty.FindPropertyRelative("Name").stringValue;
                        SerializedProperty valueProperty = parameterProperty.FindPropertyRelative("Value");

                        PropertyRecord record = propertyRecords.Find(r => r.name == name);

                        if (record != null)
                        {
                            record.valueProperties.Add(valueProperty);
                        }
                        else
                        {
                            EditorParamRef paramRef = eventRef.LocalParameters.Find(p => p.Name == name);

                            if (paramRef != null)
                            {
                                propertyRecords.Add(
                                    new PropertyRecord()
                                {
                                    paramRef        = paramRef,
                                    valueProperties = new List <SerializedProperty>()
                                    {
                                        valueProperty
                                    },
                                });
                            }
                        }
                    }
                }

                // Only sort if there is a multi-selection. If there is only one object selected,
                // the user can revert to prefab, and the behaviour depends on the array order,
                // so it's helpful to show the true order.
                if (serializedTargets.Count > 1)
                {
                    propertyRecords.Sort((a, b) => EditorUtility.NaturalCompare(a.name, b.name));
                }

                missingParameters.Clear();
                missingParameters.AddRange(eventRef.LocalParameters.Where(
                                               p => {
                    PropertyRecord record = propertyRecords.Find(r => r.name == p.Name);
                    return(record == null || record.valueProperties.Count < serializedTargets.Count);
                }));
            }
Esempio n. 17
0
 public virtual void GetPropertyChain(long nextProp, RecordAccess <PropertyRecord, PrimitiveRecord> propertyRecords, Listener <PropertyBlock> collector)
 {
     while (nextProp != Record.NO_NEXT_PROPERTY.intValue())
     {
         PropertyRecord propRecord = propertyRecords.GetOrLoad(nextProp, null).forReadingData();
         foreach (PropertyBlock propBlock in propRecord)
         {
             collector.Receive(propBlock);
         }
         nextProp = propRecord.NextProp;
     }
 }
Esempio n. 18
0
        private static PropertyRecord[] ExtractPropertyRecords(RecordAccess <PropertyRecord, PrimitiveRecord> propertyRecordAccess, long nextProp)
        {
            IList <PropertyRecord> result = new List <PropertyRecord>();

            while (!Record.NULL_REFERENCE.@is(nextProp))
            {
                PropertyRecord record = propertyRecordAccess.GetIfLoaded(nextProp).forReadingLinkage();
                result.Add(record);
                nextProp = record.NextProp;
            }
            return(result.ToArray());
        }
Esempio n. 19
0
 protected internal EntityImporter(BatchingNeoStores stores, Monitor monitor)
 {
     this._propertyStore = stores.PropertyStore;
     this._propertyKeyTokenRepository = stores.PropertyKeyRepository;
     this.Monitor = monitor;
     for (int i = 0; i < _propertyBlocks.Length; i++)
     {
         _propertyBlocks[i] = new PropertyBlock();
     }
     this._propertyRecord = _propertyStore.newRecord();
     this._propertyIds    = new BatchingIdGetter(_propertyStore);
     this._dynamicStringRecordAllocator = new StandardDynamicRecordAllocator(new BatchingIdGetter(_propertyStore.StringStore, _propertyStore.StringStore.RecordsPerPage), _propertyStore.StringStore.RecordDataSize);
     this._dynamicArrayRecordAllocator  = new StandardDynamicRecordAllocator(new BatchingIdGetter(_propertyStore.ArrayStore, _propertyStore.ArrayStore.RecordsPerPage), _propertyStore.StringStore.RecordDataSize);
 }
        private bool MakeListLine(string currentLine, string searchType)
        {
            string padding = "      ";

            currentLine = currentLine.Replace(@"?", "questionmark");
            searchType  = searchType.Replace(@"?", "questionmark");

            if (currentLine.Contains("public " + searchType + " "))
            {
                Regex regex = new Regex(@"(?<=\bpublic " + searchType + @" )(\w+)");
                Match match = regex.Match(currentLine);

                if (match.Success)
                {
                    PropertyRecord.Add(match.Value);

                    var neLine = padding + @"public " + searchType + " " + match.Value +
                                 " { get => _current." + match.Value +
                                 "; set { _current." + match.Value + " = value; OnPropertyChanged(); } }";

                    neLine     = neLine.Replace("questionmark", @"?");
                    searchType = searchType.Replace("questionmark", @"?");


                    TargetLines.Add(neLine);

                    //public bool Completed { get => _current.Completed; set { _current.Completed = value; OnPropertyChanged(); } }

                    MakeLines.Add(padding + @"_original." + match.Value + " = test." + match.Value + ";");
                    MakeLines.Add(padding + @"_current." + match.Value + " = test." + match.Value + ";");


                    var convertLine = padding + "returnVal." + match.Value + " = this." + match.Value + ";";

                    ConvertToDtoLines.Add(convertLine);

                    var cloneLines = padding + "" + match.Value + " = this." + match.Value + ";";

                    var resetLine = padding + "" + match.Value + ".Revert();";

                    CloneLines.Add(cloneLines);

                    return(true);
                }
            }



            return(false);
        }
Esempio n. 21
0
 public static void DeletePropertyRecordIncludingValueRecords(PropertyRecord record)
 {
     foreach (PropertyBlock block in record)
     {
         foreach (DynamicRecord valueRecord in block.ValueRecords)
         {
             Debug.Assert(valueRecord.InUse());
             valueRecord.InUse = false;
             record.AddDeletedRecord(valueRecord);
         }
     }
     record.ClearPropertyBlocks();
     record.InUse = false;
 }
Esempio n. 22
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void addLoadedBlock()
        public virtual void AddLoadedBlock()
        {
            PropertyRecord record = new PropertyRecord(42);

            AddBlock(record, 1, 2);
            AddBlock(record, 3, 4);

            IList <PropertyBlock> blocks = Iterables.asList(record);

            assertEquals(2, blocks.Count);
            assertEquals(1, blocks[0].KeyIndexId);
            assertEquals(2, blocks[0].SingleValueInt);
            assertEquals(3, blocks[1].KeyIndexId);
            assertEquals(4, blocks[1].SingleValueInt);
        }
Esempio n. 23
0
        public static string GetFiledName(this PropertyRecord property)
        {
            string type    = property.Type;
            var    pattern = @"[^\.]*\.(.*)\.[^\.]*";
            var    regex   = new Regex(pattern, RegexOptions.Compiled);

            foreach (Match myMatch in regex.Matches(type))
            {
                if (myMatch.Success)
                {
                    return(myMatch.Groups[1].Value);
                }
            }
            return(type);
        }
Esempio n. 24
0
        private void AddProperty(PropertyInfo info, SpecialPropertyAttribute attr)
        {
            PropertyRecord record = new PropertyRecord()
            {
                Info = info,
                Attr = attr,
            };

            if (attr.Converter != null && attr.Converter.IsSubclassOf(typeof(PropertyConverter)))
            {
                record.Converter = Activator.CreateInstance(attr.Converter) as PropertyConverter;
            }

            _records[attr.Name ?? info.Name] = record;
        }
Esempio n. 25
0
        public virtual void Create(PropertyRecord property)
        {
            property.SetCreated();
            PropertyRecord before = new PropertyRecord(property.Id);

            if (property.NodeSet)
            {
                before.NodeId = property.NodeId;
            }
            if (property.RelSet)
            {
                before.RelId = property.RelId;
            }
            Update(before, property);
        }
Esempio n. 26
0
 public override void CheckReference(RECORD record, PropertyRecord property, CheckerEngine <RECORD, REPORT> engine, RecordAccess records)
 {
     if (!property.InUse())
     {
         engine.Report().propertyNotInUse(property);
     }
     else
     {
         if (!Record.NO_PREVIOUS_PROPERTY.@is(property.PrevProp))
         {
             engine.Report().propertyNotFirstInChain(property);
         }
         (new ChainCheck <RECORD, REPORT>()).CheckReference(record, property, engine, records);
     }
 }
Esempio n. 27
0
        public virtual void DeletePropertyChain(PrimitiveRecord primitive, RecordAccess <PropertyRecord, PrimitiveRecord> propertyRecords)
        {
            long nextProp = primitive.NextProp;

            while (nextProp != Record.NO_NEXT_PROPERTY.intValue())
            {
                RecordAccess_RecordProxy <PropertyRecord, PrimitiveRecord> propertyChange = propertyRecords.GetOrLoad(nextProp, primitive);

                // TODO forChanging/forReading piggy-backing
                PropertyRecord propRecord = propertyChange.ForChangingData();
                DeletePropertyRecordIncludingValueRecords(propRecord);
                nextProp           = propRecord.NextProp;
                propRecord.Changed = primitive;
            }
            primitive.NextProp = Record.NO_NEXT_PROPERTY.intValue();
        }
Esempio n. 28
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldDifferentiateNodesAndRelationships() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldDifferentiateNodesAndRelationships()
        {
            OnlineIndexUpdates onlineIndexUpdates = new OnlineIndexUpdates(_nodeStore, _relationshipStore, _indexingService, _propertyPhysicalToLogicalConverter);

            int        nodeId            = 0;
            NodeRecord inUseNode         = GetNode(nodeId, true);
            Value      nodePropertyValue = Values.of("hej");
            long       nodePropertyId    = CreateNodeProperty(inUseNode, nodePropertyValue, 1);
            NodeRecord notInUseNode      = GetNode(nodeId, false);

            _nodeStore.updateRecord(inUseNode);

            Command.NodeCommand nodeCommand        = new Command.NodeCommand(inUseNode, notInUseNode);
            PropertyRecord      nodePropertyBlocks = new PropertyRecord(nodePropertyId);

            nodePropertyBlocks.NodeId = nodeId;
            Command.PropertyCommand nodePropertyCommand = new Command.PropertyCommand(_recordAccess.getIfLoaded(nodePropertyId).forReadingData(), nodePropertyBlocks);

            StoreIndexDescriptor nodeIndexDescriptor = forSchema(multiToken(_entityTokens, NODE, 1, 4, 6), EMPTY.ProviderDescriptor).withId(0);

            _indexingService.createIndexes(nodeIndexDescriptor);
            _indexingService.getIndexProxy(nodeIndexDescriptor.Schema()).awaitStoreScanCompleted(0, MILLISECONDS);

            long relId = 0;
            RelationshipRecord inUse        = GetRelationship(relId, true, ENTITY_TOKEN);
            Value relationshipPropertyValue = Values.of("da");
            long  propertyId            = CreateRelationshipProperty(inUse, relationshipPropertyValue, 1);
            RelationshipRecord notInUse = GetRelationship(relId, false, ENTITY_TOKEN);

            _relationshipStore.updateRecord(inUse);

            Command.RelationshipCommand relationshipCommand = new Command.RelationshipCommand(inUse, notInUse);
            PropertyRecord relationshipPropertyBlocks       = new PropertyRecord(propertyId);

            relationshipPropertyBlocks.RelId = relId;
            Command.PropertyCommand relationshipPropertyCommand = new Command.PropertyCommand(_recordAccess.getIfLoaded(propertyId).forReadingData(), relationshipPropertyBlocks);

            StoreIndexDescriptor relationshipIndexDescriptor = forSchema(multiToken(_entityTokens, RELATIONSHIP, 1, 4, 6), EMPTY.ProviderDescriptor).withId(1);

            _indexingService.createIndexes(relationshipIndexDescriptor);
            _indexingService.getIndexProxy(relationshipIndexDescriptor.Schema()).awaitStoreScanCompleted(0, MILLISECONDS);

            onlineIndexUpdates.Feed(NodeGroup(nodeCommand, nodePropertyCommand), RelationshipGroup(relationshipCommand, relationshipPropertyCommand));
            assertTrue(onlineIndexUpdates.HasUpdates());
            assertThat(onlineIndexUpdates, containsInAnyOrder(IndexEntryUpdate.remove(relId, relationshipIndexDescriptor, relationshipPropertyValue, null, null), IndexEntryUpdate.remove(nodeId, nodeIndexDescriptor, nodePropertyValue, null, null)));
        }
Esempio n. 29
0
        private IList <Pair <string, object> > GetPropertiesFromRecord(long recordId)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.kernel.impl.store.record.PropertyRecord record = propertyStore().getRecord(recordId, propertyStore().newRecord(), org.neo4j.kernel.impl.store.record.RecordLoad.FORCE);
            PropertyRecord record = PropertyStore().getRecord(recordId, PropertyStore().newRecord(), RecordLoad.FORCE);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.List<org.eclipse.collections.api.tuple.Pair<String, Object>> props = new java.util.ArrayList<>();
            IList <Pair <string, object> > props = new List <Pair <string, object> >();

            record.forEach(block =>
            {
                object value = PropertyStore().getValue(block).asObject();
                string name  = PropertyStore().PropertyKeyTokenStore.getToken(block.KeyIndexId).name();
                props.Add(pair(name, value));
            });
            return(props);
        }
Esempio n. 30
0
            public void RemoveHandler(EventHandler <PropertyChangedEventArgs> handler, string propertyName)
            {
                PropertyRecord pr = (PropertyRecord)_dict[propertyName];

                if (pr != null)
                {
                    pr.RemoveHandler(handler);

                    if (pr.IsEmpty)
                    {
                        _dict.Remove(propertyName);
                    }

                    // invalidate list of all listeners
                    _dict.Remove(AllListenersKey);
                    _proposedAllListenersList = null;
                }
            }
            public void StoreAllListenersList(ListenerList<PropertyChangedEventArgs> list)
            {
                // test again, in case another thread changed _proposedAllListersList.
                if (_proposedAllListenersList == list)
                {
                    _dict[AllListenersKey] = new PropertyRecord(AllListenersKey, this, list);

                    _proposedAllListenersList = null;
                }

                // Another thread could have changed _proposedAllListersList
                // since we set it (earlier in this method), either
                // because it calculated a new one while handling a PropertyChanged(""),
                // or because it added/removed/purged a listener.
                // In that case, we will simply abandon our proposed list and we'll
                // have to compute it again the next time.  But that only happens
                // if there's thread contention.  It's not worth doing something
                // more complicated just for that case.
            }
Esempio n. 32
0
 public BamlPropertyReference(PropertyRecord propRec)
 {
     this.propRec = propRec;
 }
            public void AddHandler(EventHandler<PropertyChangedEventArgs> handler, string propertyName)
            {
                PropertyRecord pr = (PropertyRecord)_dict[propertyName];

                if (pr == null)
                {
                    // no entry in the dictionary - add a new one
                    pr = new PropertyRecord(propertyName, this);
                    _dict[propertyName] = pr;
                    pr.StartListening(_type);
                }

                pr.AddHandler(handler);

                // invalidate list of all listeners
                _dict.Remove(AllListenersKey);
                _proposedAllListenersList = null;

                // schedule a cleanup pass
                _manager.ScheduleCleanup();
            }