Exemplo n.º 1
0
        private void OnQueryMapPagedCompleted(object sender, Service.QueryMapPagedCompletedEventArgs e)
        {
            if (e != null && e.Result != null)
            {
                e.Result.DecompressResponse();
            }

            //ServiceProxy.QueryMapPagedCompleted -= OnQueryMapByIdPagedCompleted;
            Service.QueryResponse queryResponse = e.Result;

            QueryMapResponseStateInfo callerInfo = e.UserState as QueryMapResponseStateInfo;

            Service.QueryResponse aggregatedResponse = callerInfo.AggregatedResponse;//e.UserState as Service.QueryResponse;

            if (aggregatedResponse == null)
            {
                aggregatedResponse.Domain      = queryResponse.Domain;
                aggregatedResponse.NodeContext = queryResponse.NodeContext;

                aggregatedResponse.Nodes         = new Dictionary <Guid, Service.NO>();
                aggregatedResponse.Relationships = new Dictionary <Guid, Service.RE>();
            }

            foreach (KeyValuePair <Guid, Service.NO> nodePair in queryResponse.Nodes)
            {
                aggregatedResponse.Nodes[nodePair.Key] = nodePair.Value;
            }

            foreach (KeyValuePair <Guid, Service.RE> relationshipPair in queryResponse.Relationships)
            {
                aggregatedResponse.Relationships[relationshipPair.Key] = relationshipPair.Value;
            }

            if (queryResponse.LastObjectIndex >= queryResponse.FinalObjectIndex)
            {
                ServerObjects.QueryResponse soAggregatedResponse = ServerObjectConverter.ToQueryResponse(aggregatedResponse);

                Proxy.NodesEventArgs eventArgs = new Proxy.NodesEventArgs();

                Graph.NodesAndRelationshipBuildEventArgs(eventArgs, soAggregatedResponse.Nodes, soAggregatedResponse.Relationships);

                Proxy.INode context = eventArgs.Nodes[e.Result.NodeContext.N];

                if (callerInfo.ResponseType == QueryMapResponseStateType.ById)
                {
                    QueryMapByIdCompleted.FireEvent(context.Id, this, eventArgs);
                }
                else if (callerInfo.ResponseType == QueryMapResponseStateType.ByNode)
                {
                    QueryMapByNodeCompleted.FireEvent(context, this, eventArgs);
                }
            }
            else
            {
                QueryMapResponseStateInfo info = new QueryMapResponseStateInfo();
                info.AggregatedResponse = aggregatedResponse;
                info.ResponseType       = callerInfo.ResponseType;
                ServiceProxy.QueryMapPagedAsync(System.Windows.Browser.HtmlPage.Document.DocumentUri.ToString(), aggregatedResponse.Domain.DomainUid, aggregatedResponse.NodeContext.N, 1, null, null, queryResponse.LastObjectIndex + 1, info);
            }
        }
Exemplo n.º 2
0
        public void QueryMapByNodeAsync(Proxy.INode node, int depth)
        {
            QueryMapResponseStateInfo responseStateInfo = new QueryMapResponseStateInfo();

            responseStateInfo.ResponseType = QueryMapResponseStateType.ByNode;

            ServiceProxy.QueryMapAsync(System.Windows.Browser.HtmlPage.Document.DocumentUri.ToString(), node.DomainId, node.Id, depth, null, null, responseStateInfo);
        }
Exemplo n.º 3
0
 private void OnDomainAndMapSelected(Proxy.INode node, bool dialoagResult = true, bool isAuthorMode = false)
 {
     if (!IsInitialised)
     {
         InitialiseControllers();
     }
     LoadMap(node, dialoagResult, isAuthorMode);
 }
Exemplo n.º 4
0
        public VideoSizeHelper(TransactionalNodeService.Proxy.INode nodeContext)
        {
            IMetadataSet videoSizeMetadata = nodeContext.Metadata.FindMetadata("Video.Size");

            if (videoSizeMetadata != null)
            {
                Size = ParseVideoSize(videoSizeMetadata.Value);
            }
        }
 public CompendiumArchiveProcessor(FileInfo compendiumFile, Proxy.IMapManager mapManager, Proxy.INode map)
 {
     CompendiumFile = compendiumFile;
     _zipFile = new ZipFile(CompendiumFileStream);
     _fileCount = _zipFile.FileNamesInZip.Count();
     _fileNames = _zipFile.FileNamesInZip.ToList();
     MapManager = mapManager;
     Map = map;
 }
