상속: ISoapTransactionLinkExecutor
예제 #1
0
        /// <summary>
        /// TODO: I don't like how this is public.
        /// </summary>
        public void ProcessDelayedActions()
        {
            if (InProcessNode != null)
            {
                TransactionFramework.TransactionChain chain = new TransactionFramework.TransactionChain();

                InProcessNode.DelayedActions.CreateTransactions(ref chain);

                foreach (Proxy.IMetadataSet metadataSet in Metadata)
                {
                    Proxy.FacadeMetadataSet facadeMetadataSet = metadataSet as Proxy.FacadeMetadataSet;

                    if (facadeMetadataSet != null)
                    {
                        SoapMetadataSet soapMetadataSet = facadeMetadataSet.BaseMetadata as SoapMetadataSet;

                        if (soapMetadataSet != null)
                        {
                            soapMetadataSet.ProcessDelayedActions(ref chain);
                        }
                    }
                }

                MapManager.ExecuteTransaction(chain);
            }
        }
        private void CommitCollapseState(Node node, CollapseState state, ref TransactionFramework.TransactionChain chain)
        {
            var relationships = node.Proxy.Relationships.FindRelationships(FromConnectionType, MapContainerRelationshipType);

            var isComplete = false;

            foreach (Proxy.IRelationship relationship in relationships)
            {
                var potentialMapNodes = relationship.Nodes.FindNodes(ToConnectionType);

                foreach (Proxy.INode mapNode in potentialMapNodes)
                {
                    if (mapNode.Id == Map.Id)
                    {
                        isComplete = true;

                        node.Proxy.Metadata.Add(relationship, FromConnectionType, _collapseStateKey, state.ToString(), ref chain);

                        break;
                    }
                }

                if (isComplete)
                {
                    break;
                }
            }
        }
예제 #3
0
 public void ProcessDelayedActions(ref TransactionFramework.TransactionChain chain)
 {
     if (InProcessMetadata != null)
     {
         InProcessMetadata.DelayedActions.CreateTransactions(ref chain);
     }
 }
예제 #4
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;
                }
            }
        }
예제 #5
0
        public void AddTransactionChain(TransactionFramework.TransactionChain transactionChain)
        {
            TransactionChains.Enqueue(transactionChain);
            _hasChanged = true;

            //Save();
        }
 public void ExecuteOperation()
 {
     TransactionFramework.TransactionChain chain = new TransactionFramework.TransactionChain();
     Response = OperationBuilder.BuildTransactionChain(ref chain);
     chain.TransactionCompleted += ChainOnTransactionCompleted;
     MapManager.ExecuteTransaction(chain);
 }
 public void ExecuteOperation()
 {
     TransactionFramework.TransactionChain chain = new TransactionFramework.TransactionChain();
     Response = OperationBuilder.BuildTransactionChain(ref chain);
     chain.TransactionCompleted += ChainOnTransactionCompleted;
     MapManager.ExecuteTransaction(chain);
 }
예제 #8
0
        private void CommitLocation(Node node, Point location, ref TransactionFramework.TransactionChain chain)
        {
            //Replaced properties with Get methods in order to trace which property throws Null reference exception.
            var relationships = GetRelationships(GetProxy(node)).FindRelationships(FromConnectionType, MapContainerRelationshipType);
            var isComplete    = false;

            foreach (var relationship in relationships)
            {
                var potentialMapNodes = GetNodesFromRelationship(relationship).FindNodes(ToConnectionType);

                foreach (Proxy.INode mapNode in potentialMapNodes)
                {
                    if (mapNode.Id == GetMapId())
                    {
                        isComplete = true;

                        GetMetadataCollection(GetProxy(node)).Add(relationship, FromConnectionType, "XPosition", GetXPosition(location).ToString(), ref chain);
                        GetMetadataCollection(GetProxy(node)).Add(relationship, FromConnectionType, "YPosition", GetYPosition(location).ToString(), ref chain);

                        break;
                    }
                }

                if (isComplete)
                {
                    break;
                }
            }
        }
예제 #9
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);
            }
        }
예제 #10
0
 public void Delete(string key, ref TransactionFramework.TransactionChain chain)
 {
     if (Metadata.ContainsKey(key))
     {
         Metadata[key].Metadata.MetadataSet.Delete(ref chain);
         Remove(key);
     }
 }
 public void Delete()
 {
     if (MetadataSet != null)
     {
         var chain = new TransactionChain();
         MetadataSet.Delete(ref chain);
         MapManager.ExecuteTransaction(chain);
     }
 }
예제 #12
0
        public virtual void Delete(ref TransactionFramework.TransactionChain chain)
        {
            IMetadataSetManager metadataSetManager = this;

            metadataSetManager.Container.Remove(this);

            /// TODO: Need to consider whether the following should be done here.
            //MetadataSetFactory.GetInstance(MapManager).Remove(this);
        }
예제 #13
0
        public TransactionFramework.TransactionChain MoveToNextChain()
        {
            CurrentChain = TransactionChains.Dequeue();
            _hasChanged  = true;

            //Save();

            return(CurrentChain);
        }
예제 #14
0
        public void ExecuteTransaction(TransactionFramework.TransactionChain transactionChain)
        {
            /// TODO: Need to figure why this is happening for the re-alignment code.
            /// TODO: Probably should add a warning in the debugger to indicate there is a potential performance problem if there are too many chains with empty transactions.
            if (transactionChain.NumOfTransactions <= 0)
            {
                return;
            }

            TransactionFramework.ISoapTransactionLinkExecutor executor = transactionChain;

            if (executor == null)
            {
                throw new NotSupportedException("This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor.");
            }

            lock (_executionThreadsLock)
            {
                ExecutionThreads.AddTransactionChain(transactionChain);

                if (_isInProcess)
                {
                    executor = null;
                }
                else
                {
                    ExecutionThreads.MoveToNextChain();
                    _isInProcess = true;
                }
            }

            if (MapManagerActivityStatusUpdated != null)
            {
                Proxy.MapManagerActivityEventArgs status = new Proxy.MapManagerActivityEventArgs();
                status.TransactionsLeft = ExecutionThreads.Count + 1;
                status.Status           = Proxy.ActivityStatusEnum.Busy;

                MapManagerActivityStatusUpdated.Invoke(this, status);
            }

            if (executor != null)
            {
                /// TODO: Remove the following
                TransactionFramework.TransactionChain chain = executor as TransactionFramework.TransactionChain;

                if (chain != null)
                {
                    System.Diagnostics.Debug.WriteLine(chain.ChainId);
                }
                ///

                executor.TransactionFailed    += OnTransactionFailed;
                executor.TransactionCompleted += OnTransactionCompleted;
                executor.ExecuteTransaction(Guid.Empty, ServiceProxy);
            }
        }
