Esempio n. 1
0
        public void Remove(IMetadataSet metadataSet)
        {
            List <TransactionFramework.ISoapTransactionLink> linksToRemove = new List <TransactionFramework.ISoapTransactionLink>();

            foreach (KeyValuePair <TransactionFramework.ISoapTransactionLink, FacadeMetadataSet> metadataSetPair in InProcessMetadata)
            {
                if (metadataSetPair.Value == metadataSet)
                {
                    linksToRemove.Add(metadataSetPair.Key);
                }
            }

            foreach (TransactionFramework.ISoapTransactionLink keyToRemove in linksToRemove)
            {
                InProcessMetadata.Remove(keyToRemove);
            }

            List <Guid> idsToRemove = new List <Guid>();

            foreach (KeyValuePair <Guid, IMetadataSet> metadataSetPair in Metadata)
            {
                if (metadataSetPair.Value == metadataSet)
                {
                    idsToRemove.Add(metadataSetPair.Key);
                }
            }

            foreach (Guid keyToRemove in idsToRemove)
            {
                Metadata.Remove(keyToRemove);
            }
        }
        ///////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////BUILD FROM V2.1 SCHEMA                 //////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////

        #region Constructors and Destructors

        /// <summary>
        ///   Initializes a new instance of the <see cref="MetadataReportObjectCore" /> class.
        /// </summary>
        /// <param name="parent"> The parent. </param>
        /// <param name="report"> The dataStructureObject. </param>
        public MetadataReportObjectCore(IMetadataSet parent, ReportType report)
            : base(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.MetadataReport), parent)
        {
            this._reportedAttributes = new List<IReportedAttributeObject>();
            this.id = report.id;
            if (report.Target != null)
            {
                this._target = new TargetObjectCore(this, report.Target);
            }

            if (report.AttributeSet != null)
            {
                if (ObjectUtil.ValidCollection(report.AttributeSet.ReportedAttribute))
                {
                    this._reportedAttributes.Clear();

                    foreach (ReportedAttributeType each in report.AttributeSet.ReportedAttribute)
                    {
                        this._reportedAttributes.Add(new ReportedAttributeObjectObjectCore(this, each));
                    }
                }
            }

            this.Validate();
        }
Esempio n. 3
0
        public IMetadataSet FindMetadata(INode node, ConnectionType connectionType, string name)
        {
            IMetadataSet metadataValue = (from metadataTriple in Metadata
                                          orderby metadataTriple.Node ascending
                                          where metadataTriple.Name == name && metadataTriple.Node.Equals(node) && metadataTriple.ConnectionType.Equals(connectionType)
                                          select metadataTriple).First();

            return(metadataValue);
        }
Esempio n. 4
0
        //public void Load(Guid metadataId, INode node, ConnectionType connectionType, string name, string value)
        //{
        //    IMetadataSet metadataTriple = MetadataSetFactory.GetInstance(MapManager).GetMetadata(metadataId, name, value, node, Parent, connectionType);
        //metadataTriple.Relationship = Parent;
        //metadataTriple.Node = node;
        //metadataTriple.ConnectionType = connectionType;
        //metadataTriple.Name = name;
        //metadataTriple.Value = value;

        //    Metadata.Add(metadataTriple);
        //}

        public IMetadataSet FindMetadata(string name)
        {
            IMetadataSet metadataValue = (from metadataTriple in Metadata
                                          orderby metadataTriple.Node ascending
                                          where metadataTriple.Name == name
                                          select metadataTriple).First();

            return(metadataValue);
        }
Esempio n. 5
0
        public VideoSizeHelper(TransactionalNodeService.Proxy.INode nodeContext)
        {
            IMetadataSet videoSizeMetadata = nodeContext.Metadata.FindMetadata("Video.Size");

            if (videoSizeMetadata != null)
            {
                Size = ParseVideoSize(videoSizeMetadata.Value);
            }
        }
