Ejemplo n.º 1
0
        //public IMetadataSet GetMetadata(Guid metadataId, string name, string value, INode node, IRelationship relationship, ConnectionType connectionType)
        //{
        //    Soap.SoapMetadataSet newMetadatSet = new Soap.SoapMetadataSet(MapManager);
        //    newMetadatSet.Id = metadataId;
        //    newMetadatSet.Name = name;
        //    newMetadatSet.Value = value;
        //    newMetadatSet.Node = node;
        //    newMetadatSet.Relationship = relationship;
        //    newMetadatSet.ConnectionType = connectionType;

        //    Metadata[metadataId] = newMetadatSet;

        //    return newMetadatSet;
        //}

        public void UpgradeFacade(TransactionFramework.ISoapTransactionLink link, ServerObjects.Metadata serviceMetadata)
        {
            if (!InProcessMetadata.ContainsKey(link))
            {
                return;
            }

            FacadeMetadataSet facadeMetadataSet = InProcessMetadata[link];

            InProcess.InProcessMetadata inProcessMetadata = facadeMetadataSet.BaseMetadata as InProcess.InProcessMetadata;

            if (inProcessMetadata == null)
            {
                return;
            }

            Soap.SoapMetadataSet soapMetadataSet = new Soap.SoapMetadataSet(inProcessMetadata, serviceMetadata);

            IMetadataSetManager soapMetadataSetManager      = soapMetadataSet as IMetadataSetManager;
            IMetadataSetManager inProcessMetadataSetManager = inProcessMetadata as IMetadataSetManager;

            if (soapMetadataSetManager != null && inProcessMetadataSetManager != null)
            {
                soapMetadataSetManager.Container = inProcessMetadataSetManager.Container;
            }

            facadeMetadataSet.BaseMetadata = soapMetadataSet;
            Metadata[soapMetadataSet.Id]   = soapMetadataSet;
            InProcessMetadata.Remove(link);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 4
0
        void IUpdatableMetadataSet.UpdateMetadataSet(ServerObjects.Metadata metadataSet)
        {
            if (BaseMetadata is IUpdatableMetadataSet)
            {
                IUpdatableMetadataSet updatableMetadataSet = BaseMetadata as IUpdatableMetadataSet;

                updatableMetadataSet.UpdateMetadataSet(metadataSet);
            }
        }
Ejemplo n.º 5
0
        public SoapMetadataSet(InProcess.InProcessMetadata inProcessMetadata, ServerObjects.Metadata serviceMetadata)
        {
            MapManager      = inProcessMetadata.MapManager;
            ServiceMetadata = serviceMetadata;

            Id             = serviceMetadata.MetadataId;
            Name           = inProcessMetadata.Name;
            Value          = inProcessMetadata.Value;
            Node           = inProcessMetadata.Node;
            Relationship   = inProcessMetadata.Relationship;
            ConnectionType = inProcessMetadata.ConnectionType;

            InProcessMetadata = inProcessMetadata;
        }
Ejemplo n.º 6
0
        public ServerObjects.Metadata ToMetadata(Service.DA soapServiceMetadata)
        {
            ServerObjects.Metadata soMetadata = new ServerObjects.Metadata();
            soMetadata.DescriptorTypeUid = soapServiceMetadata.D;
            soMetadata.MetadataId        = soapServiceMetadata.M;
            soMetadata.DomainUid         = soapServiceMetadata.DI;
            soMetadata.RootMapUid        = soapServiceMetadata.RM;
            soMetadata.MetadataName      = soapServiceMetadata.MN;
            soMetadata.MetadataTypeUid   = soapServiceMetadata.T;
            soMetadata.MetadataValue     = soapServiceMetadata.MV;
            soMetadata.NodeUid           = soapServiceMetadata.N;
            soMetadata.RelationshipUid   = soapServiceMetadata.R;

            return(soMetadata);
        }
        //public void Load(Guid metadataId, string name, string value)
        //{
        //    Load(metadataId, null, name, value);
        //}

        //public void Load(Guid metadataId, INode node, string name, string value)
        //{
        //    Load(metadataId, node, null, name, value);
        //}

        public IMetadataSet Load(ServerObjects.Metadata serviceMetadata, INode node)
        {
            IMetadataSet metadataSet = MetadataSetFactory.GetInstance(MapManager).GetMetadata(serviceMetadata, node, Parent);

            Metadata.Add(metadataSet);

            IMetadataSetManager metadataSetManager = metadataSet as IMetadataSetManager;

            if (metadataSetManager != null)
            {
                metadataSetManager.Container = this;
            }

            return(metadataSet);
        }
Ejemplo n.º 8
0
        public SoapMetadataSet(Proxy.IMapManager mapManager, ServerObjects.Metadata serviceMetadata, Proxy.INode node, Proxy.IRelationship relationship)
        {
            MapManager      = mapManager;
            ServiceMetadata = serviceMetadata;

            Id        = serviceMetadata.MetadataId;
            DomainId  = serviceMetadata.DomainUid;
            RootMapId = serviceMetadata.RootMapUid;
            Name      = serviceMetadata.MetadataName;
            Value     = serviceMetadata.MetadataValue;

            if (serviceMetadata.NodeUid.HasValue && serviceMetadata.NodeUid == node.Id)
            {
                Node = node;
            }
            else if (serviceMetadata.NodeUid.HasValue && serviceMetadata.NodeUid != node.Id)
            {
                throw new NotSupportedException("The node ID in the service metadata object differs to the provided node.");
            }
            else
            {
                Node = null;
            }

            if (serviceMetadata.RelationshipUid.HasValue && serviceMetadata.RelationshipUid == relationship.Id)
            {
                Relationship = relationship;
            }
            else if (serviceMetadata.RelationshipUid.HasValue && serviceMetadata.RelationshipUid != relationship.Id)
            {
                throw new NotSupportedException("The relationship ID in the service metadata object differs to the provided relationship.");
            }
            else
            {
                Relationship = null;
            }

            ConnectionType = null;

            if (serviceMetadata.DescriptorTypeUid.HasValue && serviceMetadata.DescriptorTypeUid != Guid.Empty)
            {
                if (MapManager.ConnectionTypes.ContainsKey(serviceMetadata.DescriptorTypeUid.Value))
                {
                    ConnectionType = MapManager.ConnectionTypes[serviceMetadata.DescriptorTypeUid.Value];
                }
            }
        }
Ejemplo n.º 9
0
        void IUpdatableMetadataSet.UpdateMetadataSet(ServerObjects.Metadata metadataSet)
        {
            INode          newNode           = null;
            IRelationship  newRelationship   = null;
            ConnectionType newConnectionType = null;

            if (metadataSet.NodeUid.HasValue)
            {
                newNode = MapManager.NodeFactory.FindNode(metadataSet.NodeUid.Value);
            }

            if (metadataSet.RelationshipUid.HasValue)
            {
                newRelationship = MapManager.RelationshipFactory.FindRelationship(metadataSet.RelationshipUid.Value);
            }

            if (metadataSet.DescriptorTypeUid.HasValue)
            {
                newConnectionType = MapManager.ConnectionTypes[metadataSet.DescriptorTypeUid.Value];
            }

            if (Node == newNode || Node.Id != newNode.Id)
            {
                Node = newNode;
            }

            if (Relationship == newRelationship || Relationship.Id != newRelationship.Id)
            {
                Relationship = newRelationship;
            }

            if (ConnectionType != newConnectionType)
            {
                ConnectionType = newConnectionType;
            }

            if (Name != metadataSet.MetadataName)
            {
                Name = metadataSet.MetadataName;
            }

            if (Value != metadataSet.MetadataValue)
            {
                Value = metadataSet.MetadataValue;
            }
        }
Ejemplo n.º 10
0
        public IMetadataSet Load(ServerObjects.Metadata serviceMetadata, IRelationship relationship)
        {
            IMetadataSet metadataSet = MetadataSetFactory.GetInstance(MapManager).GetMetadata(serviceMetadata, Parent, relationship);

            if (!ContainedMetadata.Contains(metadataSet.Id))
            {
                Metadata.Add(metadataSet);
                ContainedMetadata.Add(metadataSet.Id);
            }

            IMetadataSetManager metadataSetManager = metadataSet as IMetadataSetManager;

            if (metadataSetManager != null)
            {
                metadataSetManager.Container = this;
            }

            return(metadataSet);
        }
        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.M != null)
                        {
                            DebugLogger.Instance.LogMsg("Load metadata transaction completed. ResponseParameter Id - '{0}'; Name - '{1}'; Value - '{2}'; Returned MetadataId - '{3}'", ResponseParameter.I, Name, Value, change.M.M);
                            ServerObjects.Metadata soMetadata = MapManager.ServerObjectConverter.ToMetadata(change.M);
                            Proxy.MetadataSetFactory.GetInstance(MapManager).UpgradeFacade(this, soMetadata);
                        }
                    }
                }
            }

            if (InternalTransactionCompleted != null)
            {
                InternalTransactionCompleted(this, e);
            }
        }