Exemplo n.º 6
0
 public CompendiumArchiveProcessor(FileInfo compendiumFile, Proxy.IMapManager mapManager, Proxy.INode map)
 {
     CompendiumFile = compendiumFile;
     _zipFile       = new ZipFile(CompendiumFileStream);
     _fileCount     = _zipFile.FileNamesInZip.Count();
     _fileNames     = _zipFile.FileNamesInZip.ToList();
     MapManager     = mapManager;
     Map            = map;
 }
Exemplo n.º 7
0
        public bool LoadRelationship(SoapNodeManager nodeManager)
        {
            Metadata.Clear();
            Proxy.INodeManager nodeSetManager = Nodes;
            nodeSetManager.Clear();

            foreach (KeyValuePair <ServerObjects.MetadataContext, ServerObjects.Metadata> metadataPair in ServiceRelationship.Metadata)
            {
                if (metadataPair.Value.NodeUid.HasValue)
                {
                    Proxy.INode node = nodeManager.FindNode(metadataPair.Value.NodeUid.Value);
                    Metadata.Load(metadataPair.Value, node);
                }
                else if (metadataPair.Value.RelationshipUid.HasValue)
                {
                    Metadata.Load(metadataPair.Value, null);
                }
            }

            foreach (KeyValuePair <Guid, Guid> relationship in ServiceRelationship.Nodes)
            {
                Guid descriptorTypeId = relationship.Key;
                Guid nodeId           = relationship.Value;

                // TODO: There needs to be a proper check for the ConnectionType that will perform an appropriate operation if none exists.
                if (MapManager.ConnectionTypes.ContainsKey(descriptorTypeId))
                {
                    Proxy.INode          node;
                    Proxy.ConnectionType connectionType = MapManager.ConnectionTypes[descriptorTypeId];

                    node = nodeManager.FindNode(nodeId);

                    Proxy.ConnectionSet connectionSet = Proxy.ConnectionSetFactory.Instance.GetConnection(node, this, connectionType);

                    if (node.Status != Proxy.LoadState.None)
                    {
                        Proxy.IRelationshipManager relationshipSetManager = node.Relationships;

                        relationshipSetManager.Load(connectionSet);
                    }

                    nodeSetManager.Load(connectionSet);
                }
            }

            Status = Proxy.LoadState.Full;

            ProcessDelayedActions();

            return(true);
        }
Exemplo n.º 8
0
        public void ChangeContextAsync(Proxy.INode mapObject)
        {
            var node = new Node(MapManager);

            node.LoadNode(null, mapObject);

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


            Context = node;

            LoadMap(Context);
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 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;
        }
Exemplo n.º 11
0
        public Proxy.INode CreateInProcessObjects()
        {
            if (_inProcessResponse == null)
            {
                _inProcessResponse = MapManager.NodeFactory.CreateNode(this, DomainParameter.GetParameterValue(Guid.Empty).V, RootMapParameter.GetParameterValue(Guid.Empty).V, NodeType, OriginalId);
                TransactionStatus  = ServerStatus.ProcessingClient;
                FacadeNode facadeNode = _inProcessResponse as FacadeNode;

                if (facadeNode != null)
                {
                    facadeNode.TransactionOrigin = this;
                    _inProcessResponse           = facadeNode;
                }
            }

            return(_inProcessResponse);
        }
Exemplo n.º 12
0
 private void LoadMap(Proxy.INode node, bool dialoagResult, bool isAuthorMode)
 {
     if (dialoagResult)
     {
         DebugLogger.Instance.LogMsg(string.Format("Loading Map[{0}] of Domain[{1}]", node.Id, node.DomainId));
         IsLoadMapByGuid = false;
         SuperGraph.ClearMapObjects();
         Breadcrumbs.BreadcrumbTrail.Clear();
         ShowLoading();
         _mapManager.QueryMapByIdCompleted.RegisterEvent(node.Id, QueryMapByDomain);
         _mapManager.QueryMapByIdAsync(node.DomainId, node.Id, 1);
         IoC.GetInstance <ISuperGraphRelationshipFactory>().IsSameDomain = false;
         if (isAuthorMode)
         {
             SuperGraph.AuthorMode();
         }
     }
 }
