AddTransaction() public method

public AddTransaction ( ISoapTransactionLink transaction ) : void
transaction ISoapTransactionLink
return void
Example #1
0
        public void CreateTransactions(ref TransactionFramework.TransactionChain chain)
        {
            TransactionFramework.DeleteNodeTransactionLink deleteTransaction = null;
            TransactionFramework.UpdateNodeTransactionLink updateTransaction = null;

            foreach (DelayedNodeAction action in QueuedActions)
            {
                switch (action.Action)
                {
                case TransactionalNodeService.Proxy.TransactionActionType.Deleted:
                    deleteTransaction = CreateNodeDeletionTransaction(action);

                    if (deleteTransaction != null)
                    {
                        chain.AddTransaction(deleteTransaction);
                    }

                    return;

                case TransactionalNodeService.Proxy.TransactionActionType.TypeUpdated:
                    updateTransaction = CreateNodeUpdatedTransaction(action);
                    break;

                default:
                    break;
                }
            }

            if (updateTransaction != null)
            {
                chain.AddTransaction(updateTransaction);
            }
        }
Example #2
0
        public void CreateTransactions(ref TransactionFramework.TransactionChain chain)
        {
            foreach (DelayedMetadataAction action in QueuedActions)
            {
                switch (action.Action)
                {
                case Proxy.TransactionActionType.Deleted:
                    // As this is metadata that hasn't yet been created, we don't need to delete it, we just do nothing with it.
                    return;

                case Proxy.TransactionActionType.Updated:
                {
                    TransactionFramework.UpdateMetadataTransactionLink updateMetadataTransaction = CreateMetadataUpdateTransaction(action);

                    if (updateMetadataTransaction != null)
                    {
                        chain.AddTransaction(updateMetadataTransaction);
                    }
                    break;
                }

                default:
                    break;
                }
            }
        }
Example #3
0
        public override void Delete(ref TransactionFramework.TransactionChain chain)
        {
            MapManager.RelationshipFactory.DeleteRelationship(this);

            TransactionFramework.DeleteRelationshipTransactionLink deleteRelationship = new TransactionFramework.DeleteRelationshipTransactionLink();
            deleteRelationship.DomainId     = DomainId;
            deleteRelationship.MapManager   = MapManager;
            deleteRelationship.Relationship = this;

            chain.AddTransaction(deleteRelationship);
        }
Example #4
0
        public override void Delete(ref TransactionFramework.TransactionChain chain)
        {
            MapManager.NodeFactory.DeleteNode(this);

            TransactionFramework.DeleteNodeTransactionLink deleteNode = new TransactionFramework.DeleteNodeTransactionLink();
            deleteNode.DomainId   = DomainId;
            deleteNode.MapManager = MapManager;
            deleteNode.Node       = this;

            chain.AddTransaction(deleteNode);
        }
        public void CreateTransactions(ref TransactionFramework.TransactionChain chain)
        {
            TransactionFramework.DeleteRelationshipTransactionLink deleteTransaction = null;
            TransactionFramework.UpdateRelationshipTransactionLink updateTransaction = null;

            foreach (DelayedRelationshipAction action in QueuedActions)
            {
                switch (action.Action)
                {
                case TransactionalNodeService.Proxy.TransactionActionType.Deleted:
                    deleteTransaction = CreateRelationshipDeletionTransaction(action);

                    if (deleteTransaction != null)
                    {
                        chain.AddTransaction(deleteTransaction);
                    }

                    return;

                case TransactionalNodeService.Proxy.TransactionActionType.Updated:
                    updateTransaction = updateTransaction ?? CreateRelationshipUpdatedTransaction(action);
                    updateTransaction.AddNode(action.ConnectionType, action.Node);

                    break;

                case TransactionalNodeService.Proxy.TransactionActionType.TypeUpdated:
                    updateTransaction = updateTransaction ?? CreateRelationshipUpdatedTransaction(action);
                    updateTransaction.RelationshipType = action.RelationshipType;

                    break;

                default:
                    break;
                }
            }

            if (updateTransaction != null)
            {
                chain.AddTransaction(updateTransaction);
            }
        }
