コード例 #1
0
        TransactionFramework.InProcessTransactionResponse IBatchOperation.BuildTransactionChain(ref TransactionFramework.TransactionChain chain)
        {
            var response = new TransactionFramework.InProcessTransactionResponse();

            if (NewMap.Id != OriginalMap.Id)
            {
                Proxy.IRelationship newTransclusionRelationship = MapManager.CreateRelationship(NewMap.DomainId, NewMap.RootMapId.Value, MapContainerRelationshipType, string.Empty, ref chain);

                newTransclusionRelationship.ConnectNode(FromConnectionType, OriginalNode, ref chain);
                newTransclusionRelationship.ConnectNode(ToConnectionType, NewMap, ref chain);

                OriginalNode.Metadata.Add(newTransclusionRelationship, FromConnectionType, "XPosition", Location.X.ToString(), ref chain);
                OriginalNode.Metadata.Add(newTransclusionRelationship, FromConnectionType, "YPosition", Location.Y.ToString(), ref chain);

                IEnumerable <KeyValuePair <Proxy.ConnectionType, Proxy.IRelationship> > relationships = OriginalNode.Relationships.FindRelationships(MapManager.RelationshipTypes["FromToRelationship"]);

                foreach (KeyValuePair <Proxy.ConnectionType, Proxy.IRelationship> relationshipPair in relationships)
                {
                    Proxy.IRelationship relationshipToUpdate = relationshipPair.Value;
                    relationshipToUpdate.Update(MapManager.RelationshipTypes["TransclusionFromToRelationship"], ref chain);
                    relationshipToUpdate.ConnectNode(MapManager.ConnectionTypes["TransclusionMap"], OriginalMap, ref chain);
                }


                response.Relationships.Add(newTransclusionRelationship);
            }
            return(response);
        }
コード例 #2
0
        TransactionFramework.InProcessTransactionResponse IBatchOperation.BuildTransactionChain(ref TransactionFramework.TransactionChain chain)
        {
            var response = new TransactionFramework.InProcessTransactionResponse();

            Proxy.IRelationship newTransclusionRelationship = MapManager.CreateRelationship(From.DomainId, From.RootMapId.Value, TransclusionRelationshipType, string.Empty, ref chain);
            var relationships = Context.Relationships.FindRelationships(TransclusionRelationshipType);

            foreach (var keyValuePair in relationships)
            {
                var from = keyValuePair.Value.Nodes.FindNodes(FromConnectionType);
                var to   = keyValuePair.Value.Nodes.FindNodes(ToConnectionType);

                if (from == null || to == null || From == null || To == null)
                {
                    continue;
                }

                ///TODO Chris: following lines causing Bug 71
                if (from.Contains(From) && to.Contains(To))
                {
                    return(response);
                }
            }

            newTransclusionRelationship.ConnectNode(TransclusionMapConnectionType, Context, ref chain);
            newTransclusionRelationship.ConnectNode(FromConnectionType, From, ref chain);
            newTransclusionRelationship.ConnectNode(ToConnectionType, To, ref chain);



            response.Relationships.Add(newTransclusionRelationship);
            return(response);
        }
コード例 #3
0
        TransactionFramework.InProcessTransactionResponse IBatchOperation.BuildTransactionChain(ref TransactionFramework.TransactionChain chain)
        {
            var response = new TransactionFramework.InProcessTransactionResponse();
            Proxy.IRelationship newTransclusionRelationship = MapManager.CreateRelationship(From.DomainId, From.RootMapId.Value, TransclusionRelationshipType, string.Empty, ref chain);
            var relationships = Context.Relationships.FindRelationships(TransclusionRelationshipType);

            foreach (var keyValuePair in relationships)
            {
                var from = keyValuePair.Value.Nodes.FindNodes(FromConnectionType);
                var to = keyValuePair.Value.Nodes.FindNodes(ToConnectionType);

                if (from == null || to == null || From == null || To == null)
                {
                    continue;
                }

                ///TODO Chris: following lines causing Bug 71
                if (from.Contains(From) && to.Contains(To))
                {
                    return response;
                }
            }

            newTransclusionRelationship.ConnectNode(TransclusionMapConnectionType, Context, ref chain);
            newTransclusionRelationship.ConnectNode(FromConnectionType, From, ref chain);
            newTransclusionRelationship.ConnectNode(ToConnectionType, To, ref chain);

            

            response.Relationships.Add(newTransclusionRelationship);
            return response;
        }