Exemplo n.º 13
0
        private void OnQueryMapByDomainCompleted(object sender, Service.QueryMapByDomainCompletedEventArgs e)
        {
            if (e != null && e.Result != null)
            {
                e.Result.DecompressResponse();
            }

            if (QueryMapByDomainCompleted != null)
            {
                Proxy.NodesEventArgs        eventArgs       = new Proxy.NodesEventArgs();
                ServerObjects.QueryResponse soQueryResponse = ServerObjectConverter.ToQueryResponse(e.Result);

                Graph.NodesAndRelationshipBuildEventArgs(eventArgs, soQueryResponse.Nodes, soQueryResponse.Relationships);

                Proxy.INode nodeContext = Graph.FindNode(soQueryResponse.NodeContext);

                QueryMapByDomainCompleted.FireEvent(nodeContext.DomainId, this, eventArgs);
            }
        }
Exemplo n.º 14
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);
            }
Exemplo n.º 15
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);
            }
Exemplo n.º 16
0
        public override void ConnectNode(Proxy.ConnectionType connectionType, Proxy.INode node, ref Soap.TransactionFramework.TransactionChain chain)
        {
            base.ConnectNode(connectionType, node, ref chain);

            if (Facade != null)
            {
                TransactionFramework.AddRelationshipTransactionLink addRelationshipTransaction = Facade.TransactionOrigin as TransactionFramework.AddRelationshipTransactionLink;

                if (addRelationshipTransaction != null)
                {
                    if (addRelationshipTransaction.TransactionStatus == TransactionFramework.ServerStatus.ProcessingClient)
                    {
                        addRelationshipTransaction.AddNode(connectionType, node);

                        return;
                    }
                }
            }

            DelayedActions.Enqueue(new DelayedRelationshipAction()
            {
                Action = Proxy.TransactionActionType.Updated, ConnectionType = connectionType, Node = node
            });
        }
Exemplo n.º 17
0
 public NodeProperties(TransactionalNodeService.Proxy.INode node)
 {
     _node = new Node(node);
 }
Exemplo n.º 18
0
            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);
                }
            }
Exemplo n.º 19
0
 public Node(TNSProxy.INode node)
 {
     Proxy      = node;
     MapManager = node.MapManager;
 }
Exemplo n.º 20
0
 private Proxy.NodeMetadataCollection GetMetadataCollection(Proxy.INode proxy)
 {
     return(proxy.Metadata);
 }
Exemplo n.º 21
0
 private Proxy.RelationshipSet GetRelationships(Proxy.INode proxy)
 {
     return(proxy.Relationships);
 }
