Esempio n. 1
0
        /// <summary>
        /// Gets the query root element for SDMX V20.
        /// </summary>
        /// <param name="operation">
        /// The operation.
        /// </param>
        /// <returns>
        /// The query root element qualified name; otherwise <see cref="XmlQualifiedName.Empty"/>
        /// </returns>
        public static XmlQualifiedName GetQueryRootElementV20(this SoapOperation operation)
        {
            ElementNameTable element;

            switch (operation)
            {
            case SoapOperation.GetUtilityData:
            case SoapOperation.GetCompactData:
            case SoapOperation.GetCrossSectionalData:
            case SoapOperation.GetGenericData:
            case SoapOperation.GetGenericMetadata:
                element = ElementNameTable.QueryMessage;
                break;

            case SoapOperation.QueryStructure:
                element = ElementNameTable.RegistryInterface;
                break;

            case SoapOperation.SubmitStructure:     // Add case for submit structure
                element = ElementNameTable.RegistryInterface;
                break;

            default:
                return(XmlQualifiedName.Empty);
            }

            return(new XmlQualifiedName(NameTableCache.GetElementName(element), SdmxConstants.MessageNs20));
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the query root element for SDMX V21.
        /// </summary>
        /// <param name="operation">
        /// The operation.
        /// </param>
        /// <returns>
        /// The query root element qualified name; otherwise <see cref="XmlQualifiedName.Empty"/>
        /// </returns>
        public static XmlQualifiedName GetQueryRootElementV21(this SoapOperation operation)
        {
            ElementNameTable element;

            switch (operation)
            {
            case SoapOperation.GetGenericData:
                element = ElementNameTable.GenericDataQuery;
                break;

            case SoapOperation.GetGenericTimeSeriesData:
                element = ElementNameTable.GenericTimeSeriesDataQuery;
                break;

            case SoapOperation.GetStructureSpecificData:
                element = ElementNameTable.StructureSpecificDataQuery;
                break;

            case SoapOperation.GetStructureSpecificTimeSeriesData:
                element = ElementNameTable.StructureSpecificTimeSeriesDataQuery;
                break;

            case SoapOperation.GetGenericMetadata:
                element = ElementNameTable.GenericMetadataQuery;
                break;

            case SoapOperation.GetStructureSpecificMetadata:
                element = ElementNameTable.StructureSpecificMetadataQuery;
                break;

            case SoapOperation.GetStructures:
                element = ElementNameTable.StructuresQuery;
                break;

            case SoapOperation.GetDataflow:
                element = ElementNameTable.DataflowQuery;
                break;

            case SoapOperation.GetMetadataflow:
                element = ElementNameTable.MetadataflowQuery;
                break;

            case SoapOperation.GetDataStructure:
                element = ElementNameTable.DataStructureQuery;
                break;

            case SoapOperation.GetMetadataStructure:
                element = ElementNameTable.MetadataStructureQuery;
                break;

            case SoapOperation.GetCategoryScheme:
                element = ElementNameTable.CategorySchemeQuery;
                break;

            case SoapOperation.GetConceptScheme:
                element = ElementNameTable.ConceptSchemeQuery;
                break;

            case SoapOperation.GetCodelist:
                element = ElementNameTable.CodelistQuery;
                break;

            case SoapOperation.GetHierarchicalCodelist:
                element = ElementNameTable.HierarchicalCodelistQuery;
                break;

            case SoapOperation.GetOrganisationScheme:
                element = ElementNameTable.OrganisationSchemeQuery;
                break;

            case SoapOperation.GetReportingTaxonomy:
                element = ElementNameTable.ReportingTaxonomyQuery;
                break;

            case SoapOperation.GetStructureSet:
                element = ElementNameTable.StructureSetQuery;
                break;

            case SoapOperation.GetProcess:
                element = ElementNameTable.ProcessQuery;
                break;

            case SoapOperation.GetCategorisation:
                element = ElementNameTable.CategorisationQuery;
                break;

            case SoapOperation.GetProvisionAgreement:
                element = ElementNameTable.ProvisionAgreementQuery;
                break;

            case SoapOperation.GetConstraint:
                element = ElementNameTable.ConstraintQuery;
                break;

            case SoapOperation.GetDataSchema:
                element = ElementNameTable.DataSchemaQuery;
                break;

            case SoapOperation.GetMetadataSchema:
                element = ElementNameTable.MetadataSchemaQuery;
                break;

            case SoapOperation.SubmitStructure:
                element = ElementNameTable.SubmitStructureResponse;
                break;

            default:
                return(XmlQualifiedName.Empty);
            }

            return(new XmlQualifiedName(NameTableCache.GetElementName(element), SdmxConstants.MessageNs21));
        }
Esempio n. 3
0
        /// <summary>
        ///Create a Header
        /// </summary>
        private void InitialiseHeader()
        {
            try
            {
                IList <ITextTypeWrapper> name = new List <ITextTypeWrapper>();
                name.Add(new TextTypeWrapperImpl(FindHeaderSetting("lang"), FindHeaderSetting("name"), null));

                IList <ITextTypeWrapper> textTypeWrapperSender = new List <ITextTypeWrapper>();
                textTypeWrapperSender.Add(new TextTypeWrapperImpl(FindHeaderSetting("lang"), FindHeaderSetting("sendername"), null));

                IContactMutableObject senderContact = new ContactMutableObjectCore();
                senderContact.AddName(new TextTypeWrapperMutableCore(FindHeaderSetting("lang"), FindHeaderSetting("sendercontactname")));
                senderContact.AddDepartment(new TextTypeWrapperMutableCore(FindHeaderSetting("lang"), FindHeaderSetting("sendercontactdepartment")));
                senderContact.AddRole(new TextTypeWrapperMutableCore(FindHeaderSetting("lang"), FindHeaderSetting("sendercontactrole")));

                if (!string.IsNullOrEmpty(FindHeaderSetting("sendercontacttelephone")))
                {
                    senderContact.AddTelephone(FindHeaderSetting("sendercontacttelephone"));
                }

                if (!string.IsNullOrEmpty(FindHeaderSetting("sendercontactfax")))
                {
                    senderContact.AddFax(FindHeaderSetting("sendercontactfax"));
                }

                if (!string.IsNullOrEmpty(FindHeaderSetting("sendercontactx400")))
                {
                    senderContact.AddX400(FindHeaderSetting("sendercontactx400"));
                }

                if (!string.IsNullOrEmpty(FindHeaderSetting("sendercontacturi")))
                {
                    senderContact.AddUri(FindHeaderSetting("sendercontacturi"));
                }

                if (!string.IsNullOrEmpty(FindHeaderSetting("sendercontactemail")))
                {
                    senderContact.AddEmail(FindHeaderSetting("sendercontactemail"));
                }

                // SENDER
                IContact         contactImmutableSender = new ContactCore(senderContact);
                IList <IContact> contactsSender         = new List <IContact>();
                contactsSender.Add(contactImmutableSender);
                IParty sender = new PartyCore(textTypeWrapperSender, FindHeaderSetting("senderid"), contactsSender, null);

                IList <ITextTypeWrapper> textTypeWrapperReceiver = new List <ITextTypeWrapper>();
                textTypeWrapperReceiver.Add(new TextTypeWrapperImpl(FindHeaderSetting("lang"), FindHeaderSetting("receivername"), null));

                IContactMutableObject receiverContact = new ContactMutableObjectCore();

                receiverContact.AddName(new TextTypeWrapperMutableCore(FindHeaderSetting("lang"), FindHeaderSetting("receivercontactname")));
                receiverContact.AddDepartment(new TextTypeWrapperMutableCore(FindHeaderSetting("lang"), FindHeaderSetting("receivercontactdepartment")));
                receiverContact.AddRole(new TextTypeWrapperMutableCore(FindHeaderSetting("lang"), FindHeaderSetting("receivercontactrole")));

                if (!string.IsNullOrEmpty(FindHeaderSetting("receivercontacttelephone")))
                {
                    receiverContact.AddTelephone(FindHeaderSetting("receivercontacttelephone"));
                }

                if (!string.IsNullOrEmpty(FindHeaderSetting("receivercontactfax")))
                {
                    receiverContact.AddFax(FindHeaderSetting("receivercontactfax"));
                }

                if (!string.IsNullOrEmpty(FindHeaderSetting("receivercontactx400")))
                {
                    receiverContact.AddX400(FindHeaderSetting("receivercontactx400"));
                }

                if (!string.IsNullOrEmpty(FindHeaderSetting("receivercontacturi")))
                {
                    receiverContact.AddUri(FindHeaderSetting("receivercontacturi"));
                }

                if (!string.IsNullOrEmpty(FindHeaderSetting("receivercontactemail")))
                {
                    receiverContact.AddEmail(FindHeaderSetting("receivercontactemail"));
                }

                // RECEIVER
                IContact         contactImmutableReceiver = new ContactCore(receiverContact);
                IList <IContact> contactsReceiver         = new List <IContact>();
                contactsReceiver.Add(contactImmutableReceiver);
                IParty         receiver     = new PartyCore(textTypeWrapperReceiver, FindHeaderSetting("receiverid"), contactsReceiver, null);
                IList <IParty> receiverList = new List <IParty>();
                receiverList.Add(receiver);

                IDictionary <string, string> additionalAttributes = new Dictionary <string, string>();
                additionalAttributes.Add(NameTableCache.GetElementName(ElementNameTable.KeyFamilyRef), FindHeaderSetting("keyfamilyref"));
                additionalAttributes.Add(NameTableCache.GetElementName(ElementNameTable.KeyFamilyAgency), FindHeaderSetting("keyfamilyagency"));
                additionalAttributes.Add(NameTableCache.GetElementName(ElementNameTable.DataSetAgency), FindHeaderSetting("datasetagency"));

                DateTime extracted, prepared, reportingBegin, reportingEnd;
                bool     isValid = DateTime.TryParse(FindHeaderSetting("extracted"), out extracted);
                if (!isValid)
                {
                    extracted = DateTime.Now;
                }

                isValid = DateTime.TryParse(FindHeaderSetting("reportingbegin"), out reportingBegin);
                if (!isValid)
                {
                    reportingBegin = DateTime.Now;
                }

                isValid = DateTime.TryParse(FindHeaderSetting("reportingend"), out reportingEnd);
                if (!isValid)
                {
                    reportingEnd = DateTime.Now;
                }

                isValid = DateTime.TryParse(FindHeaderSetting("prepared"), out prepared);
                if (!isValid)
                {
                    prepared = DateTime.Now;
                }

                IList <ITextTypeWrapper> source = new List <ITextTypeWrapper>();
                if (!string.IsNullOrEmpty(FindHeaderSetting("source")))
                {
                    source.Add(new TextTypeWrapperImpl(FindHeaderSetting("lang"), FindHeaderSetting("source"), null));
                }

                this._header = new HeaderImpl(
                    additionalAttributes,
                    null,
                    null,
                    DatasetAction.GetAction(FindHeaderSetting("datasetaction")),
                    FindHeaderSetting("id"),
                    FindHeaderSetting("datasetid"),
                    null,
                    extracted,
                    prepared,
                    reportingBegin,
                    reportingEnd,
                    name,
                    source,
                    receiverList,
                    sender,
                    bool.Parse(FindHeaderSetting("test")));
            }
            catch (SdmxException) { throw; }
            catch (Exception ex)
            {
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.CreateHeader, ex);
            }
        }
