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


C# ISdmxObjects.GetAllMaintainables方法代码示例

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


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

示例1: WriteStructures

        public void WriteStructures(ISdmxObjects sdmxObjects)
        {
            foreach (var maintainableObject in sdmxObjects.GetAllMaintainables())
            {
                PrintMaintainable(maintainableObject);
            }

            Close();
        }
开发者ID:SDMXISTATFRAMEWORK,项目名称:ISTAT_ENHANCED_SDMXRI_WS,代码行数:9,代码来源:HtmlStructureWriterEngine.cs

示例2: Build

        /// <summary>
        /// Builds Mutable beans from a collection of beans
        /// </summary>
        /// <param name="buildFrom">
        /// beans to build from
        /// </param>
        /// <returns>
        /// Mutable bean copies
        /// </returns>
        /// <exception cref="BuilderException">
        /// - If anything goes wrong during the build process
        /// </exception>
        public virtual IMutableObjects Build(ISdmxObjects buildFrom)
        {
            IMutableObjects mutableBeans = new MutableObjectsImpl();

            /* foreach */
            foreach (IMaintainableObject currentMaintainable in buildFrom.GetAllMaintainables())
            {
                mutableBeans.AddIdentifiable(currentMaintainable.MutableInstance);
            }

            return mutableBeans;
        }
开发者ID:alcardac,项目名称:SDMXRI_WS_OF,代码行数:24,代码来源:MutableObjectsBuilder.cs

示例3: BuildSuccessResponse

        /// <summary>
        /// The build success response.
        /// </summary>
        /// <param name="beans">
        /// The beans.
        /// </param>
        /// <returns>
        /// The <see cref="RegistryInterface"/>.
        /// </returns>
        public RegistryInterface BuildSuccessResponse(ISdmxObjects beans)
        {
            var responseType = new RegistryInterface();
            RegistryInterfaceType regInterface = responseType.Content;
            regInterface.Header = this._headerXmlsBuilder.Build(beans.Header);
            var returnType = new SubmitStructureResponseType();
            regInterface.SubmitStructureResponse = returnType;


            this.ProcessMaintainables(returnType, beans.GetAllMaintainables());
            return responseType;
        }
开发者ID:SDMXISTATFRAMEWORK,项目名称:ISTAT_ENHANCED_SDMXRI_WS,代码行数:21,代码来源:SubmitStructureResponseBuilderV21.cs

示例4: BuildSuccessResponse

        /// <summary>
        /// Builds a success response along with the query results
        /// </summary>
        /// <param name="beans">
        /// - the beans that were successfully returned from the query
        /// </param>
        /// <param name="schemaVersion">
        /// - the version of the schema to output the response in
        /// </param>
        /// <param name="returnAsStructureMessage">
        /// returns a structure message if true, otherwise returns as a query structure response
        /// </param>
        /// <returns>
        /// The <see cref="XTypedElement"/>.
        /// </returns>
        public virtual XTypedElement BuildSuccessResponse(
            ISdmxObjects beans, SdmxSchemaEnumType schemaVersion, bool returnAsStructureMessage)
        {
            XTypedElement response = null;
            switch (schemaVersion)
            {
                case SdmxSchemaEnumType.VersionTwoPointOne:
                    if (beans.GetAllMaintainables().Count == 0)
                    {
                        response = this._errorResponseBuilder21.BuildErrorResponse(SdmxErrorCodeEnumType.NoResultsFound);
                    }

                    response = this._structV21Builder.Build(beans);
                    break;
                case SdmxSchemaEnumType.VersionTwo:
                    if (returnAsStructureMessage)
                    {
                        response = this._structv2Builder.Build(beans);
                    }

                    response = this._queryStructureResponseBuilderV2.BuildSuccessResponse(beans);
                    break;
                case SdmxSchemaEnumType.VersionOne:
                    response = this._structv1Builder.Build(beans);
                    break;
                default:
                    throw new SdmxNotImplementedException(ExceptionCode.Unsupported, schemaVersion);
            }
            base.WriteSchemaLocation(response, schemaVersion);
            return response;
        }