Exemplo n.º 22
0
        public void LoadNode(TNSProxy.IRelationship relationship, TNSProxy.INode node)
        {
            Proxy = node;
            if (node.Status == TNSProxy.LoadState.Full)
            {
                /// Check that there isn't more than one MapContainerRelationship. If there is then this node is transcluded.
                IEnumerable <TNSProxy.IRelationship> mapContainerRelationships = node.Relationships.FindRelationships(MapManager.ConnectionTypes["From"], MapManager.RelationshipTypes["MapContainerRelationship"]);
                NumTranclusions = mapContainerRelationships.Count(rel => rel.MapManager.RelationshipFactory.FindRelationship(rel.Id) != null);
                IsTranscluded   = (NumTranclusions > 1); //BUG: value changes based on the current view, possibly incorrect as the node is either transcluded or not transcluded regardless of the view

                TNSProxy.NodeMetadataCollection metadata = node.Metadata;

                string xPositionAsString = "0";
                string yPositionAsString = "0";

                if (metadata.FindMetadata(relationship, "XPosition") != null)
                {
                    xPositionAsString = metadata.FindMetadata(relationship, "XPosition").Value;
                }

                if (metadata.FindMetadata(relationship, "YPosition") != null)
                {
                    yPositionAsString = metadata.FindMetadata(relationship, "YPosition").Value;
                }

                if (metadata.FindMetadata(relationship, "CollapseState") != null)
                {
                    _viewerCollapseState = (CollapseState)Enum.Parse(typeof(CollapseState), metadata.FindMetadata(relationship, "CollapseState").Value, true);
                }
                else
                {
                    _viewerCollapseState = CollapseState.None;
                }

                if (metadata.FindMetadata(relationship, "Visibility") != null)
                {
                    _viewerVisibility = metadata.FindMetadata(relationship, "Visibility").Value.Equals("visible", StringComparison.OrdinalIgnoreCase)
                        ? Visibility.Visible
                        : Visibility.Collapsed;
                }
                else
                {
                    _viewerVisibility = Visibility.Visible;
                }

                if (metadata.FindMetadata(relationship, "AuthorCollapseState") != null)
                {
                    _authorCollapseState = (CollapseState)Enum.Parse(typeof(CollapseState), metadata.FindMetadata(relationship, "AuthorCollapseState").Value, true);
                }
                else
                {
                    _authorCollapseState = CollapseState.None;
                }

                if (metadata.FindMetadata(relationship, "AuthorVisibility") != null)
                {
                    _authorVisibility = metadata.FindMetadata(relationship, "AuthorVisibility").Value.Equals("visible", StringComparison.OrdinalIgnoreCase)
                        ? Visibility.Visible
                        : Visibility.Collapsed;
                }
                else
                {
                    _authorVisibility = Visibility.Visible;
                }

                if (!string.IsNullOrEmpty(xPositionAsString) && !string.IsNullOrEmpty(yPositionAsString))
                {
                    double xPosition;
                    double yPosition;

                    if (double.TryParse(xPositionAsString, out xPosition) && double.TryParse(yPositionAsString, out yPosition))
                    {
                        _location = new Point(xPosition, yPosition);
                    }
                }

                IDictionary <string, TNSProxy.IMetadataSet> nodeMetadata = metadata.FindMetadata(null, (TNSProxy.ConnectionType)null);
                foreach (TNSProxy.IMetadataSet metadataSet in nodeMetadata.Values)
                {
                    IMetadata viewModelMetadata = ViewModelMetadataFactory.CreateMetadata(metadataSet);
                    viewModelMetadata.PropertyChanged += OnMetadataPropertyChanged;
                    Metadata.Add(viewModelMetadata.Name, viewModelMetadata);
                    NodeProperties.UIMetadata.Add(viewModelMetadata.Name, viewModelMetadata.Value);
                }

                if (!_isMetadataChangeRegistered)
                {
                    Metadata.CollectionChanged += OnCollectionChanged;
                    _isMetadataChangeRegistered = true;
                }
            }
        }
Exemplo n.º 23
0
        public IFileProcessor CreateFileProcessor(FileInfo file, Proxy.IMapManager mapManager, Proxy.INode map, Point location)
        {
            if (file.Name.EndsWith(".zip"))
            {
                using (FileStream fileStream = file.OpenRead())
                {
                    bool isCompendiumExport     = false;
                    bool hasExportsFolderAndXml = false;
                    bool hasLinkedFilesFolder   = false;

                    ZipFile zipFile = new ZipFile(fileStream);

                    foreach (string filename in zipFile.FileNamesInZip)
                    {
                        if (filename.StartsWith("Exports/"))
                        {
                            if (filename.EndsWith(".xml"))
                            {
                                isCompendiumExport = true;
                                //hasExportsFolderAndXml = true;

                                break;
                            }
                        }

                        //if (filename.StartsWith("Linked Files/"))
                        //{
                        //    hasLinkedFilesFolder = true;
                        //}

                        //if (hasExportsFolderAndXml && hasLinkedFilesFolder)
                        //{
                        //    isCompendiumExport = true;

                        //    break;
                        //}
                    }

                    if (isCompendiumExport)
                    {
                        var compendiumFileProcessor = new CompendiumArchiveProcessor(file,
                                                                                     mapManager, map);

                        return(compendiumFileProcessor);
                    }
                }
            }
            else if (file.Name.EndsWith(".xml"))
            {
                using (var stream = file.OpenRead())
                {
                    var compendiumXmlProcessor = new CompendiumXmlFileProcessor(stream, "", "");
                    compendiumXmlProcessor.MapManager = mapManager;
                    compendiumXmlProcessor.Map        = map;
                    if (compendiumXmlProcessor.Nodes.Any())
                    {
                        return(compendiumXmlProcessor);
                    }
                }
            }

            return(new DroppedFileProcessor(file, location));
        }