コード例 #4
0
        TransactionFramework.InProcessTransactionResponse IBatchOperation.BuildTransactionChain(ref TransactionFramework.TransactionChain chain)
        {
            var response = new TransactionFramework.InProcessTransactionResponse();

            if (NewMap.Id != OriginalMap.Id)
            {
                Proxy.IRelationship newTransclusionRelationship = MapManager.CreateRelationship(NewMap.DomainId, NewMap.RootMapId.Value, MapContainerRelationshipType, string.Empty, ref chain);

                newTransclusionRelationship.ConnectNode(FromConnectionType, OriginalNode, ref chain);
                newTransclusionRelationship.ConnectNode(ToConnectionType, NewMap, ref chain);

                OriginalNode.Metadata.Add(newTransclusionRelationship, FromConnectionType, "XPosition", Location.X.ToString(), ref chain);
                OriginalNode.Metadata.Add(newTransclusionRelationship, FromConnectionType, "YPosition", Location.Y.ToString(), ref chain);

                IEnumerable<KeyValuePair<Proxy.ConnectionType, Proxy.IRelationship>> relationships = OriginalNode.Relationships.FindRelationships(MapManager.RelationshipTypes["FromToRelationship"]);

                foreach (KeyValuePair<Proxy.ConnectionType, Proxy.IRelationship> relationshipPair in relationships)
                {
                    Proxy.IRelationship relationshipToUpdate = relationshipPair.Value;
                    relationshipToUpdate.Update(MapManager.RelationshipTypes["TransclusionFromToRelationship"], ref chain);
                    relationshipToUpdate.ConnectNode(MapManager.ConnectionTypes["TransclusionMap"], OriginalMap, ref chain);
                }


                response.Relationships.Add(newTransclusionRelationship);
            }
            return response;
        }
コード例 #5
0
        TransactionFramework.InProcessTransactionResponse IBatchOperation.BuildTransactionChain(ref TransactionFramework.TransactionChain chain)
        {
            Node.Delete(ref chain);

            var response = new TransactionFramework.InProcessTransactionResponse();

            response.Nodes.Add(Node);
            return(response);
        }
コード例 #6
0
        TransactionFramework.InProcessTransactionResponse IBatchOperation.BuildTransactionChain(ref TransactionFramework.TransactionChain chain)
        {
            Node.Delete(ref chain);

            var response = new TransactionFramework.InProcessTransactionResponse();

            response.Nodes.Add(Node);
            return response;
        }
コード例 #7
0
 private void ChainOnTransactionCompleted(object sender, CompleteTransactionCompletedEventArgs e)
 {
     if (OperationCompleted != null)
     {
         Response = new TransactionFramework.InProcessTransactionResponse();
         Response.Relationships.Add(Relationship);
         OperationCompleted(sender, new NodeOperationCompletedArgs{Response = Response, ViewModeRelationship = ViewModeRelationship});
     }
 }
コード例 #8
0
 private void ChainOnTransactionCompleted(object sender, CompleteTransactionCompletedEventArgs e)
 {
     if (OperationCompleted != null)
     {
         Response = new TransactionFramework.InProcessTransactionResponse();
         Response.Relationships.Add(Relationship);
         OperationCompleted(sender, new NodeOperationCompletedArgs {
             Response = Response, ViewModeRelationship = ViewModeRelationship
         });
     }
 }
コード例 #9
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);
        }
コード例 #10
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);
        }
コード例 #11
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);
        }
コード例 #12
0
        public void Add(InProcessTransactionResponse response)
        {
            if (response.Nodes.Count > 0)
            {
                Nodes.AddRange(response.Nodes);
            }

            if (response.Relationships.Count > 0)
            {
                Relationships.AddRange(response.Relationships);
            }

            if (response.Metadata.Count > 0)
            {
                Metadata.AddRange(response.Metadata);
            }
        }
コード例 #13
0
        public void Add(InProcessTransactionResponse response)
        {
            if (response.Nodes.Count > 0)
            {
                Nodes.AddRange(response.Nodes);
            }

            if (response.Relationships.Count > 0)
            {
                Relationships.AddRange(response.Relationships);
            }

            if (response.Metadata.Count > 0)
            {
                Metadata.AddRange(response.Metadata);
            }
        }
コード例 #14
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);
        }
コード例 #15
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);
        }
コード例 #16
0
        private void AddClonedNodes(TransactionFramework.InProcessTransactionResponse response)
        {
            foreach (Proxy.INode modelNode in response.Nodes)
            {
                var viewModelNode = new Node(MapManager);
                viewModelNode.LoadNode(null, modelNode);
                ThemeManager.DressNode(viewModelNode);

                viewModelNode.IsFocused = false;
                viewModelNode.VideoInfo = VideoController.CreateVideoInfoViewModel(viewModelNode);

                viewModelNode.PropertyChanged += ViewModelNode_PropertyChanged;
                viewModelNode.LocationChanged += ViewModelNode_LocationChanged;

                var modelChangedEventArgs = new ModelChangedEventArgs <Node, Relationship>();
                modelChangedEventArgs.Nodes.Add(new KeyValuePair <Node, ModelOperationType>(viewModelNode, ModelOperationType.Clone));
                ModelChanged(this, modelChangedEventArgs);
            }
        }
コード例 #17
0
        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);
        }
コード例 #18
0
        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);
        }