Ejemplo n.º 12
0
        //public IMetadataSet GetMetadata(Guid metadataId)
        //{
        //    if (Metadata.ContainsKey(metadataId))
        //    {
        //        return Metadata[metadataId];
        //    }

        //    return null;
        //}

        public IMetadataSet GetMetadata(ServerObjects.Metadata serviceMetadata, INode node, IRelationship relationship)
        {
            IMetadataSet metadataSet = null;

            if (Metadata.ContainsKey(serviceMetadata.MetadataId))
            {
                metadataSet = Metadata[serviceMetadata.MetadataId];

                if (metadataSet is IUpdatableMetadataSet)
                {
                    IUpdatableMetadataSet updatableMetadataSet = metadataSet as IUpdatableMetadataSet;

                    updatableMetadataSet.UpdateMetadataSet(serviceMetadata);
                }
            }
            else
            {
                metadataSet = new Soap.SoapMetadataSet(MapManager, serviceMetadata, node, relationship);

                Metadata[metadataSet.Id] = metadataSet;
            }

            return(metadataSet);
        }
        public ServerObjects.Metadata ToMetadata(Service.DA soapServiceMetadata)
        {
            ServerObjects.Metadata soMetadata = new ServerObjects.Metadata();
            soMetadata.DescriptorTypeUid = soapServiceMetadata.D;
            soMetadata.MetadataId = soapServiceMetadata.M;
            soMetadata.DomainUid = soapServiceMetadata.DI;
            soMetadata.RootMapUid = soapServiceMetadata.RM;
            soMetadata.MetadataName = soapServiceMetadata.MN;
            soMetadata.MetadataTypeUid = soapServiceMetadata.T;
            soMetadata.MetadataValue = soapServiceMetadata.MV;
            soMetadata.NodeUid = soapServiceMetadata.N;
            soMetadata.RelationshipUid = soapServiceMetadata.R;

            return soMetadata;
        }