Example #6
0
        public Proxy.IRelationship CreateRelationship(Guid domainId, Guid rootMapId, Proxy.RelationshipType relationshipType, string originalId, ref TransactionFramework.TransactionChain chain)
        {
            TransactionFramework.AddRelationshipTransactionLink createRelationshipTransaction = new TransactionFramework.AddRelationshipTransactionLink();
            createRelationshipTransaction.MapManager       = this;
            createRelationshipTransaction.DomainId         = domainId;
            createRelationshipTransaction.RootMapId        = rootMapId;
            createRelationshipTransaction.RelationshipType = relationshipType;
            createRelationshipTransaction.OriginalId       = originalId;

            chain.AddTransaction(createRelationshipTransaction);

            Proxy.IRelationship relationship = createRelationshipTransaction.CreateInProcessObjects();

            return(relationship);
        }
Example #7
0
        public Proxy.INode CreateNode(Guid domainId, Guid rootMapId, Proxy.NodeType nodeType, string originalId, ref TransactionFramework.TransactionChain chain)
        {
            TransactionFramework.AddNodeTransactionLink createNodeTransaction = new TransactionFramework.AddNodeTransactionLink();
            createNodeTransaction.MapManager = this;
            createNodeTransaction.DomainId   = domainId;
            createNodeTransaction.RootMapId  = rootMapId;
            createNodeTransaction.NodeType   = nodeType;
            createNodeTransaction.OriginalId = originalId;

            chain.AddTransaction(createNodeTransaction);

            Proxy.INode node = createNodeTransaction.CreateInProcessObjects();

            return(node);
        }
Example #8
0
        public override void Update(Proxy.NodeType nodeType, ref TransactionFramework.TransactionChain chain)
        {
            NodeType = nodeType;

            if (LastUpdateNode != null && LastUpdateNode.TransactionStatus == TransactionFramework.ServerStatus.ProcessingClient)
            {
                LastUpdateNode.NodeType = nodeType;
            }
            else
            {
                LastUpdateNode = CreateNewUpdateNode(nodeType);
                chain.AddTransaction(LastUpdateNode);
            }

            chain.TransactionExecuting += OnTransactionExecuting;
        }
Example #9
0
        public override void Update(Proxy.RelationshipType relationshipType, ref TransactionFramework.TransactionChain chain)
        {
            RelationshipType = relationshipType;

            if (LastUpdateRelationship != null && LastUpdateRelationship.TransactionStatus == TransactionFramework.ServerStatus.ProcessingClient)
            {
                LastUpdateRelationship.RelationshipType = relationshipType;
            }
            else
            {
                LastUpdateRelationship = CreateNewUpdateRelationship();
                LastUpdateRelationship.RelationshipType = relationshipType;
                chain.AddTransaction(LastUpdateRelationship);
            }

            chain.TransactionExecuting += OnTransactionExecuting;
        }
Example #10
0
        public override void ConnectNode(Proxy.ConnectionType connectionType, Proxy.INode node, ref TransactionFramework.TransactionChain chain)
        {
            base.ConnectNode(connectionType, node, ref chain);

            if (LastUpdateRelationship != null && LastUpdateRelationship.TransactionStatus == TransactionFramework.ServerStatus.ProcessingClient)
            {
                LastUpdateRelationship.AddNode(connectionType, node);
            }
            else
            {
                LastUpdateRelationship = CreateNewUpdateRelationship();
                LastUpdateRelationship.AddNode(connectionType, node);
                chain.AddTransaction(LastUpdateRelationship);
            }

            chain.TransactionExecuting += OnTransactionExecuting;
        }
