Exemplo n.º 1
0
        /// <summary>
        /// Builds the query structure for REST for the specified <paramref name="schema"/>.
        /// </summary>
        /// <param name="schema">
        /// The SDMX schema version.
        /// </param>
        /// <param name="principal">
        /// The principal.
        /// </param>
        /// <returns>
        /// The <see cref="IController{IRestStructureQuery,XmlWriter}"/>.
        /// </returns>
        public IController <IRestStructureQuery, XmlWriter> BuildQueryStructureRest(SdmxSchema schema, DataflowPrincipal principal)
        {
            IWriterBuilder <IStructureWriterManager, XmlWriter> structureManagerBuilder = new StructureBuilder(WebServiceEndpoint.StandardEndpoint, schema);
            StructureOutputFormatEnumType outputFormat;

            IAuthMutableStructureSearchManager authMutableStructureSearchManager;
            IMutableStructureSearchManager     mutableStructureSearchManager;

            switch (schema.EnumType)
            {
            case SdmxSchemaEnumType.VersionTwo:
                authMutableStructureSearchManager = this._authMutableStructureSearchManagerV20;
                mutableStructureSearchManager     = this._mutableStructureSearchManagerV20;
                outputFormat = StructureOutputFormatEnumType.SdmxV2StructureDocument;

                break;

            default:
                authMutableStructureSearchManager = this._authMutableStructureSearchManagerV21;
                mutableStructureSearchManager     = this._mutableStructureSearchManagerV21;
                outputFormat = StructureOutputFormatEnumType.SdmxV21StructureDocument;

                break;
            }

            IResponseGenerator <XmlWriter, ISdmxObjects> responseGenerator = new StructureResponseGenerator(structureManagerBuilder, outputFormat);
            var structureRequestController = new StructureRequestRestController <XmlWriter>(responseGenerator, mutableStructureSearchManager, authMutableStructureSearchManager, principal);

            return(structureRequestController);
        }
        /// <summary>
        /// Builds the query structure for REST for the specified <paramref name="schema"/>.
        /// </summary>
        /// <param name="schema">
        /// The SDMX schema version.
        /// </param>
        /// <param name="principal">
        /// The principal.
        /// </param>
        /// <returns>
        /// The <see cref="IController{IRestStructureQuery,XmlWriter}"/>.
        /// </returns>
        public IController<IRestStructureQuery, XmlWriter> BuildQueryStructureRest(SdmxSchema schema, DataflowPrincipal principal)
        {
            IWriterBuilder<IStructureWriterManager, XmlWriter> structureManagerBuilder = new StructureBuilder(WebServiceEndpoint.StandardEndpoint, schema);
            StructureOutputFormatEnumType outputFormat;

            IAuthMutableStructureSearchManager authMutableStructureSearchManager;
            IMutableStructureSearchManager mutableStructureSearchManager;
            switch (schema.EnumType)
            {
                case SdmxSchemaEnumType.VersionTwo:
                    authMutableStructureSearchManager = this._authMutableStructureSearchManagerV20;
                    mutableStructureSearchManager = this._mutableStructureSearchManagerV20;
                    outputFormat = StructureOutputFormatEnumType.SdmxV2StructureDocument;

                    break;
                default:
                    authMutableStructureSearchManager = this._authMutableStructureSearchManagerV21;
                    mutableStructureSearchManager = this._mutableStructureSearchManagerV21;
                    outputFormat = StructureOutputFormatEnumType.SdmxV21StructureDocument;

                    break;
            }

            IResponseGenerator<XmlWriter, ISdmxObjects> responseGenerator = new StructureResponseGenerator(structureManagerBuilder, outputFormat);
            var structureRequestController = new StructureRequestRestController<XmlWriter>(responseGenerator, mutableStructureSearchManager, authMutableStructureSearchManager, principal);
            return structureRequestController;
        }