public void Update(GameTime gameTime)
        {
            switch (Direction)
            {
            case VisualizerDirection.FORWARD:
                if (SortActionIndex < SortActions.Length)
                {
                    CurrentSortAction = SortActions[SortActionIndex];
                    Data.PerformAction(SortActions[SortActionIndex++]);
                }
                else
                {
                    CurrentSortAction = null;
                }
                break;

            case VisualizerDirection.BACKWARD:
                if (SortActionIndex > 0)
                {
                    Data.PerformAction(SortActions[--SortActionIndex]);
                    CurrentSortAction = SortActions[SortActionIndex];
                }
                else
                {
                    CurrentSortAction = null;
                }
                break;
            }
        }
        /// <summary>
        /// The build registry interface document.
        /// </summary>
        /// <param name="buildFrom">
        /// The build from.
        /// </param>
        /// <param name="action">
        /// The action.
        /// </param>
        /// <returns>
        /// The <see cref="RegistryInterface"/>.
        /// </returns>
        public RegistryInterface BuildRegistryInterfaceDocument(ISdmxObjects buildFrom, DatasetAction action)
        {
            var rid = new RegistryInterface();
            RegistryInterfaceType rit = rid.Content;
            V21Helper.Header = rit;
            var structureRequestType = new SubmitStructureRequestType();
            rit.SubmitStructureRequest = structureRequestType;
            switch (action.EnumType)
            {
                case DatasetActionEnumType.Append:
                    structureRequestType.action = ActionTypeConstants.Append;
                    break;
                case DatasetActionEnumType.Replace:
                    structureRequestType.action = ActionTypeConstants.Replace;
                    break;
                case DatasetActionEnumType.Delete:
                    structureRequestType.action = ActionTypeConstants.Delete;
                    break;
                case DatasetActionEnumType.Information:
                    structureRequestType.action = ActionTypeConstants.Information;
                    break;
            }

            var structures = new Structures();
            structureRequestType.Structures = structures;
            this._structureXmlBuilder.PopulateStructureType(buildFrom, structures.Content);

            return rid;
        }
Example #3
0
        /// <summary>
        /// Call CreateDSD and Write SdmxObject in XElement Streaming to return with processed metadata result
        /// </summary>
        /// <returns>Object for Write response in streaming <see cref="IFlyWriterBody"/></returns>
        public virtual IFlyWriterBody WriteDSD()
        {
            try
            {
                ISdmxObjects sdmxObject = CreateDSD();
                sdmxObject.Action = DatasetAction.GetFromEnum(DatasetActionEnumType.Append);

                //Oggetto che crea l'output
                StructureWriterManager swm = new StructureWriterManager();

                StructureOutputFormat sofType = null;
                if (VersionTypeResp == SdmxSchemaEnumType.VersionTwo)
                {
                    sofType = StructureOutputFormat.GetFromEnum(StructureOutputFormatEnumType.SdmxV2RegistryQueryResponseDocument);
                }
                else if (VersionTypeResp == SdmxSchemaEnumType.VersionTwoPointOne)
                {
                    sofType = StructureOutputFormat.GetFromEnum(StructureOutputFormatEnumType.SdmxV21StructureDocument);
                }
                else
                {
                    throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.UnrecognizedVersion, new Exception("Version: " + VersionTypeResp.ToString()));
                }
                SdmxStructureFormat sof = new SdmxStructureFormat(sofType);

                //IStructureFormat

                //Dove metto il risultato Stream
                IFlyWriterBody WriterBody = new FlyMetadataWriterBody()
                {
                    StructureFormat = sof,
                    SdmxObject      = sdmxObject
                };
                FlyLog.WriteLog(this, FlyLog.LogTypeEnum.All, "Create Callback for Writing SDMXObject");
                return(WriterBody);
                //MemoryStream ms = new MemoryStream();
                //swm.WriteStructures(sdmxObject, sof, ms);
                //ms.Position = 0;
                //StreamReader rdr = new System.IO.StreamReader(ms);
                //ms.Position = 0;
                //string DSDris = rdr.ReadToEnd();
                //return XElement.Parse(DSDris);
            }
            catch (SdmxException) { throw; }
            catch (Exception ex)
            {
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.CreateSdmxObjectError, ex);
            }
        }