Esempio n. 6
0
        public override bool Equals(object obj)
        {
            IMetadataSet comparisonObj = obj as IMetadataSet;

            if (comparisonObj != null)
            {
                return(comparisonObj.Id.Equals(Id));
            }

            return(false);
        }
Esempio n. 7
0
        private int NodeComparison(INode node1, INode node2)
        {
            int result = 0;

            if (node1 != null && node2 != null)
            {
                IMetadataSet node1Metadata = node1.Metadata.FindMetadata("Name");
                IMetadataSet node2Metadata = node2.Metadata.FindMetadata("Name");
                if (node1Metadata != null && node2Metadata != null)
                {
                    return(node1Metadata.Value.CompareTo(node2Metadata.Value));
                }
            }
            return(result);
        }
Esempio n. 8
0
        //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);
        }
Esempio n. 9
0
        private bool AreRelationshipsEqual(IRelationship relationship, IMetadataSet metadataSet)
        {
            if (metadataSet == null)
            {
                return(false);
            }

            if (relationship == null && metadataSet.Relationship == null)
            {
                return(true);
            }

            if (relationship != null && metadataSet.Relationship != null && relationship.Id == metadataSet.Relationship.Id)
            {
                return(true);
            }

            return(false);
        }
Esempio n. 10
0
        private bool AreConnectionTypesEqual(ConnectionType connectionType, IMetadataSet metadataSet)
        {
            if (metadataSet == null)
            {
                return false;
            }

            if (connectionType == null && metadataSet.ConnectionType == null)
            {
                return true;
            }

            if (connectionType != null && metadataSet.ConnectionType != null && connectionType.Id == metadataSet.ConnectionType.Id)
            {
                return true;
            }

            return false;
        }
Esempio n. 11
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);
        }
Esempio n. 12
0
        private bool AreConnectionTypesEqual(ConnectionType connectionType, IMetadataSet metadataSet)
        {
            if (metadataSet == null)
            {
                return(false);
            }

            if (connectionType == null && metadataSet.ConnectionType == null)
            {
                return(true);
            }

            if (connectionType != null && metadataSet.ConnectionType != null && connectionType.Id == metadataSet.ConnectionType.Id)
            {
                return(true);
            }

            return(false);
        }
Esempio n. 13
0
        private bool AreRelationshipsEqual(IRelationship relationship, IMetadataSet metadataSet)
        {
            if (metadataSet == null)
            {
                return false;
            }

            if (relationship == null && metadataSet.Relationship == null)
            {
                return true;
            }

            if (relationship != null && metadataSet.Relationship != null && relationship.Id == metadataSet.Relationship.Id)
            {
                return true;
            }

            return false;
        }
        public MetadataSetBaseCore(IMetadataSet builtFrom, IIdentifiableRetrievalManager retrievalManager)
            : base(builtFrom)
        {
            this.reports = new List<IMetadataReportBase>();
			this.builtFrom = builtFrom;
			this.metadataStructure = retrievalManager.GetIdentifiableObject<IMetadataStructureDefinitionObject>(
					builtFrom.MsdReference,
					typeof(IMetadataStructureDefinitionObject));
			if (builtFrom.DataProviderReference != null) {
                this.dataProvider = retrievalManager.GetIdentifiableObject<IDataProvider>(
						builtFrom.DataProviderReference,
						typeof(IDataProvider));
			}
			if (builtFrom.Reports != null) {
				/* foreach */
				foreach (IMetadataReport metadataReport  in  builtFrom.Reports) {
					IReportStructure rs = GetReportStructure(metadataReport,
							metadataStructure.ReportStructures);
					this.reports.Add(new MetadataReportBaseCore(rs, metadataReport, retrievalManager));
				}
			}
		}
Esempio n. 15
0
        public int CompareTo(IMetadataSet other)
        {
            if (other == null)
            {
                return(1);
            }

            int idHashCode    = Id.GetHashCode();
            int otherHashCode = other.GetHashCode();

            if (idHashCode > otherHashCode)
            {
                return(1);
            }
            else if (idHashCode == otherHashCode)
            {
                return(0);
            }
            else
            {
                return(-1);
            }
        }
