コード例 #1
0
        /// <summary>
        /// Build the XSD generated class objects from the specified <paramref name="beans"/>
        /// </summary>
        /// <param name="beans">
        /// The beans.
        /// </param>
        /// <returns>
        /// the XSD generated class objects from the specified <paramref name="beans"/>
        /// </returns>
        protected internal override XTypedElement Build(ISdmxObjects beans)
        {
            bool hasStructures = beans.HasStructures();
            bool hasRegistrations = beans.HasRegistrations();
            bool hasSubscriptions = beans.HasSubscriptions();
            if (hasStructures && hasRegistrations)
            {
                throw new ArgumentException(
                    "Container sent to be written contains both structures and registrations, this can not be written out to a single SDMX Message");
            }

            if (hasStructures && hasRegistrations)
            {
                throw new ArgumentException(
                    "Container sent to be written contains both structures and subscriptions, this can not be written out to a single SDMX Message");
            }

            if (hasSubscriptions && hasStructures)
            {
                throw new ArgumentException(
                    "Container sent to be written contains both structures and subscriptions, this can not be written out to a single SDMX Message");
            }

            if (hasSubscriptions && hasRegistrations)
            {
                throw new ArgumentException(
                    "Container sent to be written contains both registrations and subscriptions, this can not be written out to a single SDMX Message");
            }

            if (hasRegistrations)
            {
                return this._registrationXmlBuilderBean.BuildRegistryInterfaceDocument(
                    beans.Registrations, DatasetActionEnumType.Append);
            }

            if (hasSubscriptions)
            {
                return this._submitSubscriptionBuilder.BuildRegistryInterfaceDocument(
                    beans.Subscriptions, DatasetActionEnumType.Append);
            }

            return this._structureXmlBuilderBean.Build(beans);
        }