Example #4
0
        public void PerformAction(DatasetAction action)
        {
            switch (action.Item1)
            {
            case DatasetActionType.ACCESS:
                AccessItem(action.Item2);
                break;

            case DatasetActionType.COMPARE:
                IsEqualTo(action.Item2, action.Item3);
                break;

            case DatasetActionType.SWAP:
                SwapItems(action.Item2, action.Item3);
                break;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DatasetHeaderCore"/> class. 
        ///   Create an instance from a parser reading the dataset XML Node and the header
        /// </summary>
        /// <param name="parser">XML reader instance.
        /// </param>
        /// <param name="datasetHeader">Header object.
        /// </param>
        public DatasetHeaderCore(XmlReader parser, IHeader datasetHeader)
        {
            this._action = DatasetAction.GetFromEnum(DatasetActionEnumType.Information);
            this._publicationYear = -1;
            if (parser.GetAttribute("structureRef") != null)
            {
                string structureRef = parser.GetAttribute("structureRef");
                this._datasetStructureReference = GetStructureFromHeader(datasetHeader, structureRef);
                if (this._datasetStructureReference == null)
                {
                    throw new SdmxSemmanticException(
                        "Dataset references CategorisationStructure that is not defined in the Header of the message.  CategorisationStructure reference defined by Dataset is:"
                        + structureRef);
                }
            }
            else
            {
                this._datasetStructureReference = GenerateOrUseDefaultStructure(parser, datasetHeader);
            }

            if (parser.GetAttribute("action") != null)
            {
                this._action = DatasetAction.GetAction(parser.GetAttribute("action"));
            }
            else if (datasetHeader.Action != null)
            {
                this._action = datasetHeader.Action;
            }

            // if(parser.getAttributeValue(null, "dataProviderID") != null) {
            // datasetAttributes.setDataProviderId(parser.getAttributeValue(null, "dataProviderID"));
            // }
            // if(parser.getAttributeValue(null, "dataProviderSchemeAgencyId") != null) {
            // datasetAttributes.setDataProviderSchemeAgencyId(parser.getAttributeValue(null, "dataProviderSchemeAgencyId"));
            // }
            // if(parser.getAttributeValue(null, "dataProviderSchemeId") != null) {
            // datasetAttributes.setDataProviderSchemeId(parser.getAttributeValue(null, "dataProviderSchemeId"));
            // }
            // TODO use switch & parser.MoveToNextAttribute()
            if (parser.GetAttribute("datasetID") != null)
            {
                this._datasetId = parser.GetAttribute("datasetID");
            }

            if (parser.GetAttribute("publicationPeriod") != null)
            {
                this._publicationPeriod = parser.GetAttribute("publicationPeriod");
            }

            if (parser.GetAttribute("publicationYear") != null)
            {
                this._publicationYear = int.Parse(parser.GetAttribute("publicationYear"));
            }

            if (parser.GetAttribute("reportingBeginDate") != null)
            {
                this._reportingBeginDate = DateUtil.FormatDate(parser.GetAttribute("reportingBeginDate"), true);
            }

            if (parser.GetAttribute("reportingEndDate") != null)
            {
                this._reportingEndDate = DateUtil.FormatDate(parser.GetAttribute("reportingEndDate"), true);
            }

            if (parser.GetAttribute("validFromDate") != null)
            {
                this._validFrom = DateUtil.FormatDate(parser.GetAttribute("validFromDate"), true);
            }

            if (parser.GetAttribute("validToDate") != null)
            {
                this._validTo = DateUtil.FormatDate(parser.GetAttribute("validToDate"), true);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="DatasetHeaderCore"/> class.
 /// </summary>
 /// <param name="datasetId">
 /// The dataset id. 
 /// </param>
 /// <param name="action">
 /// The action. 
 /// </param>
 /// <param name="datasetStructureReference">
 /// The dataset structure reference agencySchemeMutable. 
 /// </param>
 /// <param name="dataProviderRef">
 /// The data provider ref. 
 /// </param>
 /// <param name="reportingBeginDate">
 /// The reporting begin date. 
 /// </param>
 /// <param name="reportingEndDate">
 /// The reporting end date. 
 /// </param>
 /// <param name="validFrom">
 /// The valid from. 
 /// </param>
 /// <param name="validTo">
 /// The valid to. 
 /// </param>
 /// <param name="publicationYear">
 /// The publication year. 
 /// </param>
 /// <param name="publicationPeriod">
 /// The publication period. 
 /// </param>
 /// <param name="reportingYearStartDate">
 /// The reporting year start date. 
 /// </param>
 public DatasetHeaderCore(
     string datasetId,
     DatasetAction action,
     IDatasetStructureReference datasetStructureReference,
     IMaintainableRefObject dataProviderRef,
     DateTime reportingBeginDate,
     DateTime reportingEndDate,
     DateTime validFrom,
     DateTime validTo,
     int publicationYear,
     string publicationPeriod,
     string reportingYearStartDate)
 {
     this._action = DatasetAction.GetFromEnum(DatasetActionEnumType.Information);
     this._publicationYear = -1;
     this._dataProviderRef = dataProviderRef;
     this._datasetStructureReference = datasetStructureReference;
     this._datasetId = datasetId;
     this._reportingBeginDate = reportingBeginDate;
     this._reportingEndDate = reportingEndDate;
     this._validFrom = validFrom;
     this._validTo = validTo;
     this._action = action;
     this._publicationYear = publicationYear;
     this._publicationPeriod = publicationPeriod;
     this.reportingYearStartDate = reportingYearStartDate;
 }
        private string reportingYearStartDate; // TODO WE NEED A MONTH DAY TYPE

        #endregion

        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="DatasetHeaderCore"/> class. 
        ///   Minimal Constructor
        /// </summary>
        /// <param name="datasetId">Dataset id
        /// </param>
        /// <param name="action">Dataset action
        /// </param>
        /// <param name="datasetStructureReference">DatasetStructureReference object
        /// </param>
        public DatasetHeaderCore(
            string datasetId, DatasetAction action, IDatasetStructureReference datasetStructureReference)
        {
            this._action = DatasetAction.GetFromEnum(DatasetActionEnumType.Information);
            this._publicationYear = -1;
            this._datasetId = datasetId;
            if (action != null)
            {
                this._action = action;
            }

            this._datasetStructureReference = datasetStructureReference;
        }
Example #8
0
        /// <summary>
        /// This method queries the mapping store for header information for a specific dataflow
        /// </summary>
        /// <param name="beginDate">For ReportingBegin element</param>
        /// <param name="endDate">For ReportingEnd element</param>
        /// <param name="dataflowReference">The dataflow reference.</param>
        /// <returns>
        /// A <see cref="IHeader" /> object. Otherwise null
        /// </returns>
        private IHeader GetHeader(DateTime?beginDate, DateTime?endDate, IMaintainableRefObject dataflowReference)
        {
            long   headerSysId;
            string paramId  = this._mappingStoreDb.BuildParameterName(ParameterNameConstants.IdParameter);
            string version1 = this._mappingStoreDb.BuildParameterName(ParameterNameConstants.VersionParameter1);
            string version2 = this._mappingStoreDb.BuildParameterName(ParameterNameConstants.VersionParameter2);
            string version3 = this._mappingStoreDb.BuildParameterName(ParameterNameConstants.VersionParameter3);
            string agency   = this._mappingStoreDb.BuildParameterName(ParameterNameConstants.AgencyParameter);

            var sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT HD.HEADER_ID, HD.TEST, HD.DATASET_AGENCY, HD.DF_ID ");
            sqlCommand.Append("FROM HEADER HD, DATAFLOW DF, ARTEFACT ART ");
            sqlCommand.Append("WHERE HD.DF_ID = DF.DF_ID ");
            sqlCommand.Append("AND DF.DF_ID = ART.ART_ID ");
            sqlCommand.AppendFormat("AND ART.ID = {0} ", paramId);
            sqlCommand.AppendFormat("AND dbo.isEqualVersion(ART.VERSION1,ART.VERSION2,ART.VERSION3,{0},{1},{2})=1 ", version1, version2, version3);
            sqlCommand.AppendFormat("AND ART.AGENCY = {0} ", agency);

            IDictionary <string, string> additionalAttributes = new Dictionary <string, string>(StringComparer.Ordinal);
            bool     test;
            DateTime currentDate    = DateTime.Now;
            var      dataflowId     = dataflowReference.MaintainableId;
            var      dataflowAgency = dataflowReference.AgencyId;
            var      version        = dataflowReference.SplitVersion(3);

            using (DbCommand command = this._mappingStoreDb.GetSqlStringCommand(sqlCommand.ToString()))
            {
                this._mappingStoreDb.AddInParameter(command, ParameterNameConstants.IdParameter, DbType.String, dataflowId);
                this._mappingStoreDb.AddInParameter(command, ParameterNameConstants.VersionParameter1, DbType.Int64, version[0].HasValue ? version[0].Value : 0);
                this._mappingStoreDb.AddInParameter(command, ParameterNameConstants.VersionParameter2, DbType.Int64, version[1].HasValue ? version[1].Value : 0);
                this._mappingStoreDb.AddInParameter(command, ParameterNameConstants.VersionParameter3, DbType.Int64, version[2].HasValue ? (object)version[2].Value : null);
                this._mappingStoreDb.AddInParameter(command, ParameterNameConstants.AgencyParameter, DbType.String, dataflowAgency);

                using (IDataReader dataReader = this._mappingStoreDb.ExecuteReader(command))
                {
                    // we expect only 1 record here
                    if (dataReader.Read())
                    {
                        headerSysId = DataReaderHelper.GetInt64(dataReader, "HEADER_ID");
                        test        = DataReaderHelper.GetBoolean(dataReader, "TEST");
                        additionalAttributes.Add("DataSetAgency", DataReaderHelper.GetString(dataReader, "DATASET_AGENCY"));
                        _log.DebugFormat(CultureInfo.InvariantCulture, "Found header information in mapping store for Dataflow {0}", dataflowId);
                    }
                    else
                    {
                        _log.DebugFormat(CultureInfo.InvariantCulture, "No header information found in mapping store for Dataflow {0}", dataflowId);
                        return(null);
                    }
                }
            }

            string datasetId = BuildDatasetId(dataflowId, currentDate);

            // DatasetAction: Information (case that is response to a query)
            DatasetAction datasetAction = DatasetAction.GetAction("Information");

            IHeader ret = new HeaderImpl(additionalAttributes, null, null, datasetAction, dataflowId, datasetId, null, currentDate, currentDate, beginDate, endDate, null, null, null, null, test);

            PopulateHeaderLocalisedStrings(this._mappingStoreDb, headerSysId, ret);
            PoulateHeaderSendersAndReceivers(this._mappingStoreDb, headerSysId, ret);
            if (ret.Sender != null)
            {
                DateTime extracted = ret.Extracted.HasValue ? ret.Extracted.Value : currentDate;

                ret.DatasetId = BuildDatasetId(ret.Id, extracted, ret.Sender.Id);
            }

            return(ret);
        }
Example #9
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);
            }
        }
Example #10
0
            /// <summary>
            ///     Determines the dataset metadata, such as the missing value valueOfString, in the Edi message
            /// </summary>
            private void DetermineDatasetMetadata()
            {
                this.ReadNextLine();
                EDIUtil.AssertPrefix(this._ediReader, EdiPrefix.DataStart, true);
                this._datasetId = this._ediReader.CurrentLine;

                this.AssertMoveNext();
                EDIUtil.AssertPrefix(this._ediReader, EdiPrefix.DatasetAction, true);
                if (this._ediReader.CurrentLine.Equals("6"))
                {
                    this._datasetAction = DatasetActionEnumType.Delete;
                }
                else if (this._ediReader.CurrentLine.Equals("7"))
                {
                    this._datasetAction = DatasetActionEnumType.Replace;
                }
                else
                {
                    throw new SdmxSyntaxException("Unknown Edi-Ts Dataset Action value : " + this._ediReader.CurrentLine);
                }

                this.AssertMoveNext();

                // Sort out the dates
                this._reportingBegin = default(DateTime);
                this._reportingEnd = default(DateTime);

                EDIUtil.AssertPrefix(this._ediReader, EdiPrefix.DatasetDatetime, true);
                string currentLine = this._ediReader.CurrentLine;
                if (!currentLine.StartsWith("242:"))
                {
                    throw new SdmxSyntaxException("Could not parse dataset preparation date '" + currentLine + "' expecting '" + EdiPrefix.DatasetDatetime + "242:' but did not find '242:'");
                }

                if (this._ediReader.CurrentLine.Length <= 4)
                {
                    throw new SdmxSyntaxException(
                        "Could not parse dataset preparation date '" + currentLine
                        + "' expecting '242:' to be followed by a date in the following format 'yyyyMMddHHmm:Sss' example : 19811807810530:000 (18th July 1981, 05:30am)");
                }

                string datePart = currentLine.Substring(4);
                var df = new DateFormat("yyyyMMddHHmm:ssF"); // .SSSz
                try
                {
                    this._datasetPreperation = df.Parse(datePart);
                }
                catch (FormatException e)
                {
                    throw new SdmxSyntaxException(
                        "Could not parse dataset preparation date '" + datePart + "', please ensure format is yyyyMMddHHmm:Sss example : 19811807810530:000 (18th July 1981, 05:30am)", e);
                }

                this.AssertMoveNext();
                if (EDIUtil.AssertPrefix(this._ediReader, EdiPrefix.DatasetDatetime, false))
                {
                    currentLine = this._ediReader.CurrentLine;
                    if (!currentLine.StartsWith("Z02:"))
                    {
                        throw new SdmxSyntaxException("Could not parse dataset preparation date '" + currentLine + "' expecting '" + EdiPrefix.DatasetDatetime + "242:' but did not find 'Z02:'");
                    }

                    if (this._ediReader.CurrentLine.Length <= 4)
                    {
                        throw new SdmxSyntaxException(
                            "Could not parse dataset preparation date '" + currentLine
                            + "' expecting 'Z02:' to be followed by a date in the following format 'yyyyMMddHHmm:Sss' example : 19811807810530:000 (18th July 1981, 05:30am)");
                    }

                    // Evaluate the suffix to determine the reporting period format
                    int dateFormatStart = currentLine.LastIndexOf(EdiConstants.Colon, StringComparison.Ordinal);
                    string timeFormatString = currentLine.Substring(dateFormatStart + 1); // Add 1 since we don't want the colon character 
                    EdiTimeFormat timeFormat = EdiTimeFormatExtension.ParseString(timeFormatString);
                    datePart = currentLine.Substring(4, dateFormatStart - 4);

                    this._reportingBegin = timeFormat.ParseDate(datePart);
                    if (timeFormat.IsRange())
                    {
                        this._reportingEnd = timeFormat.ParseEndDate(datePart);
                    }
                    else
                    {
                        this._reportingEnd = this._reportingBegin;
                    }

                    this._reportingPeriod = this._reportingBegin;
                    this._reportingEnd = DateUtil.MoveToEndofPeriod(this._reportingEnd, timeFormat.GetSdmxTimeFormat());
                }
                else
                {
                    this._ediReader.MoveBackLine();
                }

                this.AssertMoveNext();
                EDIUtil.AssertPrefix(this._ediReader, EdiPrefix.DsdReference, true);
                this._keyFamilyIdentifier = this._ediReader.CurrentLine;

                this.AssertMoveNext();
                EDIUtil.AssertPrefix(this._ediReader, EdiPrefix.DatasetSendMethod, true);

                this.AssertMoveNext();
                EDIUtil.AssertPrefix(this._ediReader, EdiPrefix.DatasetMissingValueSymbol, true);
                this._missingValue = this._ediReader.CurrentLine;
            }
Example #11
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////BUILD FROM V1.0 SCHEMA            ///////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes a new instance of the <see cref="HeaderImpl"/> class.
        /// </summary>
        /// <param name="headerType">
        /// The header type. 
        /// </param>
        public HeaderImpl(Org.Sdmx.Resources.SdmxMl.Schemas.V10.message.HeaderType headerType)
        {
            this._additionalAttributes = new Dictionary<string, string>();
            this._name = new List<ITextTypeWrapper>();
            this._source = new List<ITextTypeWrapper>();
            this._receiver = new List<IParty>();
            this._structureReferences = new List<IDatasetStructureReference>();
            this._test = headerType.Test;
            if (headerType.DataSetAction != null)
            {
                switch (headerType.DataSetAction)
                {
                    case Org.Sdmx.Resources.SdmxMl.Schemas.V10.common.ActionTypeConstants.Update:
                        this._datasetAction = DatasetAction.GetFromEnum(DatasetActionEnumType.Replace);
                        break;
                    case Org.Sdmx.Resources.SdmxMl.Schemas.V10.common.ActionTypeConstants.Delete:
                        this._datasetAction = DatasetAction.GetFromEnum(DatasetActionEnumType.Replace);
                        break;
                }
            }

            this._id = headerType.ID;
            this._datasetId = headerType.DataSetID;
            if (headerType.Extracted != null)
            {
                this._extracted = headerType.Extracted;
            }

            if (ObjectUtil.ValidCollection(headerType.Name))
            {
                foreach (Org.Sdmx.Resources.SdmxMl.Schemas.V10.common.TextType tt in headerType.Name)
                {
                    this._name.Add(new TextTypeWrapperImpl(tt, null));
                }
            }

            var prepared = headerType.Prepared as DateTime?;
            if (prepared != null)
            {
                this._prepared = prepared;
            }

            if (ObjectUtil.ValidCollection(headerType.Receiver))
            {
                foreach (Org.Sdmx.Resources.SdmxMl.Schemas.V10.message.PartyType party in headerType.Receiver)
                {
                    this._receiver.Add(new PartyCore(party));
                }
            }

            if (headerType.ReportingBegin != null)
            {
                this._reportingBegin = DateUtil.FormatDate(headerType.ReportingBegin, true);
            }

            if (headerType.ReportingEnd != null)
            {
                this._reportingEnd = DateUtil.FormatDate(headerType.ReportingEnd, true);
            }

            if (headerType.Sender != null)
            {
                this._sender = new PartyCore(headerType.Sender);
            }

            if (ObjectUtil.ValidCollection(headerType.Source))
            {
                foreach (Org.Sdmx.Resources.SdmxMl.Schemas.V10.common.TextType textType in headerType.Source)
                {
                    this._source.Add(new TextTypeWrapperImpl(textType, null));
                }
            }

            if (!string.IsNullOrWhiteSpace(headerType.KeyFamilyAgency))
            {
                this._additionalAttributes.Add(Header.DsdAgencyRef, headerType.KeyFamilyAgency);
            }

            if (!string.IsNullOrWhiteSpace(headerType.KeyFamilyRef))
            {
                this._additionalAttributes.Add(Header.DsdRef, headerType.KeyFamilyRef);
            }

            this.Validate();
        }
Example #12
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////BUILD FROM V2.1 SCHEMA                ////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes a new instance of the <see cref="HeaderImpl"/> class.
        /// </summary>
        /// <param name="headerType">
        /// The header type. 
        /// </param>
        public HeaderImpl(BaseHeaderType headerType)
        {
            this._additionalAttributes = new Dictionary<string, string>();
            this._name = new List<ITextTypeWrapper>();
            this._source = new List<ITextTypeWrapper>();
            this._receiver = new List<IParty>();
            this._structureReferences = new List<IDatasetStructureReference>();
            this._test = headerType.Test;
            if (headerType.DataProvider != null)
            {
                this._dataProviderReference = RefUtil.CreateReference(headerType.DataProvider);
            }

            if (headerType.DataSetAction != null)
            {
                switch (headerType.DataSetAction)
                {
                    case ActionTypeConstants.Append:
                        this._datasetAction = DatasetAction.GetFromEnum(DatasetActionEnumType.Append);
                        break;
                    case ActionTypeConstants.Replace:
                        this._datasetAction = DatasetAction.GetFromEnum(DatasetActionEnumType.Replace);
                        break;
                    case ActionTypeConstants.Delete:
                        this._datasetAction = DatasetAction.GetFromEnum(DatasetActionEnumType.Delete);
                        break;
                }
            }

            if (ObjectUtil.ValidCollection(headerType.DataSetID))
            {
                this._datasetId = headerType.DataSetID[0];
            }

            this._id = headerType.ID;
            if (headerType.EmbargoDate != null)
            {
                this._embargoDate = headerType.EmbargoDate.Value;
            }

            if (headerType.Extracted != null)
            {
                this._extracted = headerType.Extracted;
            }

            if (ObjectUtil.ValidCollection(headerType.Name))
            {
                foreach (Name tt in headerType.Name)
                {
                    this._name.Add(new TextTypeWrapperImpl(tt, null));
                }
            }

            var prepared = headerType.Prepared as DateTime?;
            if (prepared != null)
            {
                this._prepared = prepared;
            }

            if (ObjectUtil.ValidCollection(headerType.Receiver))
            {
                foreach (PartyType party in headerType.Receiver)
                {
                    this._receiver.Add(new PartyCore(party));
                }
            }

            if (headerType.ReportingBegin != null)
            {
                this._reportingBegin = DateUtil.FormatDate(headerType.ReportingBegin, true);
            }

            if (headerType.ReportingEnd != null)
            {
                this._reportingEnd = DateUtil.FormatDate(headerType.ReportingEnd, true);
            }

            if (headerType.Sender != null)
            {
                this._sender = new PartyCore(headerType.Sender);
            }

            if (ObjectUtil.ValidCollection(headerType.Source))
            {
                foreach (TextType textType in headerType.Source)
                {
                    this._source.Add(new TextTypeWrapperImpl(textType, null));
                }
            }

            if (ObjectUtil.ValidCollection(headerType.Structure))
            {
                foreach (PayloadStructureType payloadSt in headerType.Structure)
                {
                    this._structureReferences.Add(new DatasetStructureReferenceCore(payloadSt));
                }
            }

            this.Validate();
        }
Example #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HeaderImpl"/> class.
        /// </summary>
        /// <param name="additionalAttributes">
        /// The additional attribtues. 
        /// </param>
        /// <param name="structures">
        /// The structures. 
        /// </param>
        /// <param name="dataProviderReference">
        /// The data provider reference. 
        /// </param>
        /// <param name="datasetAction">
        /// The dataset action. 
        /// </param>
        /// <param name="id">
        /// The id. 
        /// </param>
        /// <param name="datasetId">
        /// The dataset id. 
        /// </param>
        /// <param name="embargoDate">
        /// The embargo date. 
        /// </param>
        /// <param name="extracted">
        /// The extracted. 
        /// </param>
        /// <param name="prepared">
        /// The prepared. 
        /// </param>
        /// <param name="reportingBegin">
        /// The reporting begin. 
        /// </param>
        /// <param name="reportingEnd">
        /// The reporting end. 
        /// </param>
        /// <param name="name">
        /// The name. 
        /// </param>
        /// <param name="source">
        /// The source. 
        /// </param>
        /// <param name="receiver">
        /// The receiver. 
        /// </param>
        /// <param name="sender">
        /// The sender. 
        /// </param>
        /// <param name="test">
        /// The test. 
        /// </param>
        public HeaderImpl(
            IDictionary<string, string> additionalAttributes,
            IList<IDatasetStructureReference> structures,
            IStructureReference dataProviderReference,
            DatasetAction datasetAction,
            string id,
            string datasetId,
            DateTime? embargoDate,
            DateTime? extracted,
            DateTime? prepared,
            DateTime? reportingBegin,
            DateTime? reportingEnd,
            IList<ITextTypeWrapper> name,
            IList<ITextTypeWrapper> source,
            IList<IParty> receiver,
            IParty sender,
            bool test)
        {
            this._additionalAttributes = new Dictionary<string, string>();
            this._name = new List<ITextTypeWrapper>();
            this._source = new List<ITextTypeWrapper>();
            this._receiver = new List<IParty>();
            this._structureReferences = new List<IDatasetStructureReference>();
            if (additionalAttributes != null)
            {
                this._additionalAttributes = new Dictionary<string, string>(additionalAttributes);
            }

            if (structures != null)
            {
                this._structureReferences = new List<IDatasetStructureReference>(structures);
            }

            this._dataProviderReference = dataProviderReference;
            this._datasetAction = datasetAction;
            this._id = id;
            this._datasetId = datasetId;
            if (embargoDate != null)
            {
                this._embargoDate = embargoDate.Value;
            }

            if (extracted != null)
            {
                this._extracted = extracted.Value;
            }

            if (prepared != null)
            {
                this._prepared = prepared.Value;
            }

            if (reportingBegin != null)
            {
                this._reportingBegin = reportingBegin.Value;
            }

            if (reportingEnd != null)
            {
                this._reportingEnd = reportingEnd.Value;
            }

            if (name != null)
            {
                this._name = new List<ITextTypeWrapper>(name);
            }

            if (source != null)
            {
                this._source = new List<ITextTypeWrapper>(source);
            }

            if (receiver != null)
            {
                this._receiver = new List<IParty>(receiver);
            }

            this._sender = sender;
            this._test = test;
            this.Validate();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="RegistrationInformationImpl"/> class.
 /// </summary>
 /// <param name="action">
 /// The action. 
 /// </param>
 /// <param name="registration">
 /// The registration codelistRef. 
 /// </param>
 public RegistrationInformationImpl(DatasetAction action, IRegistrationObject registration)
 {
     this._action = action;
     this._registration = registration;
 }
        ///////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////BUILD FROM V2.0 SCHEMA                 //////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes a new instance of the <see cref="NotificationEventCore"/> class.
        /// </summary>
        /// <param name="notification">
        /// The notification. 
        /// </param>
        public NotificationEventCore(
            Org.Sdmx.Resources.SdmxMl.Schemas.V20.registry.NotifyRegistryEventType notification)
        {
            this._eventTime = notification.EventTime;
            this._objectUrn = notification.ObjectURN;
            this._subscriptionUrn = notification.SubscriptionURN;
            this._action = (DatasetAction)Enum.Parse(typeof(DatasetAction), notification.EventAction.ToUpperInvariant());
            if (notification.RegistrationEvent != null)
            {
                this._registration = new RegistrationObjectCore(notification.RegistrationEvent.Registration);
            }
        }
        ///////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////BUILD FROM V2.1 SCHEMA                 //////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="NotificationEventCore"/> class.
        /// </summary>
        /// <param name="notification">
        /// The notification. 
        /// </param>
        public NotificationEventCore(NotifyRegistryEventType notification)
        {
            this._eventTime = notification.EventTime; //TODO: True param DateUtil
            this._objectUrn = notification.ObjectURN;
            this._subscriptionUrn = notification.SubscriptionURN;
            this._action = (DatasetAction)Enum.Parse(typeof(DatasetAction), notification.EventAction.ToUpperInvariant());
            if (notification.RegistrationEvent != null)
            {
                this._registration = new RegistrationObjectCore(notification.RegistrationEvent.Registration);
            }
            else
            {
                this.objects = new SdmxObjectsImpl();
                StructuresType structures = notification.StructuralEvent.Structures.Content;
                if (structures.Categorisations != null)
                {
                    foreach (CategorisationType type in structures.Categorisations.Categorisation)
                    {
                        this.objects.AddCategorisation(new CategorisationObjectCore(type));
                    }
                }

                if (structures.CategorySchemes != null)
                {
                    foreach (CategorySchemeType type0 in structures.CategorySchemes.CategoryScheme)
                    {
                        this.objects.AddCategoryScheme(new CategorySchemeObjectCore(type0));
                    }
                }

                if (structures.Codelists != null)
                {
                    foreach (CodelistType type1 in structures.Codelists.Codelist)
                    {
                        this.objects.AddCodelist(new CodelistObjectCore(type1));
                    }
                }

                if (structures.Concepts != null)
                {
                    foreach (ConceptSchemeType type2 in structures.Concepts.ConceptScheme)
                    {
                        this.objects.AddConceptScheme(new ConceptSchemeObjectCore(type2));
                    }
                }

                if (structures.Constraints != null)
                {
                    foreach (AttachmentConstraintType type3 in structures.Constraints.AttachmentConstraint)
                    {
                        this.objects.AddAttachmentConstraint(new AttachmentConstraintObjectCore(type3));
                    }

                    foreach (ContentConstraintType type4 in structures.Constraints.ContentConstraint)
                    {
                        this.objects.AddContentConstraintObject(new ContentConstraintObjectCore(type4));
                    }
                }

                if (structures.Dataflows != null)
                {
                    foreach (DataflowType type5 in structures.Dataflows.Dataflow)
                    {
                        this.objects.AddDataflow(new DataflowObjectCore(type5));
                    }
                }

                if (structures.DataStructures != null)
                {
                    foreach (DataStructureType type6 in structures.DataStructures.DataStructure)
                    {
                        this.objects.AddDataStructure(new DataStructureObjectCore(type6));
                    }
                }

                if (structures.HierarchicalCodelists != null)
                {
                    foreach (HierarchicalCodelistType type7 in structures.HierarchicalCodelists.HierarchicalCodelist)
                    {
                        this.objects.AddHierarchicalCodelist(new HierarchicalCodelistObjectCore(type7));
                    }
                }

                if (structures.Metadataflows != null)
                {
                    foreach (MetadataflowType type8 in structures.Metadataflows.Metadataflow)
                    {
                        this.objects.AddMetadataFlow(new MetadataflowObjectCore(type8));
                    }
                }

                if (structures.MetadataStructures != null)
                {
                    foreach (MetadataStructureType type9 in structures.MetadataStructures.MetadataStructure)
                    {
                        this.objects.AddMetadataStructure(new MetadataStructureDefinitionObjectCore(type9));
                    }
                }

                if (structures.OrganisationSchemes != null)
                {
                    foreach (AgencySchemeType type10 in structures.OrganisationSchemes.AgencyScheme)
                    {
                        this.objects.AddAgencyScheme(new AgencySchemeCore(type10));
                    }

                    foreach (DataConsumerSchemeType type11 in structures.OrganisationSchemes.DataConsumerScheme)
                    {
                        this.objects.AddDataConsumerScheme(new DataConsumerSchemeCore(type11));
                    }

                    foreach (DataProviderSchemeType type12 in structures.OrganisationSchemes.DataProviderScheme)
                    {
                        this.objects.AddDataProviderScheme(new DataProviderSchemeCore(type12));
                    }

                    foreach (OrganisationUnitSchemeType type13 in structures.OrganisationSchemes.OrganisationUnitScheme)
                    {
                        this.objects.AddOrganisationUnitScheme(new OrganisationUnitSchemeObjectCore(type13));
                    }
                }

                if (structures.Processes != null)
                {
                    foreach (ProcessType type14 in structures.Processes.Process)
                    {
                        this.objects.AddProcess(new ProcessObjectCore(type14));
                    }
                }

                if (structures.ProvisionAgreements != null)
                {
                    foreach (ProvisionAgreementType type15 in structures.ProvisionAgreements.ProvisionAgreement)
                    {
                        this.objects.AddProvisionAgreement(new ProvisionAgreementObjectCore(type15));
                    }
                }

                if (structures.ReportingTaxonomies != null)
                {
                    foreach (ReportingTaxonomyType type16 in structures.ReportingTaxonomies.ReportingTaxonomy)
                    {
                        this.objects.AddReportingTaxonomy(new ReportingTaxonomyObjectCore(type16));
                    }
                }

                if (structures.StructureSets != null)
                {
                    foreach (StructureSetType type17 in structures.StructureSets.StructureSet)
                    {
                        this.objects.AddStructureSet(new StructureSetObjectCore(type17));
                    }
                }
            }
        }
 /// <summary>
 /// Build SDMX objects from v2.1 structures
 /// </summary>
 /// <param name="structures">
 /// The structures
 /// </param>
 /// <param name="header">
 /// The header.
 /// </param>
 /// <returns>
 /// beans container of all beans built
 /// </returns>
 private ISdmxObjects Build(StructuresType structures, IHeader header, DatasetAction action)
 {
     var beans = new SdmxObjectsImpl(header, action);
     this.ProcessOrganisationSchemes(structures.OrganisationSchemes, beans);
     this.ProcessDataflows(structures.Dataflows, beans);
     this.ProcessMetadataFlows(structures.Metadataflows, beans);
     this.ProcessCategorySchemes(structures.CategorySchemes, beans);
     this.ProcessCategorisations(structures.Categorisations, beans);
     this.ProcessCodelists(structures.Codelists, beans);
     this.ProcessHierarchicalCodelists(structures.HierarchicalCodelists, beans);
     this.ProcessConcepts(structures.Concepts, beans);
     this.ProcessMetadataStructures(structures.MetadataStructures, beans);
     this.ProcessDataStructures(structures.DataStructures, beans);
     this.ProcessStructureSets(structures.StructureSets, beans);
     this.ProcessReportingTaxonomies(structures.ReportingTaxonomies, beans);
     this.ProcessProcesses(structures.Processes, beans);
     this.ProcessConstraints(structures.Constraints, beans);
     this.ProcessProvisions(structures.ProvisionAgreements, beans);
     return beans;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EdiDocumentPosition"/> class.
 /// </summary>
 /// <param name="startLine">
 /// The start line.
 /// </param>
 /// <param name="endLine">
 /// The end line.
 /// </param>
 /// <param name="isStructure">
 /// The is structure.
 /// </param>
 /// <param name="datasetId">
 /// The dataset id.
 /// </param>
 /// <param name="messageAgency">
 /// The message agency.
 /// </param>
 /// <param name="sendingAgency">
 /// The sending agency.
 /// </param>
 /// <param name="recievingAgency">
 /// The receiving agency.
 /// </param>
 /// <param name="datasetAction">
 /// The dataset action.
 /// </param>
 /// <param name="keyFamilyIdentifier">
 /// The key family identifier.
 /// </param>
 /// <param name="missingValue">
 /// The missing value.
 /// </param>
 /// <param name="datasetPreparation">
 /// The dataset preparation.
 /// </param>
 /// <param name="reportingPeriod">
 /// The reporting period.
 /// </param>
 /// <param name="datasetAttributes">
 /// The dataset attributes.
 /// </param>
 public EdiDocumentPosition(
     int startLine, 
     int endLine, 
     bool isStructure, 
     string datasetId, 
     string messageAgency, 
     IParty sendingAgency, 
     string recievingAgency, 
     DatasetAction datasetAction, 
     string keyFamilyIdentifier, 
     string missingValue, 
     DateTime datasetPreparation, 
     DateTime reportingPeriod, 
     IList<IKeyValue> datasetAttributes)
 {
     this._startLine = startLine;
     this._endLine = endLine;
     this._isStructure = isStructure;
     this._datasetId = datasetId;
     this._messageAgency = messageAgency;
     this._sendingAgency = sendingAgency;
     this._recievingAgency = recievingAgency;
     this._datasetAction = datasetAction;
     this._keyFamilyIdentifier = keyFamilyIdentifier;
     this._missingValue = missingValue;
     this._datasetPreparation = datasetPreparation;
     this._reportingPeriod = reportingPeriod;
     this._datasetAttributes = datasetAttributes;
 }
Example #19
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));
        }