Esempio n. 16
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);
        }
Esempio n. 17
0
        public IMetadataSet Add(IRelationship relationship, ConnectionType connectionType, string name, string value, ref TransactionChain chain)
        {
            IMetadataSet metadataSet = null;

            if (connectionType != null && relationship != null)
            {
                foreach (IMetadataSet metadata in Metadata)
                {
                    if (metadata.Name == name && metadata.Relationship.Id == relationship.Id && metadata.ConnectionType.Id == connectionType.Id)
                    {
                        metadataSet = metadata;
                        break;
                    }
                }
            }
            else if (connectionType == null && relationship != null)
            {
                foreach (IMetadataSet metadata in Metadata)
                {
                    if (metadata.Name == name && metadata.Relationship.Id == relationship.Id)
                    {
                        metadataSet = metadata;
                        break;
                    }
                }
            }
            else
            {
                foreach (IMetadataSet metadata in Metadata)
                {
                    if (metadata.Name == name)
                    {
                        metadataSet = metadata;
                        break;
                    }
                }
            }

            if (metadataSet != null)
            {
                //TransactionFramework.UpdateMetadataTransactionLink updateMetadataTransaction = UpdateMetadataTransaction(metadataSet, Parent, name, value);
                metadataSet.Update(null, value, null, null, null, ref chain);
            }
            else
            {
                AddMetadataTransactionLink addMetadataTransaction = AddMetadataTransaction(metadataSet, Parent, relationship, connectionType, name, value);

                metadataSet = MetadataSetFactory.GetInstance(MapManager).GetMetadata(addMetadataTransaction, addMetadataTransaction.DomainId, addMetadataTransaction.RootMapId.Value, name, value, Parent, relationship, connectionType);

                chain.AddTransaction(addMetadataTransaction);

                Metadata.Add(metadataSet);

                IMetadataSetManager metadataSetManager = metadataSet as IMetadataSetManager;

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

            return(metadataSet);
        }
Esempio n. 18
0
 public Metadata(IMetadataSet metadataSet, IMapManager mapManager)
 {
     MetadataSet = metadataSet;
     MapManager  = mapManager;
 }
Esempio n. 19
0
 public Metadata(IMetadataSet metadataSet, IMapManager mapManager)
 {
     MetadataSet = metadataSet;
     MapManager = mapManager;
 }
Esempio n. 20
0
        public void Remove(IMetadataSet metadataSet)
        {
            List<TransactionFramework.ISoapTransactionLink> linksToRemove = new List<TransactionFramework.ISoapTransactionLink>();

            foreach (KeyValuePair<TransactionFramework.ISoapTransactionLink, FacadeMetadataSet> metadataSetPair in InProcessMetadata)
            {
                if (metadataSetPair.Value == metadataSet)
                {
                    linksToRemove.Add(metadataSetPair.Key);
                }
            }

            foreach (TransactionFramework.ISoapTransactionLink keyToRemove in linksToRemove)
            {
                InProcessMetadata.Remove(keyToRemove);
            }

            List<Guid> idsToRemove = new List<Guid>();

            foreach (KeyValuePair<Guid, IMetadataSet> metadataSetPair in Metadata)
            {
                if (metadataSetPair.Value == metadataSet)
                {
                    idsToRemove.Add(metadataSetPair.Key);
                }
            }

            foreach (Guid keyToRemove in idsToRemove)
            {
                Metadata.Remove(keyToRemove);
            }
        }
Esempio n. 21
0
        public int CompareTo(IMetadataSet other)
        {
            if (other == null)
            {
                return 1;
            }

            int idHashCode = Id.GetHashCode();
            int otherHashCode = other.GetHashCode();

            if (idHashCode > otherHashCode)
            {
                return 1;
            }
            else if (idHashCode == otherHashCode)
            {
                return 0;
            }
            else
            {
                return -1;
            }
        }