예제 #15
0
        public override void Delete(ref TransactionFramework.TransactionChain chain)
        {
            base.Delete(ref chain);

            DelayedMetadataAction delayedAction = new DelayedMetadataAction();

            delayedAction.Action = TransactionActionType.Deleted;

            DelayedActions.Enqueue(delayedAction);
        }
예제 #16
0
        /// <summary>
        /// TODO: I don't like how this is public.
        /// </summary>
        public void ProcessDelayedActions()
        {
            if (InProcessRelationship != null)
            {
                TransactionFramework.TransactionChain chain = new TransactionFramework.TransactionChain();

                InProcessRelationship.DelayedActions.CreateTransactions(ref chain);

                MapManager.ExecuteTransaction(chain);
            }
        }
예제 #17
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);
        }
예제 #18
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);
        }
예제 #19
0
        public void ExecuteOperation()
        {
            var chain = new TransactionFramework.TransactionChain();

            _inProcessRelationship = MapManager.CreateRelationship(From.DomainId, From.RootMapId.Value, FromToRelationshipType, string.Empty, ref chain);

            _inProcessRelationship.ConnectNode(FromConnectionType, From, ref chain);
            _inProcessRelationship.ConnectNode(ToConnectionType, To, ref chain);
            Response = new TransactionFramework.InProcessTransactionResponse();
            Response.Relationships.Add(_inProcessRelationship);
            chain.TransactionCompleted += ChainOnTransactionCompleted;
            MapManager.ExecuteTransaction(chain);
        }
예제 #20
0
        public bool SetName(string name, ref TransactionChain chain)
        {
            if (MetadataSet.Name != name)
            {
                MetadataSet.Update(name, null, null, null, null, ref chain);

                OnNotifyPropertyChanged("Name");

                return true;
            }

            return false;
        }
예제 #21
0
        public void ExecuteOperation()
        {
            var chain = new TransactionFramework.TransactionChain();

            _inProcessRelationship = MapManager.CreateRelationship(From.DomainId, From.RootMapId.Value, FromToRelationshipType, string.Empty, ref chain);

            _inProcessRelationship.ConnectNode(FromConnectionType, From, ref chain);
            _inProcessRelationship.ConnectNode(ToConnectionType, To, ref chain);
            Response = new TransactionFramework.InProcessTransactionResponse();
            Response.Relationships.Add(_inProcessRelationship);
            chain.TransactionCompleted += ChainOnTransactionCompleted;
            MapManager.ExecuteTransaction(chain);
        }
예제 #22
0
        private void ViewModelNode_LocationChanged(object sender, LocationChangedEventArgs e)
        {
            var node = sender as Node;

            if (node != null)
            {
                var chain = new TransactionFramework.TransactionChain();

                CommitLocation(node, e.Location, ref chain);

                MapManager.ExecuteTransaction(chain);
            }
        }
예제 #23
0
        public bool SetValue(string value, ref TransactionChain chain)
        {
            if (MetadataSet.Value != value)
            {
                MetadataSet.Update(null, value, null, null, null, ref chain);

                OnNotifyPropertyChanged("Value");

                return true;
            }

            return false;
        }
예제 #24
0
        public void ExecuteOperation()
        {
            if (Relationship.RelationshipType == MapManager.RelationshipTypes["TransclusionFromToRelationship"])
            {
                ///TODO Chris: Need to check this
                //throw new NotSupportedException("Transclusions can't be deleted using a standard relationship delete method.");
            }

            TransactionFramework.TransactionChain chain = new TransactionFramework.TransactionChain();
            chain.TransactionCompleted += ChainOnTransactionCompleted;
            Relationship.Delete(ref chain);

            MapManager.ExecuteTransaction(chain);
        }
예제 #25
0
 public void ExecuteOperation()
 {
     var chain = new TransactionFramework.TransactionChain();
     chain.TransactionCompleted += ChainOnTransactionCompleted;
     foreach (var keyValuePair in Relationships)
     {
         if (keyValuePair.Key.Proxy.RelationshipType == MapManager.RelationshipTypes["TransclusionFromToRelationship"])
         {
             ///TODO Chris: Need to check this
             //throw new NotSupportedException("Transclusions can't be deleted using a standard relationship delete method.");
         }
         keyValuePair.Key.Proxy.Delete(ref chain);                
     }
     MapManager.ExecuteTransaction(chain);
 }
        public void ExecuteOperation()
        {
            Response = new TransactionFramework.InProcessTransactionResponse();

            var chain = new TransactionFramework.TransactionChain();
            chain.TransactionCompleted += ChainOnTransactionCompleted;
            while (Operations.Count > 0)
            {
                IBatchOperation operation = Operations.Dequeue();

                TransactionFramework.InProcessTransactionResponse newResponse = operation.BuildTransactionChain(ref chain);

                Response.Add(newResponse);
            }
            MapManager.ExecuteTransaction(chain);
        }
예제 #27
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;
        }
예제 #28
0
        public bool SetName(string name, ref TransactionChain chain)
        {
            if (_name != name)
            {
                _name = name;

                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("Name"));
                }

                return true;
            }

            return false;
        }
