Exemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("resource") @Override public void createCommands(java.util.Collection<org.neo4j.storageengine.api.StorageCommand> commands, org.neo4j.storageengine.api.txstate.ReadableTransactionState txState, org.neo4j.storageengine.api.StorageReader storageReader, org.neo4j.storageengine.api.lock.ResourceLocker locks, long lastTransactionIdWhenStarted, org.neo4j.storageengine.api.txstate.TxStateVisitor_Decorator additionalTxStateVisitor) throws org.neo4j.internal.kernel.api.exceptions.TransactionFailureException, org.neo4j.internal.kernel.api.exceptions.schema.CreateConstraintFailureException, org.neo4j.internal.kernel.api.exceptions.schema.ConstraintValidationException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public override void CreateCommands(ICollection <StorageCommand> commands, ReadableTransactionState txState, StorageReader storageReader, ResourceLocker locks, long lastTransactionIdWhenStarted, Org.Neo4j.Storageengine.Api.txstate.TxStateVisitor_Decorator additionalTxStateVisitor)
        {
            if (txState != null)
            {
                // We can make this cast here because we expected that the storageReader passed in here comes from
                // this storage engine itself, anything else is considered a bug. And we do know the inner workings
                // of the storage statements that we create.
                RecordStorageCommandCreationContext creationContext = (( RecordStorageReader )storageReader).CommandCreationContext;
                TransactionRecordState recordState = creationContext.CreateTransactionRecordState(_integrityValidator, lastTransactionIdWhenStarted, locks);

                // Visit transaction state and populate these record state objects
                TxStateVisitor    txStateVisitor    = new TransactionToRecordStateVisitor(recordState, _schemaState, _schemaStorage, _constraintSemantics);
                CountsRecordState countsRecordState = new CountsRecordState();
                txStateVisitor = additionalTxStateVisitor.apply(txStateVisitor);
                txStateVisitor = new TransactionCountingStateVisitor(txStateVisitor, storageReader, txState, countsRecordState);
                using (TxStateVisitor visitor = txStateVisitor)
                {
                    txState.Accept(visitor);
                }

                // Convert record state into commands
                recordState.ExtractCommands(commands);
                countsRecordState.ExtractCommands(commands);
            }
        }
Exemplo n.º 2
0
 public TxStateVisitor_Delegator(TxStateVisitor actual)
 {
     Debug.Assert(actual != null);
     this.Actual = actual;
 }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void accept(final org.neo4j.storageengine.api.txstate.TxStateVisitor visitor) throws org.neo4j.internal.kernel.api.exceptions.schema.ConstraintValidationException, org.neo4j.internal.kernel.api.exceptions.schema.CreateConstraintFailureException
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
        public override void Accept(TxStateVisitor visitor)
        {
            if (_nodes != null)
            {
                _nodes.Added.each(visitor.visitCreatedNode);
            }

            if (_relationships != null)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.eclipse.collections.api.iterator.LongIterator added = relationships.getAdded().longIterator();
                LongIterator added = _relationships.Added.longIterator();
                while (added.hasNext())
                {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long relId = added.next();
                    long relId = added.next();
                    if (!RelationshipVisit(relId, visitor.visitCreatedRelationship))
                    {
                        throw new System.InvalidOperationException("No RelationshipState for added relationship!");
                    }
                }
                _relationships.Removed.forEach(visitor.visitDeletedRelationship);
            }

            if (_nodes != null)
            {
                _nodes.Removed.each(visitor.visitDeletedNode);
            }

            foreach (NodeState node in ModifiedNodes())
            {
                if (node.HasPropertyChanges())
                {
                    visitor.VisitNodePropertyChanges(node.Id, node.AddedProperties(), node.ChangedProperties(), node.RemovedProperties());
                }

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.storageengine.api.txstate.LongDiffSets labelDiffSets = node.labelDiffSets();
                LongDiffSets labelDiffSets = node.LabelDiffSets();
                if (!labelDiffSets.Empty)
                {
                    visitor.VisitNodeLabelChanges(node.Id, labelDiffSets.Added, labelDiffSets.Removed);
                }
            }

            foreach (RelationshipState rel in ModifiedRelationships())
            {
                visitor.VisitRelPropertyChanges(rel.Id, rel.AddedProperties(), rel.ChangedProperties(), rel.RemovedProperties());
            }

            if (_graphState != null)
            {
                visitor.VisitGraphPropertyChanges(_graphState.addedProperties(), _graphState.changedProperties(), _graphState.removedProperties());
            }

            if (_indexChanges != null)
            {
                _indexChanges.Added.forEach(visitor.visitAddedIndex);
                _indexChanges.Removed.forEach(visitor.visitRemovedIndex);
            }

            if (_constraintsChanges != null)
            {
                foreach (ConstraintDescriptor added in _constraintsChanges.Added)
                {
                    visitor.VisitAddedConstraint(added);
                }
                _constraintsChanges.Removed.forEach(visitor.visitRemovedConstraint);
            }

            if (_createdLabelTokens != null)
            {
                _createdLabelTokens.forEachKeyValue(visitor.visitCreatedLabelToken);
            }

            if (_createdPropertyKeyTokens != null)
            {
                _createdPropertyKeyTokens.forEachKeyValue(visitor.visitCreatedPropertyKeyToken);
            }

            if (_createdRelationshipTypeTokens != null)
            {
                _createdRelationshipTypeTokens.forEachKeyValue(visitor.visitCreatedRelationshipTypeToken);
            }
        }