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);
            }
        }
        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.R != null)
                        {
                            DebugLogger.Instance.LogMsg("Load relationship transaction completed. ResponseParameter Id - '{0}'; ClientId - '{1}'; Returned NodeUid - '{2}';", ResponseParameter.I, CreateInProcessObjects().ClientId, change.R.R);
                            ServerObjects.Relationship soRelationship = MapManager.ServerObjectConverter.ToRelationship(change.R);
                            MapManager.RelationshipFactory.UpgradeFacade(this, soRelationship);
                        }
                    }
                }
            }

            if (InternalTransactionCompleted != null)
            {
                InternalTransactionCompleted(this, e);
            }
        }
示例#3
0
        public ServerObjects.Relationship ToRelationship(Service.RE soapServiceRelationship)
        {
            ServerObjects.Relationship soRelationship = new ServerObjects.Relationship();
            soRelationship.DomainUid              = soapServiceRelationship.D;
            soRelationship.RootMapUid             = soapServiceRelationship.RM;
            soRelationship.RelationshipOriginalId = soapServiceRelationship.O;
            soRelationship.RelationshipTypeUid    = soapServiceRelationship.T;
            soRelationship.RelationshipUid        = soapServiceRelationship.R;

            foreach (KeyValuePair <Guid, Guid> nodePair in soapServiceRelationship.N)
            {
                soRelationship.Nodes.Add(nodePair.Key, nodePair.Value);
            }

            foreach (KeyValuePair <Service.MetadataContext, Service.DA> metadataContextPair in soapServiceRelationship.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;

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

            return(soRelationship);
        }
        public ServerObjects.Relationship ToRelationship(Service.RE soapServiceRelationship)
        {
            ServerObjects.Relationship soRelationship = new ServerObjects.Relationship();
            soRelationship.DomainUid = soapServiceRelationship.D;
            soRelationship.RootMapUid = soapServiceRelationship.RM;
            soRelationship.RelationshipOriginalId = soapServiceRelationship.O;
            soRelationship.RelationshipTypeUid = soapServiceRelationship.T;
            soRelationship.RelationshipUid = soapServiceRelationship.R;

            foreach (KeyValuePair<Guid, Guid> nodePair in soapServiceRelationship.N)
            {
                soRelationship.Nodes.Add(nodePair.Key, nodePair.Value);
            }

            foreach (KeyValuePair<Service.MetadataContext, Service.DA> metadataContextPair in soapServiceRelationship.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;

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

            return soRelationship;
        }
示例#5
0
        public void UpdateRelationship(ServerObjects.Relationship serviceRelationship)
        {
            ServiceRelationship = serviceRelationship;

            Id               = ServiceRelationship.RelationshipUid;
            DomainId         = ServiceRelationship.DomainUid;
            OriginalId       = ServiceRelationship.RelationshipOriginalId;
            RelationshipType = MapManager.RelationshipTypes[ServiceRelationship.RelationshipTypeUid];

            if (Status == Proxy.LoadState.None)
            {
                Status = Proxy.LoadState.Partial;
            }
        }
示例#6
0
        public SoapRelationship(InProcess.InProcessRelationship inProcessRelationship, ServerObjects.Relationship serviceRelationship)
        {
            ServiceRelationship   = serviceRelationship;
            InProcessRelationship = inProcessRelationship;

            Id               = serviceRelationship.RelationshipUid;
            DomainId         = inProcessRelationship.DomainId;
            RootMapId        = inProcessRelationship.RootMapId;
            OriginalId       = inProcessRelationship.OriginalId;
            RelationshipType = inProcessRelationship.RelationshipType;
            Status           = Proxy.LoadState.Full;

            MapManager = inProcessRelationship.MapManager;
            Nodes      = inProcessRelationship.Nodes;
            Metadata   = inProcessRelationship.Metadata;
        }
示例#7
0
        public Proxy.IRelationship FindRelationship(ServerObjects.Relationship serviceRelationship)
        {
            Proxy.IRelationship relationship;

            if (ProxyRelationships.ContainsKey(serviceRelationship.RelationshipUid))
            {
                relationship = ProxyRelationships[serviceRelationship.RelationshipUid];

                SoapRelationship soapRelationship = relationship as SoapRelationship;

                /// Not all the relationships that are stored in the RelationshipManager are SoapRelationships, some are FacadeRelationships. In this scenario we want to check if they have an inner SoapRelationship and use that instead.
                if (soapRelationship == null)
                {
                    if (relationship is FacadeRelationship)
                    {
                        FacadeRelationship facadeRelationship = relationship as FacadeRelationship;
                        soapRelationship = facadeRelationship.BaseRelationship as SoapRelationship;
                    }
                }

                if (soapRelationship != null)
                {
                    soapRelationship.UpdateRelationship(serviceRelationship);
                }
            }
            else
            {
                SoapRelationship soapRelationship = new SoapRelationship(MapManager);
                soapRelationship.UpdateRelationship(serviceRelationship);

                ProxyRelationships.Add(soapRelationship.Id, soapRelationship);

                relationship = soapRelationship;
            }

            if (!ServiceRelationships.ContainsKey(serviceRelationship.RelationshipUid))
            {
                ServiceRelationships.Add(serviceRelationship.RelationshipUid, serviceRelationship);
            }

            return(relationship);
        }
示例#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);
        }
示例#9
0
 public void DeleteRelationship(ServerObjects.Relationship serviceRelationship)
 {
     DeleteRelationship(serviceRelationship.RelationshipUid);
 }
示例#10
0
        public void UpgradeFacade(TransactionFramework.ISoapTransactionLink transactionLink, ServerObjects.Relationship serviceRelationship)
        {
            if (InProcessRelationships.ContainsKey(transactionLink))
            {
                FacadeRelationship facadeRelationship = InProcessRelationships[transactionLink];
                InProcess.InProcessRelationship inProcessRelationship = facadeRelationship.BaseRelationship as InProcess.InProcessRelationship;

                if (inProcessRelationship != null)
                {
                    SoapRelationship soapRelationship = new SoapRelationship(inProcessRelationship, serviceRelationship);

                    facadeRelationship.BaseRelationship = soapRelationship;

                    InProcessRelationships.Remove(transactionLink);
                    ProxyRelationships[facadeRelationship.Id] = facadeRelationship;

                    /// 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 SoapRelationship. I don't like it because it doesn't have to be done everytime a new SoapRelationship is created e.g. if the SoapNode is created from a Service.RE as opposed to a returned call like here.
                    soapRelationship.ProcessDelayedActions();
                }
            }
        }
示例#11
0
 public void CreateRelationship(ServerObjects.Relationship serviceRelationship)
 {
     FindRelationship(serviceRelationship);
 }