예제 #29
0
        public void ExecuteOperation()
        {
            var chain = new TransactionFramework.TransactionChain();

            chain.TransactionCompleted += ChainOnTransactionCompleted;
            foreach (var keyValuePair in Relationships)
            {
                if (keyValuePair.Key.Proxy.RelationshipType == MapManager.RelationshipTypes["TransclusionFromToRelationship"])
                {
                    ///TODO Chris: Need to check this
                    //throw new NotSupportedException("Transclusions can't be deleted using a standard relationship delete method.");
                }
                keyValuePair.Key.Proxy.Delete(ref chain);
            }
            MapManager.ExecuteTransaction(chain);
        }
        public void ExecuteOperation()
        {
            if (Relationship.RelationshipType == MapManager.RelationshipTypes["TransclusionFromToRelationship"])
            {
                ///TODO Chris: Need to check this
                //throw new NotSupportedException("Transclusions can't be deleted using a standard relationship delete method.");
            }

            TransactionFramework.TransactionChain chain = new TransactionFramework.TransactionChain();
            chain.TransactionCompleted += ChainOnTransactionCompleted;
            Relationship.Delete(ref chain);

            MapManager.ExecuteTransaction(chain);

            
        }
예제 #31
0
        public void ExecuteTransactions(Queue <TransactionFramework.TransactionChain> chains)
        {
            TransactionFramework.TransactionChain firstChain = null;

            lock (_executionThreadsLock)
            {
                while (chains.Count > 0)
                {
                    TransactionFramework.TransactionChain chain = chains.Dequeue();

                    /// TODO: Need to figure why this is happening for the re-alignment code.
                    /// TODO: Probably should add a warning in the debugger to indicate there is a potential performance problem if there are too many chains with empty transactions.
                    if (chain.NumOfTransactions <= 0)
                    {
                        continue;
                    }

                    if (firstChain == null)
                    {
                        firstChain = chain;

                        ExecutionThreads.AddTransactionChain(firstChain);

                        if (_isInProcess)
                        {
                            firstChain = null;
                        }
                        else
                        {
                            ExecutionThreads.MoveToNextChain();
                            _isInProcess = true;
                        }
                    }
                    else
                    {
                        ExecutionThreads.AddTransactionChain(chain);
                    }
                }
            }

            if (firstChain != null)
            {
                firstChain.TransactionFailed    += OnTransactionFailed;
                firstChain.TransactionCompleted += OnTransactionCompleted;
                firstChain.ExecuteTransaction(Guid.Empty, ServiceProxy);
            }
        }
예제 #32
0
        public void ExecuteOperation()
        {
            Response = new TransactionFramework.InProcessTransactionResponse();

            var chain = new TransactionFramework.TransactionChain();

            chain.TransactionCompleted += ChainOnTransactionCompleted;
            while (Operations.Count > 0)
            {
                IBatchOperation operation = Operations.Dequeue();

                TransactionFramework.InProcessTransactionResponse newResponse = operation.BuildTransactionChain(ref chain);

                Response.Add(newResponse);
            }
            MapManager.ExecuteTransaction(chain);
        }
예제 #33
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;
        }
예제 #34
0
            /// <summary>
            /// Executes the number of transactions specified.
            /// False if all transactions have been executed. True if there are still transactions to complete.
            /// </summary>
            /// <param name="numberOfTransactions"></param>
            /// <returns>False if all transactions have been executed. True if there are still transactions to complete.</returns>
            public bool ExecuteTransactions(int numberOfTransactions)
            {
                for (int i = 0; i < numberOfTransactions; i++)
                {
                    if (TransactionQueue.Count > 0)
                    {
                        TransactionFramework.TransactionChain transactionChain = TransactionQueue.Dequeue();
                        transactionChain.TransactionCompleted += TransactionChainOnTransactionCompleted;
                        MapManager.ExecuteTransaction(transactionChain);
                    }
                    else
                    {
                        return(false);
                    }
                }

                return(TransactionQueue.Count > 0);
            }
예제 #35
0
        public void ExecuteOperation()
        {
            CloneMap = new Dictionary<Node, INode>();
            var chain = new TransactionChain();
            chain.TransactionCompleted += ChainOnTransactionCompleted;
            Response = new InProcessTransactionResponse();
            foreach (var node in Nodes)
            {
                CloneMap.Add(node, BuildTransactionForNode(node, ref chain));
            }

            foreach (var relationship in Relationships)
            {
                BuildTransactionForRelationship(relationship, ref chain);
            }

            MapManager.ExecuteTransaction(chain);
        }
예제 #36
0
        private void OnTransactionChainFacadesCompleted(object sender, EventArgs e)
        {
            TransactionFramework.DependencyCollection dependencies = sender as TransactionFramework.DependencyCollection;

            if (dependencies == null)
            {
                return;
            }

            TransactionFramework.TransactionChain chain = dependencies.State as TransactionFramework.TransactionChain;

            if (chain == null)
            {
                return;
            }

            IncompleteExecutionThreads.Remove(chain);
            ExecuteTransaction(chain);
        }
예제 #37
0
            private void BuildRootViewRelationships(ref Queue <TransactionFramework.TransactionChain> transactionQueue)
            {
                TransactionFramework.TransactionChain chain = new TransactionFramework.TransactionChain();

                foreach (CompendiumViewRelationship viewRelationship in RootViews)
                {
                    Proxy.INode proxyNode = ProxyNodes[viewRelationship.FromNode.Id];

                    Proxy.IRelationship newRelationship = MapManager.CreateRelationship(Map.DomainId, Map.RootMapId.Value, MapManager.RelationshipTypes["MapContainerRelationship"], string.Empty, ref chain);
                    newRelationship.ConnectNode(MapManager.ConnectionTypes["To"], Map, ref chain);
                    newRelationship.ConnectNode(MapManager.ConnectionTypes["From"], proxyNode, ref chain);

                    proxyNode.Metadata.Add(newRelationship, MapManager.ConnectionTypes["From"], "XPosition", viewRelationship.XPosition.ToString(), ref chain);
                    proxyNode.Metadata.Add(newRelationship, MapManager.ConnectionTypes["From"], "YPosition", viewRelationship.YPosition.ToString(), ref chain);

                    //MapManager.ExecuteTransaction(chain);
                }

                transactionQueue.Enqueue(chain);
            }
        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);
            }
        }
