当前位置: 首页>>代码示例>>C#>>正文


C# ISdmxObjects.GetAllMaintinables方法代码示例

本文整理汇总了C#中ISdmxObjects.GetAllMaintinables方法的典型用法代码示例。如果您正苦于以下问题:C# ISdmxObjects.GetAllMaintinables方法的具体用法?C# ISdmxObjects.GetAllMaintinables怎么用?C# ISdmxObjects.GetAllMaintinables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISdmxObjects的用法示例。


在下文中一共展示了ISdmxObjects.GetAllMaintinables方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ResolveReferencesInternal

        /// <summary>
        /// The resolve references internal.
        /// </summary>
        /// <param name="beans">
        /// The beans.
        /// </param>
        /// <param name="retrievalManager">
        /// The retrieval manager.
        /// </param>
        /// <param name="populateMissingMap">
        /// The populate missing map.
        /// </param>
        /// <returns>
        /// The <see cref="IDictionary"/>.
        /// </returns>
        /// <exception cref="ReferenceException">
        /// </exception>
        private IDictionary<IIdentifiableObject, ISet<IIdentifiableObject>> ResolveReferencesInternal(
            ISdmxObjects beans, 
            ISdmxRetrievalManager retrievalManager, 
            IDictionary<IIdentifiableObject, ISet<ICrossReference>> populateMissingMap)
        {
            this._structureRetrievalManager = retrievalManager;

            /* foreach */
            foreach (IAgency currentAgency in beans.Agencies)
            {
                this._agencies.Add(currentAgency.FullId, currentAgency);
            }

            // Add all the top level beans to the maintainables list
            beans.GetAllMaintinables().AddAll(this._maintianables);

            // LOOP THROUGH ALL THE BEANS AND RESOLVE ALL THE REFERENCES
            if (this._resolveAgencies)
            {
                /* foreach */
                foreach (IMaintainableObject currentBean in beans.GetAllMaintinables())
                {
                    try
                    {
                        this.ResoveAgency(currentBean);
                    }
                    catch (ReferenceException e)
                    {
                        throw new ReferenceException(
                            e, 
                            ExceptionCode.ReferenceError, 
                            SdmxStructureType.GetFromEnum(SdmxStructureEnumType.Agency), 
                            currentBean.StructureType, 
                            currentBean.ToString());
                    }
                }
            }

            ISet<IMaintainableObject> loopSet = new HashSet<IMaintainableObject>();
            this._maintianables.AddAll(loopSet);

            /* foreach */
            foreach (IMaintainableObject currentMaintainable in loopSet)
            {
                this._log.Debug("Resolving References For : " + currentMaintainable.Urn);
                ISet<ICrossReference> crossReferences0 = currentMaintainable.CrossReferences;
                this._log.Debug("Number of References : " + crossReferences0.Count);
                int i = 0;

                /* foreach */
                foreach (ICrossReference crossReference in crossReferences0)
                {
                    i++;
                    if (this._log.IsDebugEnabled)
                    {
                        this._log.Debug(
                            "Resolving Reference " + i + ": " + crossReference + " - referenced from -"
                            + crossReference.ReferencedFrom.StructureType);
                    }

                    try
                    {
                        this.StoreRef(
                            crossReference.ReferencedFrom, this.ResolveCrossReference(crossReference, retrievalManager));
                    }
                    catch (ReferenceException e1)
                    {
                        HandleMissingReference(e1, populateMissingMap);
                    }
                }
            }

            return this._crossReferences;
        }
开发者ID:alcardac,项目名称:SDMXRI_WS_OF,代码行数:91,代码来源:CrossReferenceResolverEngineCore.cs

示例2: GetMissingAgencies

        /// <summary>
        /// For the included <paramref name="sdmxObjects"/>, returns a map of agency URN to maintainable Bean that references the agency
        /// </summary>
        /// <param name="sdmxObjects">
        /// The included <c>SDMX</c> objects
        /// </param>
        /// <param name="retrievalManager">
        /// The <see cref="ISdmxRetrievalManager"/>
        /// </param>
        /// <returns>
        /// The included <paramref name="sdmxObjects"/>, returns a map of agency URN to maintainable Bean that references the agency
        /// </returns>
        public virtual IDictionary<string, ISet<IMaintainableObject>> GetMissingAgencies(
            ISdmxObjects sdmxObjects, ISdmxRetrievalManager retrievalManager)
        {
            ISet<string> agencyIds = new HashSet<string>();

            /* foreach */
            var agencies = sdmxObjects.Agencies;
            foreach (IAgency acy in agencies)
            {
                agencyIds.Add(acy.FullId);
            }

            IDictionary<string, ISet<IMaintainableObject>> returnMap =
                new Dictionary<string, ISet<IMaintainableObject>>();

            /* foreach */
            var maintainableObjects = sdmxObjects.GetAllMaintinables();
            foreach (IMaintainableObject currentMaint in maintainableObjects)
            {
                string referencedAgencyId = currentMaint.AgencyId;
                if (!agencyIds.Contains(referencedAgencyId))
                {
                    if (retrievalManager != null)
                    {
                        try
                        {
                            IAgency acy0 = retrievalManager.GetAgency(referencedAgencyId);
                            if (acy0 != null)
                            {
                                agencyIds.Add(acy0.FullId);
                                continue;
                            }
                        }
                        catch (Exception th)
                        {
                            Console.Error.WriteLine(th.StackTrace);
                        }
                    }

                    ISet<IMaintainableObject> maintainables;
                    if (!returnMap.TryGetValue(referencedAgencyId, out maintainables))
                    {
                        maintainables = new HashSet<IMaintainableObject>();
                        returnMap.Add(referencedAgencyId, maintainables);
                    }

                    maintainables.Add(currentMaint);
                }
            }

            return returnMap;
        }
开发者ID:alcardac,项目名称:SDMXRI_WS_OF,代码行数:64,代码来源:CrossReferenceResolverEngineCore.cs


注:本文中的ISdmxObjects.GetAllMaintinables方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。