Esempio n. 4
0
        /// <summary>
        ///     This method initializes the log file name.
        ///     The value for this property is configured in the web.config file in the "appSettings" section
        ///     under the "logFileName" key.
        /// </summary>
        private void InitialiseHeader()
        {
            IList <ITextTypeWrapper> name = new List <ITextTypeWrapper>();

            name.Add(new TextTypeWrapperImpl(HeaderSettings.Default.lang, HeaderSettings.Default.name, null));

            IList <ITextTypeWrapper> textTypeWrapperSender = new List <ITextTypeWrapper>();

            textTypeWrapperSender.Add(new TextTypeWrapperImpl(HeaderSettings.Default.lang, HeaderSettings.Default.sendername, null));

            IContactMutableObject senderContact = new ContactMutableObjectCore();

            senderContact.AddName(new TextTypeWrapperMutableCore(HeaderSettings.Default.lang, HeaderSettings.Default.sendercontactname));
            senderContact.AddDepartment(new TextTypeWrapperMutableCore(HeaderSettings.Default.lang, HeaderSettings.Default.sendercontactdepartment));
            senderContact.AddRole(new TextTypeWrapperMutableCore(HeaderSettings.Default.lang, HeaderSettings.Default.sendercontactrole));

            if (!string.IsNullOrEmpty(HeaderSettings.Default.sendercontacttelephone))
            {
                senderContact.AddTelephone(HeaderSettings.Default.sendercontacttelephone);
            }

            if (!string.IsNullOrEmpty(HeaderSettings.Default.sendercontactfax))
            {
                senderContact.AddFax(HeaderSettings.Default.sendercontactfax);
            }

            if (!string.IsNullOrEmpty(HeaderSettings.Default.sendercontactx400))
            {
                senderContact.AddX400(HeaderSettings.Default.sendercontactx400);
            }

            if (!string.IsNullOrEmpty(HeaderSettings.Default.sendercontacturi))
            {
                senderContact.AddUri(HeaderSettings.Default.sendercontacturi);
            }

            if (!string.IsNullOrEmpty(HeaderSettings.Default.sendercontactemail))
            {
                senderContact.AddEmail(HeaderSettings.Default.sendercontactemail);
            }

            // SENDER
            IContact         contactImmutableSender = new ContactCore(senderContact);
            IList <IContact> contactsSender         = new List <IContact>();

            contactsSender.Add(contactImmutableSender);
            IParty sender = new PartyCore(textTypeWrapperSender, HeaderSettings.Default.senderid, contactsSender, null);

            IList <ITextTypeWrapper> textTypeWrapperReceiver = new List <ITextTypeWrapper>();

            textTypeWrapperReceiver.Add(new TextTypeWrapperImpl(HeaderSettings.Default.lang, HeaderSettings.Default.receivername, null));

            IContactMutableObject receiverContact = new ContactMutableObjectCore();

            receiverContact.AddName(new TextTypeWrapperMutableCore(HeaderSettings.Default.lang, HeaderSettings.Default.receivercontactname));
            receiverContact.AddDepartment(new TextTypeWrapperMutableCore(HeaderSettings.Default.lang, HeaderSettings.Default.receivercontactdepartment));
            receiverContact.AddRole(new TextTypeWrapperMutableCore(HeaderSettings.Default.lang, HeaderSettings.Default.receivercontactrole));

            if (!string.IsNullOrEmpty(HeaderSettings.Default.receivercontacttelephone))
            {
                receiverContact.AddTelephone(HeaderSettings.Default.receivercontacttelephone);
            }

            if (!string.IsNullOrEmpty(HeaderSettings.Default.receivercontactfax))
            {
                receiverContact.AddFax(HeaderSettings.Default.receivercontactfax);
            }

            if (!string.IsNullOrEmpty(HeaderSettings.Default.receivercontactx400))
            {
                receiverContact.AddX400(HeaderSettings.Default.receivercontactx400);
            }

            if (!string.IsNullOrEmpty(HeaderSettings.Default.receivercontacturi))
            {
                receiverContact.AddUri(HeaderSettings.Default.receivercontacturi);
            }

            if (!string.IsNullOrEmpty(HeaderSettings.Default.receivercontactemail))
            {
                receiverContact.AddEmail(HeaderSettings.Default.receivercontactemail);
            }

            // RECEIVER
            IContact         contactImmutableReceiver = new ContactCore(receiverContact);
            IList <IContact> contactsReceiver         = new List <IContact>();

            contactsReceiver.Add(contactImmutableReceiver);
            IParty         receiver     = new PartyCore(textTypeWrapperReceiver, HeaderSettings.Default.receiverid, contactsReceiver, null);
            IList <IParty> receiverList = new List <IParty>();

            receiverList.Add(receiver);

            IDictionary <string, string> additionalAttributes = new Dictionary <string, string>();

            additionalAttributes.Add(NameTableCache.GetElementName(ElementNameTable.KeyFamilyRef), HeaderSettings.Default.keyfamilyref);
            additionalAttributes.Add(NameTableCache.GetElementName(ElementNameTable.KeyFamilyAgency), HeaderSettings.Default.keyfamilyagency);
            additionalAttributes.Add(NameTableCache.GetElementName(ElementNameTable.DataSetAgency), HeaderSettings.Default.datasetagency);

            DateTime extracted, prepared, reportingBegin, reportingEnd;
            bool     isValid = DateTime.TryParse(HeaderSettings.Default.extracted, out extracted);

            if (!isValid)
            {
                extracted = DateTime.Now;
            }

            isValid = DateTime.TryParse(HeaderSettings.Default.reportingbegin, out reportingBegin);
            if (!isValid)
            {
                reportingBegin = DateTime.Now;
            }

            isValid = DateTime.TryParse(HeaderSettings.Default.reportingend, out reportingEnd);
            if (!isValid)
            {
                reportingEnd = DateTime.Now;
            }

            isValid = DateTime.TryParse(HeaderSettings.Default.prepared, out prepared);
            if (!isValid)
            {
                prepared = DateTime.Now;
            }

            IList <ITextTypeWrapper> source = new List <ITextTypeWrapper>();

            if (!string.IsNullOrEmpty(HeaderSettings.Default.source))
            {
                source.Add(new TextTypeWrapperImpl(HeaderSettings.Default.lang, HeaderSettings.Default.source, null));
            }

            this._header = new HeaderImpl(
                additionalAttributes,
                null,
                null,
                DatasetAction.GetAction(HeaderSettings.Default.datasetaction),
                HeaderSettings.Default.id,
                HeaderSettings.Default.datasetid,
                null,
                extracted,
                prepared,
                reportingBegin,
                reportingEnd,
                name,
                source,
                receiverList,
                sender,
                bool.Parse(HeaderSettings.Default.test));
        }