private void OnTransactionCompleted(object sender, Service.CompleteTransactionCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                foreach (Service.CH change in e.Result.C)
                {
                    if (change.P == ResponseParameter.I)
                    {
                        if (change.N != null)
                        {
                            DebugLogger.Instance.LogMsg("Delete relationship transaction completed. ResponseParameter Id - '{0}'; Node ClientId - '{1}'; Returned NodeUid - '{2}';", ResponseParameter.I, Node.ClientId, change.N.N);
                            ServerObjects.Node soNode = MapManager.ServerObjectConverter.ToNode(change.N);
                            MapManager.NodeFactory.DeleteNode(soNode);
                        }
                        if (change.R != null)
                        {
                            DebugLogger.Instance.LogMsg("Delete relationship transaction completed. ResponseParameter Id - '{0}'; Node ClientId - '{1}'; Returned RelationshipUid - '{2}';", ResponseParameter.I, Node.ClientId, change.R.R);
                            ServerObjects.Relationship soRelationship = MapManager.ServerObjectConverter.ToRelationship(change.R);
                            MapManager.RelationshipFactory.DeleteRelationship(soRelationship);
                        }
                    }
                }
            }

            if (InternalTransactionCompleted != null)
            {
                InternalTransactionCompleted(this, e);
            }
        }
Beispiel #2
0
        public ServerObjects.Node ToNode(Service.NO soapServiceNode)
        {
            ServerObjects.Node soNode = new ServerObjects.Node();
            soNode.Depth          = soapServiceNode.DH;
            soNode.DomainUid      = soapServiceNode.D;
            soNode.RootMapUid     = soapServiceNode.RM;
            soNode.NodeOriginalId = soapServiceNode.O;
            soNode.NodeTypeUid    = soapServiceNode.T;
            soNode.NodeUid        = soapServiceNode.N;

            foreach (KeyValuePair <Service.MetadataContext, Service.DA> metadataContextPair in soapServiceNode.M)
            {
                Service.MetadataContext soapServiceMetadataContext = metadataContextPair.Key;
                Service.DA soapServiceMetadata = metadataContextPair.Value;

                ServerObjects.Metadata soMetadata = ToMetadata(soapServiceMetadata);

                ServerObjects.MetadataContext soMetadataContext = new ServerObjects.MetadataContext();
                soMetadataContext.DescriptorTypeUid = soapServiceMetadataContext.DescriptorTypeUid;
                soMetadataContext.MetadataId        = soapServiceMetadataContext.MetadataId;
                soMetadataContext.MetadataName      = soapServiceMetadataContext.MetadataName;
                soMetadataContext.NodeUid           = soapServiceMetadataContext.NodeUid;
                soMetadataContext.RelationshipUid   = soapServiceMetadataContext.RelationshipUid;

                soNode.Metadata.Add(soMetadataContext, soMetadata);
            }

            return(soNode);
        }
        public ServerObjects.Node ToNode(Service.NO soapServiceNode)
        {
            ServerObjects.Node soNode = new ServerObjects.Node();
            soNode.Depth = soapServiceNode.DH;
            soNode.DomainUid = soapServiceNode.D;
            soNode.RootMapUid = soapServiceNode.RM;
            soNode.NodeOriginalId = soapServiceNode.O;
            soNode.NodeTypeUid = soapServiceNode.T;
            soNode.NodeUid = soapServiceNode.N;

            foreach (KeyValuePair<Service.MetadataContext, Service.DA> metadataContextPair in soapServiceNode.M)
            {
                Service.MetadataContext soapServiceMetadataContext = metadataContextPair.Key;
                Service.DA soapServiceMetadata = metadataContextPair.Value;

                ServerObjects.Metadata soMetadata = ToMetadata(soapServiceMetadata);

                ServerObjects.MetadataContext soMetadataContext = new ServerObjects.MetadataContext();
                soMetadataContext.DescriptorTypeUid = soapServiceMetadataContext.DescriptorTypeUid;
                soMetadataContext.MetadataId = soapServiceMetadataContext.MetadataId;
                soMetadataContext.MetadataName = soapServiceMetadataContext.MetadataName;
                soMetadataContext.NodeUid = soapServiceMetadataContext.NodeUid;
                soMetadataContext.RelationshipUid = soapServiceMetadataContext.RelationshipUid;

                soNode.Metadata.Add(soMetadataContext, soMetadata);
            }

            return soNode;
        }
Beispiel #4
0
        private void OnTransactionCompleted(object sender, Service.CompleteTransactionCompletedEventArgs e)
        {
            TransactionStatus = ServerStatus.TransactionCompleted;

            if (e.Error == null)
            {
                foreach (Service.CH change in e.Result.C)
                {
                    if (change.P == ResponseParameter.I)
                    {
                        if (change.N != null)
                        {
                            DebugLogger.Instance.LogMsg("Load node transaction completed. ResponseParameter Id - '{0}'; ClientId - '{1}'; Returned NodeUid - '{2}';", ResponseParameter.I, _inProcessResponse.ClientId, change.N.N);
                            ServerObjects.Node soNode = MapManager.ServerObjectConverter.ToNode(change.N);
                            MapManager.NodeFactory.UpgradeFacade(this, soNode);
                        }
                    }
                }
            }

            if (InternalTransactionCompleted != null)
            {
                InternalTransactionCompleted(this, e);
            }
        }