예제 #39
0
            private void BuildNodeTransactions(ref Queue <TransactionFramework.TransactionChain> transactionQueue)
            {
                var transactionCounts = 0;
                var chain             = new TransactionFramework.TransactionChain();

                foreach (XmlModel.INode node in Nodes)
                {
                    if (node.NodeType == MapManager.NodeTypes["DomainNode"])
                    {
                        continue;
                    }

                    if (transactionCounts >= 150)
                    {
                        transactionQueue.Enqueue(chain);
                        chain             = new TransactionFramework.TransactionChain();
                        transactionCounts = 0;
                    }
                    else
                    {
                        transactionCounts++;
                    }

                    Proxy.INode newNode = MapManager.CreateNode(Map.DomainId, Map.RootMapId.Value, node.NodeType, string.Empty, ref chain);

                    ProxyNodes[node.Id] = newNode;

                    newNode.Metadata.Add(null, null, "Name", node.Name, ref chain);

                    if (node.NodeType == MapManager.NodeTypes["CompendiumReferenceNode"])
                    {
                        var link = string.Format("{0}/{1}/{2}", App.Params.SiteUrl, App.Params.FileUploadLibrary, node.Name);
                        newNode.Metadata.Add(null, null, "Link", link, ref chain);
                    }

                    //MapManager.ExecuteTransaction(chain);
                }

                transactionQueue.Enqueue(chain);
            }
            private void BuildNodeTransactions(ref Queue<TransactionFramework.TransactionChain> transactionQueue)
            {
                var transactionCounts = 0;
                var chain = new TransactionFramework.TransactionChain();

                foreach (XmlModel.INode node in Nodes)
                {
                    if (node.NodeType == MapManager.NodeTypes["DomainNode"])
                    {
                        continue;
                    }

                    if (transactionCounts >= 150)
                    {
                        transactionQueue.Enqueue(chain);
                        chain = new TransactionFramework.TransactionChain();
                        transactionCounts = 0;
                    }
                    else
                    {
                        transactionCounts++;
                    }

                    Proxy.INode newNode = MapManager.CreateNode(Map.DomainId, Map.RootMapId.Value, node.NodeType, string.Empty, ref chain);

                    ProxyNodes[node.Id] = newNode;

                    newNode.Metadata.Add(null, null, "Name", node.Name, ref chain);

                    if (node.NodeType == MapManager.NodeTypes["CompendiumReferenceNode"])
                    {
                        var link = string.Format("{0}/{1}/{2}", App.Params.SiteUrl, App.Params.FileUploadLibrary, node.Name);
                        newNode.Metadata.Add(null, null, "Link", link, ref chain);
                    }

                    //MapManager.ExecuteTransaction(chain);
                }

                transactionQueue.Enqueue(chain);
            }
예제 #41
0
        public void ExecuteOperation()
        {
            var chain = new TransactionFramework.TransactionChain();

            chain.TransactionCompleted += CommitLocationsCompleted;
            var isUpdated = false;

            foreach (var node in Nodes)
            {
                if (node.IsLocationDirty)
                {
                    node.IsLocationDirty = false;
                    isUpdated            = true;
                    CommitLocation(node, node.Location, ref chain);
                }
            }
            MapManager.ExecuteTransaction(chain);
            if (!isUpdated)
            {
                CommitLocationsCompleted(this, null);
            }
        }
        public void ExecuteOperation()
        {
            Response = new TransactionFramework.InProcessTransactionResponse();

            TransactionFramework.TransactionChain chain = new TransactionFramework.TransactionChain();
            chain.TransactionCompleted += ChainOnTransactionCompleted;
            while (Operations.Count > 0)
            {
                TranscludeNodesOperation operation = Operations.Dequeue();

                if (chain.NumOfTransactions > 50)
                {
                    MapManager.ExecuteTransaction(chain);
                    chain = new TransactionFramework.TransactionChain();
                }
                TransactionFramework.InProcessTransactionResponse newResponse = operation.OperationBuilder.BuildTransactionChain(ref chain);

                Response.Add(newResponse);
            }

            MapManager.ExecuteTransaction(chain);
        }
예제 #43
0
        public void ExecuteOperation()
        {
            var chain = new TransactionChain();
            chain.TransactionCompleted += ChainOnTransactionCompleted;
            INode newNode = MapManager.CreateNode(Map.DomainId, Map.RootMapId.Value, NodeType, string.Empty, ref chain);
            IRelationship newMapContainerRelationship = MapManager.CreateRelationship(Map.DomainId, Map.RootMapId.Value, MapContainerRelationshipType, string.Empty, ref chain);

            newMapContainerRelationship.ConnectNode(FromConnectionType, newNode, ref chain);
            newMapContainerRelationship.ConnectNode(ToConnectionType, Map, ref chain);

            newNode.Metadata.Add(newMapContainerRelationship, FromConnectionType, "XPosition", X.ToString(), ref chain);
            newNode.Metadata.Add(newMapContainerRelationship, FromConnectionType, "YPosition", Y.ToString(), ref chain);
            newNode.Metadata.Add(newMapContainerRelationship, FromConnectionType, "CollapseState", "None", ref chain);
            newNode.Metadata.Add(newMapContainerRelationship, FromConnectionType, "Visibility", "Visible", ref chain);

            if (DefaultMetadata != null)
            {
                if (!DefaultMetadata.ContainsKey("Name"))
                {
                    newNode.Metadata.Add(null, null, "Name", string.Empty, ref chain);
                }
                foreach (var valuePair in DefaultMetadata)
                {
                    newNode.Metadata.Add(null, null, valuePair.Key, valuePair.Value, ref chain);
                }
            }
            else
            {
                newNode.Metadata.Add(null, null, "Name", string.Empty, ref chain);
            }

            Response = new InProcessTransactionResponse();
            Response.Nodes.Add(newNode);
            Response.Relationships.Add(newMapContainerRelationship);

            MapManager.ExecuteTransaction(chain);
        }