コード例 #19
0
        TransactionFramework.InProcessTransactionResponse IBatchOperation.BuildTransactionChain(ref TransactionFramework.TransactionChain chain)
        {
            /// TODO: The following really needs to be refactored.
            var response = new TransactionFramework.InProcessTransactionResponse();

            var mapRelationships = Node.Relationships.FindRelationships(FromConnectionType, MapContainerRelationshipType);

            var mapsToRemove = new List <Proxy.IRelationship>();

            foreach (Proxy.IRelationship relationship in mapRelationships)
            {
                var maps = relationship.Nodes.FindNodes(ToConnectionType, MapNodeType);

                if (maps != null)
                {
                    foreach (Proxy.INode mapNode in maps)
                    {
                        if (mapNode.Id == Context.Id)
                        {
                            mapsToRemove.Add(relationship);
                            break;
                        }
                    }
                }
            }

            foreach (Proxy.IRelationship relationship in mapsToRemove)
            {
                relationship.Delete(ref chain);
                /// TODO: Need to move the following operation back into the relationship class.
                Proxy.IRelationshipManager relationships = Node.Relationships;
                relationships.Remove(relationship);
                response.Relationships.Add(relationship);
            }

            IEnumerable <KeyValuePair <Proxy.ConnectionType, Proxy.IRelationship> > transclusionRelationships = Node.Relationships.FindRelationships(TransclusionRelationshipType);

            List <Proxy.IRelationship> transclusionRelationshipsToRemove = new List <Proxy.IRelationship>();

            foreach (KeyValuePair <Proxy.ConnectionType, Proxy.IRelationship> relationshipPair in transclusionRelationships)
            {
                IEnumerable <Proxy.INode> maps = relationshipPair.Value.Nodes.FindNodes(TransclusionMapConnectionType, MapNodeType);

                if (maps != null)
                {
                    foreach (Proxy.INode mapNode in maps)
                    {
                        if (mapNode.Id == Context.Id)
                        {
                            transclusionRelationshipsToRemove.Add(relationshipPair.Value);
                            break;
                        }
                    }
                }
            }

            foreach (Proxy.IRelationship relationship in transclusionRelationshipsToRemove)
            {
                relationship.Delete(ref chain);
                /// TODO: Need to move the following operation back into the relationship class.
                Proxy.IRelationshipManager relationships = Node.Relationships;
                relationships.Remove(relationship);
                response.Relationships.Add(relationship);
            }
            return(response);
        }
コード例 #20
0
        TransactionFramework.InProcessTransactionResponse IBatchOperation.BuildTransactionChain(ref TransactionFramework.TransactionChain chain)
        {
            /// TODO: The following really needs to be refactored.
            var response = new TransactionFramework.InProcessTransactionResponse();

            var mapRelationships = Node.Relationships.FindRelationships(FromConnectionType, MapContainerRelationshipType);

            var mapsToRemove = new List<Proxy.IRelationship>();

            foreach (Proxy.IRelationship relationship in mapRelationships)
            {
                var maps = relationship.Nodes.FindNodes(ToConnectionType, MapNodeType);

                if (maps != null)
                {
                    foreach (Proxy.INode mapNode in maps)
                    {
                        if (mapNode.Id == Context.Id)
                        {
                            mapsToRemove.Add(relationship);
                            break;
                        }
                    }
                }
            }

            foreach (Proxy.IRelationship relationship in mapsToRemove)
            {
                relationship.Delete(ref chain);
                /// TODO: Need to move the following operation back into the relationship class.
                Proxy.IRelationshipManager relationships = Node.Relationships;
                relationships.Remove(relationship);
                response.Relationships.Add(relationship);
            }

            IEnumerable<KeyValuePair<Proxy.ConnectionType, Proxy.IRelationship>> transclusionRelationships = Node.Relationships.FindRelationships(TransclusionRelationshipType);

            List<Proxy.IRelationship> transclusionRelationshipsToRemove = new List<Proxy.IRelationship>();

            foreach (KeyValuePair<Proxy.ConnectionType, Proxy.IRelationship> relationshipPair in transclusionRelationships)
            {
                IEnumerable<Proxy.INode> maps = relationshipPair.Value.Nodes.FindNodes(TransclusionMapConnectionType, MapNodeType);

                if (maps != null)
                {
                    foreach (Proxy.INode mapNode in maps)
                    {
                        if (mapNode.Id == Context.Id)
                        {
                            transclusionRelationshipsToRemove.Add(relationshipPair.Value);
                            break;
                        }
                    }
                }
            }

            foreach (Proxy.IRelationship relationship in transclusionRelationshipsToRemove)
            {
                relationship.Delete(ref chain);
                /// TODO: Need to move the following operation back into the relationship class.
                Proxy.IRelationshipManager relationships = Node.Relationships;
                relationships.Remove(relationship);
                response.Relationships.Add(relationship);
            }
            return response;
        }
コード例 #21
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);
        }