Example #11
0
        public override void Update(string name, string value, Proxy.INode node, Proxy.IRelationship relationship, Proxy.ConnectionType connectionType, ref TransactionFramework.TransactionChain chain)
        {
            base.Update(name, value, node, relationship, connectionType, ref chain);

            TransactionFramework.UpdateMetadataTransactionLink updateMetadataTransaction = new TransactionFramework.UpdateMetadataTransactionLink();

            if (Node != null)
            {
                updateMetadataTransaction.DomainId = Node.DomainId;
            }
            else if (Relationship != null)
            {
                updateMetadataTransaction.DomainId = Relationship.DomainId;
            }

            updateMetadataTransaction.MapManager = MapManager;
            updateMetadataTransaction.Metadata   = this;
            updateMetadataTransaction.Name       = name;
            updateMetadataTransaction.Value      = value;

            chain.AddTransaction(updateMetadataTransaction);
        }
Example #12
0
        public override void Delete(ref TransactionFramework.TransactionChain chain)
        {
            base.Delete(ref chain);

            TransactionFramework.DeleteMetadataTransactionLink deleteMetadataTransction = new TransactionFramework.DeleteMetadataTransactionLink();

            if (Node != null)
            {
                deleteMetadataTransction.DomainId = Node.DomainId;
            }
            else if (Relationship != null)
            {
                deleteMetadataTransction.DomainId = Relationship.DomainId;
            }

            deleteMetadataTransction.MapManager = MapManager;
            deleteMetadataTransction.Metadata   = this;

            chain.AddTransaction(deleteMetadataTransction);

            /// TODO: Need to consider whether the following should be done here. It was originally done in the base but this really shouldn't happen for an InProcessMetadata as when add transaction
            /// returns (for the InProcessMetadata transaction link) the delete transaction still needs to occur.
            Proxy.MetadataSetFactory.GetInstance(MapManager).Remove(this);
        }
        public IMetadataSet Add(IRelationship relationship, ConnectionType connectionType, string name, string value, ref TransactionFramework.TransactionChain chain)
        {
            IMetadataSet metadataSet = null;

            if (connectionType != null && relationship != null)
            {
                foreach (IMetadataSet metadata in Metadata)
                {
                    if (metadata.Name == name && metadata.Relationship.Id == relationship.Id && metadata.ConnectionType.Id == connectionType.Id)
                    {
                        metadataSet = metadata;
                        break;
                    }
                }
            }
            else if (connectionType == null && relationship != null)
            {
                foreach (IMetadataSet metadata in Metadata)
                {
                    if (metadata.Name == name && metadata.Relationship.Id == relationship.Id)
                    {
                        metadataSet = metadata;
                        break;
                    }
                }
            }
            else
            {
                foreach (IMetadataSet metadata in Metadata)
                {
                    if (metadata.Name == name)
                    {
                        metadataSet = metadata;
                        break;
                    }
                }
            }

            if (metadataSet != null)
            {
                //TransactionFramework.UpdateMetadataTransactionLink updateMetadataTransaction = UpdateMetadataTransaction(metadataSet, Parent, name, value);
                metadataSet.Update(null, value, null, null, null, ref chain);
            }
            else
            {
                TransactionFramework.AddMetadataTransactionLink addMetadataTransaction = AddMetadataTransaction(metadataSet, Parent, relationship, connectionType, name, value);

                metadataSet = MetadataSetFactory.GetInstance(MapManager).GetMetadata(addMetadataTransaction, addMetadataTransaction.DomainId, addMetadataTransaction.RootMapId.Value, name, value, Parent, relationship, connectionType);

                chain.AddTransaction(addMetadataTransaction);

                Metadata.Add(metadataSet);

                IMetadataSetManager metadataSetManager = metadataSet as IMetadataSetManager;

                if (metadataSetManager != null)
                {
                    metadataSetManager.Container = this;
                }
            }

            return(metadataSet);
        }