예제 #44
0
        private INode BuildTransactionForNode(Node node, ref TransactionChain chain)
        {
            INode newNode = MapManager.CreateNode(Map.DomainId, Map.RootMapId.Value, node.Proxy.NodeType, string.Empty, ref chain);
            IRelationship newMapContainerRelationship = MapManager.CreateRelationship(Map.DomainId, Map.RootMapId.Value, MapContainerRelationshipType, string.Empty, ref chain);

            newMapContainerRelationship.ConnectNode(FromConnectionType, newNode, ref chain);
            newMapContainerRelationship.ConnectNode(ToConnectionType, Map, ref chain);

            newNode.Metadata.Add(newMapContainerRelationship, FromConnectionType, "XPosition", (node.Location.X + 100).ToString(), ref chain);
            newNode.Metadata.Add(newMapContainerRelationship, FromConnectionType, "YPosition", (node.Location.Y + 100).ToString(), ref chain);
            newNode.Metadata.Add(newMapContainerRelationship, FromConnectionType, "CollapseState", "None", ref chain);
            newNode.Metadata.Add(newMapContainerRelationship, FromConnectionType, "Visibility", "Visible", ref chain);

            foreach (var metadata in node.Metadata)
            {
                if (!string.IsNullOrEmpty(metadata.Value.Value))
                {
                    newNode.Metadata.Add(null, null, metadata.Key, metadata.Value.Value, ref chain);
                }
            }

            Response.Nodes.Add(newNode);
            return newNode;
        }
        private void OnPlaceholderPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            var propertyPlaceholder = sender as NewDataGridPropertyPlaceholder;

            if (propertyPlaceholder == null )
            {
                return;
            }

            if (string.IsNullOrEmpty(propertyPlaceholder.Name.Trim()))
            {
                return;
            }

            if (propertyPlaceholder.IsNew && MetadataCollection.ContainsKey(propertyPlaceholder.Name))
            {
                throw new Exception("Duplicate Name Inserted");
            }
            

            if (MetadataUpdating != null)
            {
                MetadataUpdating(this, null);
            }
            var chain = new TransactionChain();
            chain.TransactionCompleted += OnTransactionCompleted;
            string propertyValue = "";
            if (!string.IsNullOrEmpty(propertyPlaceholder.Value))
            {
                propertyValue = propertyPlaceholder.Value;
            }

            var multipleNodeMetadata = MetadataCollection["Name"] as MultipleNodeMetadata;
            if (multipleNodeMetadata != null)
            {
                foreach (var node in multipleNodeMetadata.NodeContainer.NodeProperties)
                {
                    node.Metadata.Add(propertyPlaceholder.Name, propertyValue, ref chain);
                }
            }
            else
            {
                propertyPlaceholder.MetadataSet = MetadataCollection.Add(propertyPlaceholder.Name, propertyValue, ref chain);
            }

            MapManager.ExecuteTransaction(chain);

            if (propertyPlaceholder.IsNew)
            {
                propertyPlaceholder.IsNew = false;

                AddNewLine();
            }
            
        }
예제 #46
0
 public void ExecuteOperation()
 {
     var chain = new TransactionFramework.TransactionChain();
     chain.TransactionCompleted += CommitLocationsCompleted;
     var isUpdated = false;
     foreach (var node in Nodes)
     {
         if (node.IsLocationDirty)
         {
             node.IsLocationDirty = false;
             isUpdated = true;
             CommitLocation(node, node.Location, ref chain);
         }
     }
     MapManager.ExecuteTransaction(chain);
     if (!isUpdated)
     {
          CommitLocationsCompleted(this, null);
     }
 }
        public bool SetValue(string value, ref TransactionChain chain)
        {
            if (_value != value)
            {
                _value = value;

                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("Value"));
                }

                return true;
            }

            return false;
        }
            private void BuildRelationships(ref Queue<TransactionFramework.TransactionChain> transactionQueue)
            {
                int transactionCounts = 0;
                TransactionFramework.TransactionChain chain = new TransactionFramework.TransactionChain();

                foreach (XmlModel.INode node in Nodes)
                {
                    foreach (XmlModel.IDescriptor descriptor in node.Descriptors)
                    {
                        if (descriptor.DescriptorType == null || descriptor.DescriptorType.Name == "From")
                        {
                            continue;
                        }

                        XmlModel.IRelationship relationship = descriptor.Relationship;
                        XmlModel.INode connectedNode = null;

                        foreach (XmlModel.IDescriptor linkedDescriptor in relationship.Descriptors)
                        {
                            if (linkedDescriptor != descriptor)
                            {
                                connectedNode = linkedDescriptor.Node;
                                break;
                            }
                        }

                        if (connectedNode == null)
                        {
                            // This means that there was no connected nodes or there may have been a circular reference.
                            continue;
                        }

                        Proxy.INode proxyNode;

                        if (ProxyNodes.ContainsKey(node.Id))
                        {
                            proxyNode = ProxyNodes[node.Id];
                        }
                        else
                        {
                            continue;
                        }

                        Proxy.INode proxyConnectedNode;

                        if (ProxyNodes.ContainsKey(connectedNode.Id))
                        {
                            proxyConnectedNode = ProxyNodes[connectedNode.Id];
                        }
                        else
                        {
                            continue;
                        }

                        if (proxyNode.NodeType == MapManager.NodeTypes["DomainNode"] || proxyConnectedNode.NodeType == MapManager.NodeTypes["DomainNode"])
                        {
                            continue;
                        }

                        if (transactionCounts >= 150)
                        {
                            transactionQueue.Enqueue(chain);
                            chain = new TransactionFramework.TransactionChain();
                            transactionCounts = 0;
                        }
                        else
                        {
                            transactionCounts++;
                        }

                        if (relationship is CompendiumLinkRelationship)
                        {
                            CompendiumLinkRelationship linkRelationship = relationship as CompendiumLinkRelationship;

                            if (!linkRelationship.IsTransclusion)
                            {
                                // In this situation the relationship is between two nodes in a map.
                                Proxy.IRelationship newRelationship = MapManager.CreateRelationship(Map.DomainId, Map.RootMapId.Value, MapManager.RelationshipTypes["FromToRelationship"], string.Empty, ref chain);
                                newRelationship.ConnectNode(MapManager.ConnectionTypes["To"], proxyNode, ref chain);
                                newRelationship.ConnectNode(MapManager.ConnectionTypes["From"], proxyConnectedNode, ref chain);
                            }
                            else
                            {
                                Proxy.INode proxyMap = ProxyNodes[linkRelationship.Map.Id];

                                // In this situation the relationship is a transclusion so we'll need to handle it slightly differently.
                                //Proxy.IRelationship newTranscludedNodeRelationship = MapManager.CreateRelationship(Map.DomainId, MapManager.RelationshipTypes["MapContainerRelationship"], string.Empty, ref chain);
                                //newTranscludedNodeRelationship.ConnectNode(MapManager.ConnectionTypes["To"], proxyMap, ref chain);
                                //newTranscludedNodeRelationship.ConnectNode(MapManager.ConnectionTypes["From"], transclusionNode, ref chain);

                                //transclusionNode.Metadata.Add(newTranscludedNodeRelationship, MapManager.ConnectionTypes["From"], "XPosition", transclusionRelationship.XPosition.ToString(), ref chain);
                                //transclusionNode.Metadata.Add(newTranscludedNodeRelationship, MapManager.ConnectionTypes["From"], "YPosition", transclusionRelationship.YPosition.ToString(), ref chain);

                                Proxy.IRelationship newTransclusionRelationship = MapManager.CreateRelationship(Map.DomainId, Map.RootMapId.Value, MapManager.RelationshipTypes["TransclusionFromToRelationship"], string.Empty, ref chain);

                                newTransclusionRelationship.ConnectNode(MapManager.ConnectionTypes["TransclusionMap"], proxyMap, ref chain);
                                newTransclusionRelationship.ConnectNode(MapManager.ConnectionTypes["To"], proxyNode, ref chain);
                                newTransclusionRelationship.ConnectNode(MapManager.ConnectionTypes["From"], proxyConnectedNode, ref chain);
                            }
                        }
                        else if (relationship is CompendiumViewRelationship)
                        {
                            CompendiumViewRelationship viewRelationship = relationship as CompendiumViewRelationship;

                            if (!viewRelationship.IsRootView)
                            {
                                // In this situation the relationship is between a node and a map node.
                                Proxy.IRelationship newRelationship = MapManager.CreateRelationship(Map.DomainId, Map.RootMapId.Value, MapManager.RelationshipTypes["MapContainerRelationship"], string.Empty, ref chain);
                                newRelationship.ConnectNode(MapManager.ConnectionTypes["To"], proxyNode, ref chain);
                                newRelationship.ConnectNode(MapManager.ConnectionTypes["From"], proxyConnectedNode, ref chain);

                                proxyConnectedNode.Metadata.Add(newRelationship, MapManager.ConnectionTypes["From"], "XPosition", viewRelationship.XPosition.ToString(), ref chain);
                                proxyConnectedNode.Metadata.Add(newRelationship, MapManager.ConnectionTypes["From"], "YPosition", viewRelationship.YPosition.ToString(), ref chain);
                            }
                        }
                        else
                        {
                            // In this situation the relationship is of an unknown type so lets just skip it.
                            continue;
                        }
                    }
                    //chains.Enqueue(chain);

                    //MapManager.ExecuteTransaction(chain);
                    ///
                }
                if (chain != null && chain.NumOfTransactions > 0)
                {
                    transactionQueue.Enqueue(chain);
                }
            }