开发者ID:alcardac,项目名称:SDMXRI_WS_OF,代码行数:46,代码来源:QueryStructureResponseBuilder.cs

示例5: IncrementVersions

        /// <summary>
        /// Increments the versions of sdmx objects
        /// </summary>
        /// <param name="sdmxObjects">
        /// The sdmx objects.
        /// </param>
        public void IncrementVersions(ISdmxObjects sdmxObjects)
        {
            _log.Info("Update Versions of Structures if existing structures found");
            //Store a map of old versions vs the new version
            IDictionary<IStructureReference, IStructureReference> oldVsNew =
                new Dictionary<IStructureReference, IStructureReference>();
            IDictionary<IMaintainableObject, IMaintainableObject> oldMaintVsNew =
                new Dictionary<IMaintainableObject, IMaintainableObject>();
            ISet<IMaintainableObject> updatedMaintainables = new HashSet<IMaintainableObject>();
            ISet<IMaintainableObject> oldMaintainables = new HashSet<IMaintainableObject>();

            foreach (IMaintainableObject currentMaint in sdmxObjects.GetAllMaintainables())
            {
                _log.Debug("Auto Version - check latest version for maintainable: " + currentMaint);

                IMaintainableObject persistedMaintainable = this._structureVersionRetrievalManager.GetLatest(currentMaint);
                if (persistedMaintainable == null)
                {
                    persistedMaintainable = this._beanRetrievalManager.GetMaintainableObject(currentMaint.AsReference);
                }
                if (persistedMaintainable != null)
                {
                    if (VersionableUtil.IsHigherVersion(persistedMaintainable.Version, currentMaint.Version))
                    {
                        //Modify version of maintainable to be the same as persisted maintainable
                        IMaintainableMutableObject mutableInstance = currentMaint.MutableInstance;
                        mutableInstance.Version = persistedMaintainable.Version;

                        //Remove the Maintainable from the submission - as we've changed the versions
                        sdmxObjects.RemoveMaintainable(currentMaint);

                        //currentMaint = mutableInstance.ImmutableInstance;
                    }
                    if (persistedMaintainable.Version.Equals(currentMaint.Version))
                    {
                        _log.Debug("Latest version is '" + persistedMaintainable.Version + "' perform update checks");
                        if (!currentMaint.DeepEquals(persistedMaintainable, true))
                        {
                            ISet<IIdentifiableObject> allIdentifiables1 = currentMaint.IdentifiableComposites;
                            ISet<IIdentifiableObject> allIdentifiables2 = persistedMaintainable.IdentifiableComposites;

                            bool containsAll = allIdentifiables1.ContainsAll(allIdentifiables2)
                                               && allIdentifiables2.ContainsAll(allIdentifiables1);
                            if (_log.IsInfoEnabled)
                            {
                                string increment = containsAll ? "Minor" : "Major";
                                _log.Info("Perform " + increment + " Version Increment for structure:" + currentMaint.Urn);
                            }

                            //Increment the version number
                            IMaintainableObject newVersion = this.IncrmentVersion(
                                currentMaint, persistedMaintainable.Version, !containsAll);

                            //Remove the Maintainable from the submission
                            sdmxObjects.RemoveMaintainable(currentMaint);

                            //Store the newly updated maintainable in a container for further processing
                            updatedMaintainables.Add(newVersion);
                            oldMaintainables.Add(currentMaint);
                            //Store the old version number mappings to the new version number
                            oldMaintVsNew.Add(currentMaint, newVersion);
                            oldVsNew.Add(currentMaint.AsReference, newVersion.AsReference);

                            string oldVersionNumber = currentMaint.Version;
                            AddOldVsNewReferences(oldVersionNumber, newVersion, oldVsNew);
                        }
                    }
                }
            }

            //Create a set of parent sdmxObjects to not update (regardless of version)
            ISet<IMaintainableObject> filterSet = new HashSet<IMaintainableObject>(updatedMaintainables);
            filterSet.AddAll(sdmxObjects.GetAllMaintainables());

            //Get all the referencing structures to reversion them
            IEnumerable<IMaintainableObject> referencingStructures = this.RecurseUpTree(oldMaintainables, new HashSet<IMaintainableObject>(), filterSet);

            foreach (IMaintainableObject currentReferencingStructure in referencingStructures)
            {
                _log.Info("Perform Minor Version Increment on referencing structure:" + currentReferencingStructure);
                String newVersionNumber;
                if (oldMaintVsNew.ContainsKey(currentReferencingStructure))
                {
                    //The old maintainable is also in the submission and has had it's version number incremented, use this version
                    var tmp = oldMaintVsNew[currentReferencingStructure];
                    //currentReferencingStructure = oldMaintVsNew[currentReferencingStructure];
                    updatedMaintainables.Remove(tmp);
                    newVersionNumber = currentReferencingStructure.Version;
                }
                else
                {
                    newVersionNumber = VersionableUtil.IncrementVersion(currentReferencingStructure.Version, false);
                }
                IMaintainableObject updatedMaintainable =
//.........这里部分代码省略.........
开发者ID:alcardac,项目名称:SDMXRI_WS_OF,代码行数:101,代码来源:StructureVersionIncrementManager.cs

示例6: ValidateSupport

        /// <summary>
        /// Validates all the Maintainable Artefacts in the beans container are supported by the SDMX v1.0 syntax
        /// </summary>
        /// <param name="beans">
        /// The beans.
        /// </param>
        /// <exception cref="SdmxNotImplementedException">
        /// Structure not supported by SDMX-EDI
        /// </exception>
        private static void ValidateSupport(ISdmxObjects beans)
        {
            IList<SdmxStructureEnumType> supportedStructres = new List<SdmxStructureEnumType>();
            supportedStructres.Add(SdmxStructureEnumType.AgencyScheme);
            supportedStructres.Add(SdmxStructureEnumType.Dsd);
            supportedStructres.Add(SdmxStructureEnumType.ConceptScheme);
            supportedStructres.Add(SdmxStructureEnumType.CodeList);

            foreach (var maintainableBean in beans.GetAllMaintainables())
            {
                if (!supportedStructres.Contains(maintainableBean.StructureType.EnumType))
                {
                    throw new SdmxNotImplementedException(ExceptionCode.Unsupported, maintainableBean.StructureType.StructureType + " is not a supported by SDMX-EDI");
                }
            }
        }
开发者ID:SDMXISTATFRAMEWORK,项目名称:ISTAT_ENHANCED_SDMXRI_WS,代码行数:25,代码来源:EdiParseManager.cs

示例7: BuildSuccessResponse

        /// <summary>
        /// Build success response.
        /// </summary>
        /// <param name="buildFrom">
        /// The source sdmx objects.
        /// </param>
        /// <param name="warningMessage">
        /// The warning message.
        /// </param>
        /// <returns>
        /// The <see cref="RegistryInterface"/>.
        /// </returns>
        public RegistryInterface BuildSuccessResponse(ISdmxObjects buildFrom, string warningMessage)
        {

            // PLEASE NOTE. The code here is slightly different than in Java.
            // That is because of the differences between Java XmlBeans and .NET Linq2Xsd generated classes.
            // Please consult GIT log before making any changes.
            var responseType = new RegistryInterface();

            RegistryInterfaceType regInterface = responseType.Content;
            HeaderType headerType;

            if (buildFrom.Header != null)
            {
                headerType = this._headerXmlsBuilder.Build(buildFrom.Header);
                regInterface.Header = headerType;
            }
            else
            {
                headerType = new HeaderType();
                regInterface.Header = headerType;
                V2Helper.SetHeader(headerType, buildFrom);
            }
            
            var returnType = new QueryStructureResponseType();
            regInterface.QueryStructureResponse = returnType;

            var statusMessage = new StatusMessageType();
            returnType.StatusMessage = statusMessage;

            if (!string.IsNullOrWhiteSpace(warningMessage) || !ObjectUtil.ValidCollection(buildFrom.GetAllMaintainables()))
            {
                statusMessage.status = StatusTypeConstants.Warning;
                var tt = new TextType();
                statusMessage.MessageText.Add(tt);
                tt.TypedValue = !string.IsNullOrWhiteSpace(warningMessage)
                                    ? warningMessage
                                    : "No Structures Match The Query Parameters";
            }
            else
            {
                statusMessage.status = StatusTypeConstants.Success;
            }

            ISet<ICategorisationObject> categorisations = buildFrom.Categorisations;

            // GET CATEGORY SCHEMES
            if (buildFrom.CategorySchemes.Count > 0)
            {
                var catSchemesType = new CategorySchemesType();
                returnType.CategorySchemes = catSchemesType;

                /* foreach */
                foreach (ICategorySchemeObject cateogrySchemeBean in buildFrom.CategorySchemes)
                {
                    ISet<ICategorisationObject> matchingCategorisations = new HashSet<ICategorisationObject>();

                    /* foreach */
                    foreach (ICategorisationObject cat in categorisations)
                    {
                        if (MaintainableUtil<ICategorySchemeObject>.Match(cateogrySchemeBean, cat.CategoryReference))
                        {
                            matchingCategorisations.Add(cat);
                        }
                    }

                    catSchemesType.CategoryScheme.Add(
                        this._categorySchemeXmlBuilder.Build(cateogrySchemeBean, categorisations));
                }
            }

            // GET CODELISTS
            if (buildFrom.Codelists.Count > 0)
            {
                CodeListsType codeListsType = new CodeListsType();
                returnType.CodeLists = codeListsType;
                //CodeListsType codeListsType = returnType.CodeLists;

                /* foreach */
                foreach (ICodelistObject codelistBean in buildFrom.Codelists)
                {
                    codeListsType.CodeList.Add(this._codelistXmlBuilder.Build(codelistBean));
                }
            }

            // CONCEPT SCHEMES
            if (buildFrom.ConceptSchemes.Count > 0)
            {
                ConceptsType conceptsType =  new ConceptsType();
//.........这里部分代码省略.........
开发者ID:alcardac,项目名称:SDMXRI_WS_OF,代码行数:101,代码来源:QueryStructureResponseBuilderV2.cs

示例8: BuildSuccessResponse

        /// <summary>
        /// The build success response.
        /// </summary>
        /// <param name="beans">
        /// The beans.
        /// </param>
        /// <returns>
        /// The <see cref="RegistryInterface"/>.
        /// </returns>
        public RegistryInterface BuildSuccessResponse(ISdmxObjects beans)
        {
            var responseType = new RegistryInterface();
            RegistryInterfaceType regInterface = responseType.Content;

            HeaderType headerType;
            if (beans.Header != null)
            {
                headerType = this._headerXmlsBuilder.Build(beans.Header);
                regInterface.Header = headerType;
            }
            else
            {
                headerType = new HeaderType();
                regInterface.Header = headerType;
                V2Helper.SetHeader(headerType, beans);
            }

            var returnType = new SubmitStructureResponseType();
            regInterface.SubmitStructureResponse = returnType;
            ProcessMaintainables(returnType, beans.GetAllMaintainables());
            return responseType;
        }
开发者ID:alcardac,项目名称:SDMXRI_WS_OF,代码行数:32,代码来源:SubmitStructureResponseBuilderV2.cs

示例9: AddObjectsToMap

 /// <summary>
 /// Add the specified <paramref name="sdmxObjects"/> to map.
 /// </summary>
 /// <param name="sdmxObjects">
 /// The SDMX objects.
 /// </param>
 private void AddObjectsToMap(ISdmxObjects sdmxObjects)
 {
     foreach (IMaintainableObject maint in sdmxObjects.GetAllMaintainables())
     {
         this.AddMaintainableToMap(maint);
     }
 }
开发者ID:SDMXISTATFRAMEWORK,项目名称:ISTAT_ENHANCED_SDMXRI_WS,代码行数:13,代码来源:CrossReferenceResolverEngineCore.cs

示例10: ResolveReferencesInternal

        /// <summary>
        ///   The resolve references internal.
        /// </summary>
        /// <param name="sdmxObjects"> The sdmxObjects. </param>
        /// <param name="retrievalManager"> The retrieval manager. </param>
        /// <param name="populateMissingMap"> The populate missing map. </param>
        /// <returns> The <see cref="IIdentifiableObject" /> dictionary. </returns>
        /// <exception cref="CrossReferenceException">Reference error</exception>
        private IDictionaryOfSets<IIdentifiableObject, IIdentifiableObject> ResolveReferencesInternal(
            ISdmxObjects sdmxObjects,
            IIdentifiableRetrievalManager retrievalManager,
            IDictionary<IIdentifiableObject, ISet<ICrossReference>> populateMissingMap)
        {
            _log.Info("Resolve References, bean retrieval manager: " + retrievalManager);

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

            // Add all the top level sdmxObjects to the maintainables list
            this.AddObjectsToMap(sdmxObjects);

            // LOOP THROUGH ALL THE BEANS AND RESOLVE ALL THE REFERENCES
            if (this._resolveAgencies)
            {
                /* foreach */
                foreach (IMaintainableObject currentBean in sdmxObjects.GetAllMaintainables())
                {
                    try
                    {
                        this.ResolveAgency(currentBean, retrievalManager);
                    }
                    catch (CrossReferenceException e)
                    {
                        throw new SdmxReferenceException(e,
                            AgencyRef(currentBean.AgencyId));
                    }
                }
            }

            ISet<IMaintainableObject> loopSet = new HashSet<IMaintainableObject>();
            loopSet.AddAll(sdmxObjects.GetAllMaintainables());
            ISdmxObjectRetrievalManager retMan = new InMemoryRetrievalManager(sdmxObjects);

            /* foreach */
            foreach (IMaintainableObject currentMaintainable in loopSet)
            {
                this._log.Debug("Resolving References For : " + currentMaintainable.Urn);
                ISet<ICrossReference> crossReferences0;
                if (_maintainableCrossReferenceRetrieverEngine != null)
                {
                    crossReferences0 = _maintainableCrossReferenceRetrieverEngine.GetCrossReferences(retMan, currentMaintainable);
                }
                else
                {
                    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 (CrossReferenceException e)
                    {
                        if (populateMissingMap == null)
                        {
                            throw;
                        }
                        
                        HandleMissingReference(e, populateMissingMap);
                        //throw new ReferenceException(e, "Reference from structure '" + currentMaintainable.Urn + "' can not be resolved");
                    }
                }
            }

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

示例11: 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="ISdmxObjectRetrievalManager" /> </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,
                                    IIdentifiableRetrievalManager identifiableRetrievalManager)
        {
            ISet<string> agencyIds = new HashSet<string>();

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

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

            /* foreach */
            ISet<IMaintainableObject> maintainableObjects = sdmxObjects.GetAllMaintainables();
            foreach (IMaintainableObject currentMaint in maintainableObjects)
            {
                string referencedAgencyId = currentMaint.AgencyId;
                if (!agencyIds.Contains(referencedAgencyId))
                {
                    if (identifiableRetrievalManager != null)
                    {
                        try
                        {
                            IAgency acy0 = ResolveAgency(referencedAgencyId, identifiableRetrievalManager);
                            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:SDMXISTATFRAMEWORK,项目名称:ISTAT_ENHANCED_SDMXRI_WS,代码行数:58,代码来源:CrossReferenceResolverEngineCore.cs


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