Beispiel #5
0
        public void UpdateNode(ServerObjects.Node serviceNode)
        {
            ServiceNode = serviceNode;

            Id         = ServiceNode.NodeUid;
            DomainId   = ServiceNode.DomainUid;
            RootMapId  = ServiceNode.RootMapUid;
            OriginalId = ServiceNode.NodeOriginalId;
            NodeType   = MapManager.NodeTypes[ServiceNode.NodeTypeUid];

            if (Status == Proxy.LoadState.None)
            {
                Status = Proxy.LoadState.Partial;
            }
        }
Beispiel #6
0
        public SoapNode(InProcess.InProcessNode inProcessNode, ServerObjects.Node serviceNode)
        {
            ServiceNode   = serviceNode;
            InProcessNode = inProcessNode;

            Id         = serviceNode.NodeUid;
            DomainId   = inProcessNode.DomainId;
            RootMapId  = inProcessNode.RootMapId;
            OriginalId = inProcessNode.OriginalId;
            NodeType   = inProcessNode.NodeType;
            Status     = Proxy.LoadState.Full;

            MapManager    = inProcessNode.MapManager;
            Relationships = inProcessNode.Relationships;
            Metadata      = inProcessNode.Metadata;
        }
Beispiel #7
0
        public Proxy.INode FindNode(ServerObjects.Node serviceNode)
        {
            Proxy.INode node;

            if (ProxyNodes.ContainsKey(serviceNode.NodeUid))
            {
                node = ProxyNodes[serviceNode.NodeUid];

                SoapNode soapNode = node as SoapNode;

                /// Not all the nodes that are stored in the NodeManager are SoapNodes, some are FacadeNodes. In this scenario we want to check if they have an inner SoapNode and use that instead.
                if (soapNode == null)
                {
                    if (node is FacadeNode)
                    {
                        FacadeNode facadeNode = node as FacadeNode;
                        soapNode = facadeNode.BaseNode as SoapNode;
                    }
                }

                if (soapNode != null)
                {
                    soapNode.UpdateNode(serviceNode);
                }
            }
            else
            {
                SoapNode soapNode = new SoapNode(MapManager);
                soapNode.UpdateNode(serviceNode);

                ProxyNodes.Add(soapNode.Id, soapNode);

                node = soapNode;
            }

            if (!ServiceNodes.ContainsKey(serviceNode.NodeUid))
            {
                ServiceNodes.Add(serviceNode.NodeUid, serviceNode);
            }

            return(node);
        }
Beispiel #8
0
        public ServerObjects.QueryResponse ToQueryResponse(Service.QueryResponse soapServiceQueryResponse)
        {
            ServerObjects.QueryResponse soQueryResponse = new ServerObjects.QueryResponse();

            if (soapServiceQueryResponse == null || soapServiceQueryResponse.Domain == null)
            {
                return(soQueryResponse);
            }

            soQueryResponse.Domain              = soapServiceQueryResponse.Domain.DomainUid;
            soQueryResponse.ErrorId             = soapServiceQueryResponse.ErrorId;
            soQueryResponse.ErrorMessage        = soapServiceQueryResponse.ErrorMessage;
            soQueryResponse.FinalObjectIndex    = soapServiceQueryResponse.FinalObjectIndex;
            soQueryResponse.LastObjectIndex     = soapServiceQueryResponse.LastObjectIndex;
            soQueryResponse.StartingObjectIndex = soapServiceQueryResponse.StartingObjectIndex;

            if (soapServiceQueryResponse.NodeContext != null)
            {
                soQueryResponse.NodeContext = ToNode(soapServiceQueryResponse.NodeContext);
            }

            foreach (Service.NO soapServiceNode in soapServiceQueryResponse.Nodes.Values)
            {
                ServerObjects.Node soNode = ToNode(soapServiceNode);

                soQueryResponse.Nodes.Add(soNode.NodeUid, soNode);
            }

            foreach (Service.RE soapServiceRelationship in soapServiceQueryResponse.Relationships.Values)
            {
                ServerObjects.Relationship soRelationship = ToRelationship(soapServiceRelationship);

                soQueryResponse.Relationships.Add(soRelationship.RelationshipUid, soRelationship);
            }

            return(soQueryResponse);
        }
Beispiel #9
0
 public void DeleteNode(ServerObjects.Node serviceNode)
 {
     DeleteNode(serviceNode.NodeUid);
 }
Beispiel #10
0
        public void UpgradeFacade(TransactionFramework.ISoapTransactionLink transactionLink, ServerObjects.Node serviceNode)
        {
            if (InProcessNodes.ContainsKey(transactionLink))
            {
                FacadeNode facadeNode = InProcessNodes[transactionLink];
                InProcess.InProcessNode inProcessNode = facadeNode.BaseNode as InProcess.InProcessNode;

                if (inProcessNode != null)
                {
                    SoapNode soapNode = new SoapNode(inProcessNode, serviceNode);

                    facadeNode.BaseNode = soapNode;

                    InProcessNodes.Remove(transactionLink);
                    ProxyNodes[facadeNode.Id] = facadeNode;

                    /// TODO: Need to consider a better way to do this. I don't like that there is a need to call this afterwards and maybe it should be done when creating the SoapNode. I don't like it because it doesn't have to be done everytime a new SoapNode is created e.g. if the SoapNode is created from a Service.NO as opposed to a returned call like here.
                    soapNode.ProcessDelayedActions();
                }
            }
        }
Beispiel #11
0
 public void CreateNode(ServerObjects.Node serviceNode)
 {
     FindNode(serviceNode);
 }
Beispiel #12
0
 public Proxy.INode FindNode(ServerObjects.Node serviceNode)
 {
     return(NodeManager.FindNode(serviceNode));
 }