예제 #49
0
        /// <summary>
        /// TODO: I don't like how this is public.
        /// </summary>
        public void ProcessDelayedActions()
        {
            if (InProcessRelationship != null)
            {
                TransactionFramework.TransactionChain chain = new TransactionFramework.TransactionChain();

                InProcessRelationship.DelayedActions.CreateTransactions(ref chain);

                MapManager.ExecuteTransaction(chain);
            }
        }
예제 #50
0
        void IEditableObject.EndEdit()
        {
            if (Updates.Count > 0)
            {
                //removes any operations that act on the same metadata key, only the last update is added to the chain
                CompactUpdates(); 

                var chain = new TransactionChain();
                foreach (var detail in Updates)
                {
                    switch (detail.Type)
                    {
                        case UpdateMetadataType.AddOrUpdateValue:
                            Metadata.Add(detail.NewKey, detail.NewValue, ref chain);
                            if (UIMetadata.ContainsKey(detail.NewKey))
                            {
                                UIMetadata[detail.NewKey] = detail.NewValue;
                            }
                            else
                            {
                                UIMetadata.Add(detail.NewKey, detail.NewValue);
                            }
                            OnNotifyPropertyChanged(detail.NewKey);
                            break;
                        case UpdateMetadataType.Delete:
                            if (Metadata.ContainsKey(detail.NewKey))
                            {

                                Metadata[detail.NewKey].MetadataSet.Delete(ref chain);
                                Metadata.Remove(detail.NewKey);
                            }

                            if (UIMetadata.ContainsKey(detail.NewKey))
                            {
                                UIMetadata.Remove(detail.NewKey);
                            }
                            break;
                        case UpdateMetadataType.UpdateKey:
                            if (Metadata.ContainsKey(detail.Key))
                            {
                                var metadataSet = Metadata[detail.Key];
                                metadataSet.SetName(detail.NewKey, ref chain);
                                if (!metadataSet.Value.Equals(detail.NewValue))
                                {
                                    metadataSet.SetValue(detail.NewValue, ref chain);
                                }
                                Metadata.Remove(detail.Key);
                                Metadata.Add(detail.NewKey, metadataSet);
                                UIMetadata.Remove(detail.Key);
                                UIMetadata.Add(detail.NewKey, detail.NewValue);
                            }
                            break;
                    }

                }
                MapManager.ExecuteTransaction(chain);
                Updates = new List<UpdateMetadataDetail>();
            }
        }
