public void ExecuteOperation() { var chain = new TransactionChain(); chain.TransactionCompleted += ChainOnTransactionCompleted; 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 = new InProcessTransactionResponse(); Response.Nodes.Add(newNode); Response.Relationships.Add(newMapContainerRelationship); MapManager.ExecuteTransaction(chain); }
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); }
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); }