Example #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public boolean process(org.neo4j.storageengine.api.StorageNodeCursor cursor) throws FAILURE
        public override bool Process(StorageNodeCursor cursor)
        {
            long[] labels = cursor.Labels();
            if (labels.Length == 0 && LabelIds.Length != 0)
            {
                // This node has no labels at all
                return(false);
            }

            if (_labelUpdateVisitor != null)
            {
                // Notify the label update visitor
                _labelUpdateVisitor.visit(labelChanges(cursor.EntityReference(), EMPTY_LONG_ARRAY, labels));
            }

            if (_propertyUpdatesVisitor != null && containsAnyEntityToken(LabelIds, labels))
            {
                // Notify the property update visitor
                EntityUpdates.Builder updates = EntityUpdates.forEntity(cursor.EntityReference(), true).withTokens(labels);

                if (hasRelevantProperty(cursor, updates))
                {
                    return(_propertyUpdatesVisitor.visit(updates.Build()));
                }
            }
            return(false);
        }
        public override EntityUpdates NodeAsUpdates(long nodeId)
        {
            NodeRecord node = NodeStore.getRecord(nodeId, NodeStore.newRecord(), FORCE);

            if (!node.InUse())
            {
                return(null);
            }
            long firstPropertyId = node.NextProp;

            if (firstPropertyId == Record.NO_NEXT_PROPERTY.intValue())
            {
                return(null);                        // no properties => no updates (it's not going to be in any index)
            }
            long[] labels = parseLabelsField(node).get(NodeStore);
            if (labels.Length == 0)
            {
                return(null);                        // no labels => no updates (it's not going to be in any index)
            }
            EntityUpdates.Builder update = EntityUpdates.forEntity(nodeId, true).withTokens(labels);
            foreach (PropertyRecord propertyRecord in PropertyStore.getPropertyRecordChain(firstPropertyId))
            {
                foreach (PropertyBlock property in propertyRecord)
                {
                    Value value = property.Type.value(property, PropertyStore);
                    update.Added(property.KeyIndexId, value);
                }
            }
            return(update.Build());
        }
Example #3
0
        private void GatherUpdatesFor(long nodeId, Command.NodeCommand nodeCommand, EntityCommandGrouper <Command.NodeCommand> .Cursor propertyCommands)
        {
            EntityUpdates.Builder nodePropertyUpdate = GatherUpdatesFromCommandsForNode(nodeId, nodeCommand, propertyCommands);

            EntityUpdates entityUpdates = nodePropertyUpdate.Build();

            // we need to materialize the IndexEntryUpdates here, because when we
            // consume (later in separate thread) the store might have changed.
            foreach (IndexEntryUpdate <SchemaDescriptor> update in _updateService.convertToIndexUpdates(entityUpdates, EntityType.NODE))
            {
                _updates.Add(update);
            }
        }
Example #4
0
        private void GatherUpdatesFor(long relationshipId, Command.RelationshipCommand relationshipCommand, EntityCommandGrouper <Command.RelationshipCommand> .Cursor propertyCommands)
        {
            EntityUpdates.Builder relationshipPropertyUpdate = GatherUpdatesFromCommandsForRelationship(relationshipId, relationshipCommand, propertyCommands);

            EntityUpdates entityUpdates = relationshipPropertyUpdate.Build();

            // we need to materialize the IndexEntryUpdates here, because when we
            // consume (later in separate thread) the store might have changed.
            foreach (IndexEntryUpdate <SchemaDescriptor> update in _updateService.convertToIndexUpdates(entityUpdates, EntityType.RELATIONSHIP))
            {
                _updates.Add(update);
            }
        }
Example #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected boolean process(org.neo4j.storageengine.api.StorageRelationshipScanCursor cursor) throws FAILURE
        protected internal override bool Process(StorageRelationshipScanCursor cursor)
        {
            int reltype = cursor.Type();

            if (_propertyUpdatesVisitor != null && containsAnyEntityToken(_relationshipTypeIds, reltype))
            {
                // Notify the property update visitor
                EntityUpdates.Builder updates = EntityUpdates.forEntity(cursor.EntityReference(), true).withTokens(reltype);

                if (hasRelevantProperty(cursor, updates))
                {
                    return(_propertyUpdatesVisitor.visit(updates.Build()));
                }
            }
            return(false);
        }