예제 #51
0
        /// <summary>
        /// TODO: I don't like how this is public.
        /// </summary>
        public void ProcessDelayedActions()
        {
            if (InProcessNode != null)
            {
                TransactionFramework.TransactionChain chain = new TransactionFramework.TransactionChain();

                InProcessNode.DelayedActions.CreateTransactions(ref chain);

                foreach (Proxy.IMetadataSet metadataSet in Metadata)
                {
                    Proxy.FacadeMetadataSet facadeMetadataSet = metadataSet as Proxy.FacadeMetadataSet;

                    if (facadeMetadataSet != null)
                    {
                        SoapMetadataSet soapMetadataSet = facadeMetadataSet.BaseMetadata as SoapMetadataSet;

                        if (soapMetadataSet != null)
                        {
                            soapMetadataSet.ProcessDelayedActions(ref chain);
                        }
                    }
                }

                MapManager.ExecuteTransaction(chain);
            }
        }
예제 #52
0
        private void HandleGetSourceAndPositionCallback(Event callback)
        {
            if (callback.EventArgs != null && callback.ContainsEventArg("CallbackId")
                && callback.ContainsEventArg("Position") && callback.ContainsEventArg("Source")
                && callback.ContainsEventArg("NodeId"))
            {
                string callbackId = callback.GetEventArgValue("CallbackId");
                string source = callback.GetEventArgValue("Source");
                source = HttpUtility.UrlDecode(source); 
                string viewModelIdAsString = callback.GetEventArgValue("NodeId");

                if (!string.IsNullOrEmpty(viewModelIdAsString) && !string.IsNullOrEmpty(source))
                {
                    var chain = new TransactionChain();
                    var viewModelId = new Guid(viewModelIdAsString);
                    var viewModelVideoInfo = ViewModels[viewModelId];

                    switch (callbackId)
                    {
                        case "StartPosition":
                            {
                                TimeSpan startPosition = TimeSpan.Parse(callback.GetEventArgValue("Position"));
                                // Just add a temporary end position so that the entry doesn't end up in a bad state.
                                ViewModel.IMetadata startPositionMetadata = viewModelVideoInfo.Context.Metadata["Video.StartPosition"];

                                if (startPositionMetadata != null)
                                {
                                    startPositionMetadata.SetValue(startPosition.ToString(), ref chain); 
                                    ((SuperGraph.ViewModel.Node)viewModelVideoInfo.Context).NodeProperties.UIMetadata["Video.StartPosition"] = startPosition.ToString();
                                }
                                else
                                {
                                    viewModelVideoInfo.Context.Metadata.Add("Video.StartPosition", startPosition.ToString(), ref chain);
                                    ((SuperGraph.ViewModel.Node)viewModelVideoInfo.Context).NodeProperties.UIMetadata.Add("Video.StartPosition", startPosition.ToString());
                                }

                                ViewModel.IMetadata endPositionMetadata = viewModelVideoInfo.Context.Metadata["Video.EndPosition"];

                                if (endPositionMetadata != null)
                                {
                                    endPositionMetadata.SetValue("", ref chain);
                                }
                                else
                                {
                                    viewModelVideoInfo.Context.Metadata.Add("Video.EndPosition", "", ref chain);
                                    ((SuperGraph.ViewModel.Node)viewModelVideoInfo.Context).NodeProperties.UIMetadata.Add("Video.EndPosition", "");
                                }

                                viewModelVideoInfo.HasVideo = true;
                                viewModelVideoInfo.StartPosition = startPosition;
                                viewModelVideoInfo.StopPosition = null;
                                break;
                            }
                        case "EndPosition":
                            {
                                TimeSpan endPosition = TimeSpan.Parse(callback.GetEventArgValue("Position"));

                                ViewModel.IMetadata endPositionMetadata = viewModelVideoInfo.Context.Metadata["Video.EndPosition"];

                                if (endPositionMetadata != null)
                                {
                                    endPositionMetadata.SetValue("", ref chain);
                                    ((SuperGraph.ViewModel.Node)viewModelVideoInfo.Context).NodeProperties.UIMetadata["Video.EndPosition"] = endPosition.ToString();
                                }
                                else
                                {
                                    viewModelVideoInfo.Context.Metadata.Add("Video.EndPosition", "", ref chain);
                                    ((SuperGraph.ViewModel.Node)viewModelVideoInfo.Context).NodeProperties.UIMetadata.Add("Video.EndPosition", endPosition.ToString());
                                }

                                viewModelVideoInfo.Context.Metadata.Add(null, null, "Video.EndPosition", endPosition.ToString(), ref chain);
                                viewModelVideoInfo.StopPosition = endPosition;
                                viewModelVideoInfo.HasVideo = true;
                                break;
                            }
                    }

                    ViewModel.IMetadata videoSourceMetadata = viewModelVideoInfo.Context.Metadata["Video.Source"];

                    if (videoSourceMetadata != null)
                    {
                        videoSourceMetadata.SetValue(source, ref chain);
                        ((SuperGraph.ViewModel.Node) viewModelVideoInfo.Context).NodeProperties.UIMetadata[
                            "Video.Source"] = source;
                    }
                    else
                    {
                        viewModelVideoInfo.Context.Metadata.Add(null, null, "Video.Source", source, ref chain);
                        ((SuperGraph.ViewModel.Node)viewModelVideoInfo.Context).NodeProperties.UIMetadata.Add("Video.Source", source);
                    }
                    viewModelVideoInfo.VideoSource = source;
                    viewModelVideoInfo.Context.Proxy.MapManager.ExecuteTransaction(chain);
                }
            }
        }
예제 #53
0
 public void Delete()
 {
     var metadataCollection = NodeContainer.NodeProperties.Where(node => node.Metadata.ContainsKey(Name)).Select(node => node.Metadata[Name].MetadataSet).ToList();
     if (metadataCollection.Count > 0)
     {
         var chain = new TransactionChain();
         chain.TransactionCompleted += OnTransactionCompleted;
         foreach (var metadataSet in metadataCollection)
         {
             metadataSet.Delete(ref chain);
         }
         MapManager.ExecuteTransaction(chain);
     }
 }
예제 #54
0
        public TransactionFramework.TransactionChain MoveToNextChain()
        {
            CurrentChain = TransactionChains.Dequeue();
            _hasChanged = true;

            //Save();

            return CurrentChain;
        }