Exemplo n.º 24
0
 public void QueryMapByNodeAsync(Proxy.INode node)
 {
     QueryMapByNodeAsync(node, 1);
 }
Exemplo n.º 25
0
        public Proxy.INode CreateInProcessObjects()
        {
            if (_inProcessResponse == null)
            {
                _inProcessResponse = MapManager.NodeFactory.CreateNode(this, DomainParameter.GetParameterValue(Guid.Empty).V, RootMapParameter.GetParameterValue(Guid.Empty).V, NodeType, OriginalId);
                TransactionStatus = ServerStatus.ProcessingClient;
                FacadeNode facadeNode = _inProcessResponse as FacadeNode;

                if (facadeNode != null)
                {
                    facadeNode.TransactionOrigin = this;
                    _inProcessResponse = facadeNode;
                }
            }

            return _inProcessResponse;
        }
Exemplo n.º 26
0
        private void OnQueryMapCompleted(object sender, Service.QueryMapCompletedEventArgs e)
        {
            if (e != null && e.Result != null)
            {
                e.Result.DecompressResponse();
            }

            Proxy.NodesEventArgs eventArgs = new Proxy.NodesEventArgs();

            Service.QueryResponse     soapServiceQueryResponse = e.Result;
            QueryMapResponseStateInfo callerInfo = e.UserState as QueryMapResponseStateInfo;

            if (soapServiceQueryResponse.FinalObjectIndex <= 0)
            {
                ServerObjects.QueryResponse soQueryResponse = ServerObjectConverter.ToQueryResponse(soapServiceQueryResponse);

                Graph.NodesAndRelationshipBuildEventArgs(eventArgs, soQueryResponse.Nodes, soQueryResponse.Relationships);

                if (e.Result.NodeContext != null)
                {
                    Proxy.INode context = eventArgs.Nodes[e.Result.NodeContext.N];

                    if (callerInfo.ResponseType == QueryMapResponseStateType.ById)
                    {
                        QueryMapByIdCompleted.FireEvent(context.Id, this, eventArgs);
                    }
                    else if (callerInfo.ResponseType == QueryMapResponseStateType.ByNode)
                    {
                        QueryMapByNodeCompleted.FireEvent(context, this, eventArgs);
                    }
                }
                else
                {
                    /// TODO: Need to find a nicer way of handling this exception rather than just ignoring it altogether.
                    //throw new NodeNotFoundException("The given node wasn't found");
                }
            }
            else
            {
                Service.QueryResponse aggregatedResponse = new Service.QueryResponse();

                aggregatedResponse.Domain      = soapServiceQueryResponse.Domain;
                aggregatedResponse.NodeContext = soapServiceQueryResponse.NodeContext;

                aggregatedResponse.Nodes         = new Dictionary <Guid, Service.NO>();
                aggregatedResponse.Relationships = new Dictionary <Guid, Service.RE>();

                foreach (KeyValuePair <Guid, Service.NO> nodePair in soapServiceQueryResponse.Nodes)
                {
                    aggregatedResponse.Nodes[nodePair.Key] = nodePair.Value;
                }

                foreach (KeyValuePair <Guid, Service.RE> relationshipPair in soapServiceQueryResponse.Relationships)
                {
                    aggregatedResponse.Relationships[relationshipPair.Key] = relationshipPair.Value;
                }

                //ServiceProxy.QueryMapPagedCompleted += OnQueryMapByIdPagedCompleted;
                QueryMapResponseStateInfo info = new QueryMapResponseStateInfo();
                info.AggregatedResponse = aggregatedResponse;
                info.ResponseType       = callerInfo.ResponseType;
                ServiceProxy.QueryMapPagedAsync(System.Windows.Browser.HtmlPage.Document.DocumentUri.ToString(), aggregatedResponse.Domain.DomainUid, aggregatedResponse.NodeContext.N, 1, null, null, soapServiceQueryResponse.LastObjectIndex + 1, info);
            }
        }