예제 #55
0
        public void ExecuteOperation()
        {
            Proxy.NodeType nodeTypeToChangeTo;

            switch (ChangedTo)
            {
                case ViewModel.ChangeNodeTypeEnum.Question:
                    nodeTypeToChangeTo = MapManager.NodeTypes["CompendiumQuestionNode"];
                    break;

                case ViewModel.ChangeNodeTypeEnum.Idea:
                    nodeTypeToChangeTo = MapManager.NodeTypes["CompendiumIdeaNode"];
                    break;

                case ViewModel.ChangeNodeTypeEnum.Pro:
                    nodeTypeToChangeTo = MapManager.NodeTypes["CompendiumProNode"];
                    break;

                case ViewModel.ChangeNodeTypeEnum.Con:
                    nodeTypeToChangeTo = MapManager.NodeTypes["CompendiumConNode"];
                    break;

                case ViewModel.ChangeNodeTypeEnum.Map:
                    nodeTypeToChangeTo = MapManager.NodeTypes["CompendiumMapNode"];
                    break;
                case ViewModel.ChangeNodeTypeEnum.Note:
                    nodeTypeToChangeTo = MapManager.NodeTypes["CompendiumNoteNode"];
                    break;
                case ViewModel.ChangeNodeTypeEnum.Decision:
                    nodeTypeToChangeTo = MapManager.NodeTypes["CompendiumDecisionNode"];
                    break;

                default:
                    return;
            }

            TransactionFramework.TransactionChain chain = new TransactionFramework.TransactionChain();
            chain.TransactionCompleted += ChainOnTransactionCompleted;
            if (Node.Proxy.NodeType == MapManager.NodeTypes["CompendiumMapNode"])
            {
                IEnumerable<Proxy.IRelationship> relationships = Node.Proxy.Relationships.FindRelationships(MapManager.ConnectionTypes["To"], MapManager.RelationshipTypes["MapContainerRelationship"]);

                foreach (Proxy.IRelationship relationship in relationships)
                {
                    relationship.ConnectNode(MapManager.ConnectionTypes["To"], Context, ref chain);

                    IEnumerable<Proxy.INode> childNodes = relationship.Nodes.FindNodes(MapManager.ConnectionTypes["From"]);

                    foreach (Proxy.INode childNode in childNodes)
                    {
                        IEnumerable<KeyValuePair<Proxy.ConnectionType, Proxy.IRelationship>> transclusionRelationshipConnections = childNode.Relationships.FindRelationships(MapManager.RelationshipTypes["TransclusionFromToRelationship"]);

                        foreach (KeyValuePair<Proxy.ConnectionType, Proxy.IRelationship> transclusionRelationshipConnection in transclusionRelationshipConnections)
                        {
                            Proxy.IRelationship transclusionRelationship = transclusionRelationshipConnection.Value;

                            IEnumerable<Proxy.INode> transclusionMapNodes = transclusionRelationship.Nodes.FindNodes(MapManager.ConnectionTypes["TransclusionMap"]);

                            foreach (Proxy.INode transclusionMapNode in transclusionMapNodes)
                            {
                                if (transclusionMapNode.Id == Node.Proxy.Id)
                                {
                                    transclusionRelationship.ConnectNode(MapManager.ConnectionTypes["TransclusionMap"], Context, ref chain);

                                    break;
                                }
                            }
                        }
                    }
                }
            }

            Node.Proxy.Update(nodeTypeToChangeTo, ref chain);

            MapManager.ExecuteTransaction(chain);
        }
            private void BuildRootViewRelationships(ref Queue<TransactionFramework.TransactionChain> transactionQueue)
            {
                TransactionFramework.TransactionChain chain = new TransactionFramework.TransactionChain();

                foreach (CompendiumViewRelationship viewRelationship in RootViews)
                {
                    Proxy.INode proxyNode = ProxyNodes[viewRelationship.FromNode.Id];

                    Proxy.IRelationship newRelationship = MapManager.CreateRelationship(Map.DomainId, Map.RootMapId.Value, MapManager.RelationshipTypes["MapContainerRelationship"], string.Empty, ref chain);
                    newRelationship.ConnectNode(MapManager.ConnectionTypes["To"], Map, ref chain);
                    newRelationship.ConnectNode(MapManager.ConnectionTypes["From"], proxyNode, ref chain);

                    proxyNode.Metadata.Add(newRelationship, MapManager.ConnectionTypes["From"], "XPosition", viewRelationship.XPosition.ToString(), ref chain);
                    proxyNode.Metadata.Add(newRelationship, MapManager.ConnectionTypes["From"], "YPosition", viewRelationship.YPosition.ToString(), ref chain);

                    //MapManager.ExecuteTransaction(chain);
                }

                transactionQueue.Enqueue(chain);
            }
예제 #57
0
        private void BuildTransactionForRelationship(Relationship relationship, ref TransactionChain chain)
        {
            var inProcessRelationship = MapManager.CreateRelationship(Map.DomainId, Map.RootMapId.Value, FromToRelationshipType, string.Empty, ref chain);
            var from = Nodes.FirstOrDefault(q => q.Id == relationship.From);
            var to = Nodes.FirstOrDefault(q => q.Id == relationship.To);

            if (from != null && to != null && CloneMap.ContainsKey(from) && CloneMap.ContainsKey(to))
            {
                inProcessRelationship.ConnectNode(FromConnectionType, CloneMap[from], ref chain);
                inProcessRelationship.ConnectNode(ToConnectionType, CloneMap[to], ref chain);
            }

            Response.Relationships.Add(inProcessRelationship);
        }
 public void ExecuteOperation()
 {
     var chain = new TransactionFramework.TransactionChain();
     foreach (var node in PendingVisibilityNodes)
     {
         CommitVisibility(node, node.Visibility, ref chain);
         if (chain.NumOfTransactions > 50)
         {
             MapManager.ExecuteTransaction(chain);
             chain = new TransactionFramework.TransactionChain();
         }
     }
     foreach (var node in PendingCollapseNodes)
     {
         CommitCollapseState(node, node.State, ref chain);
         if (chain.NumOfTransactions > 50)
         {
             MapManager.ExecuteTransaction(chain);
             chain = new TransactionFramework.TransactionChain();
         }
     }
     MapManager.ExecuteTransaction(chain);
 }