/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM V2.1 SCHEMA ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <see cref="MetadataAttributeObjectCore"/> class. /// </summary> /// <param name="metadataAttribute"> /// The metadata attributeObject. /// </param> /// <param name="parent"> /// The parent. /// </param> /// <exception cref="SdmxSemmanticException"> /// Throws Validate exception. /// </exception> public MetadataAttributeObjectCore(MetadataAttributeType metadataAttribute, IIdentifiableObject parent) : base(metadataAttribute, SdmxStructureType.GetFromEnum(SdmxStructureEnumType.MetadataAttribute), parent) { this.metadataAttributes = new List<IMetadataAttributeObject>(); this.presentational = TertiaryBool.GetFromEnum(TertiaryBoolEnumType.Unset); this.minOccurs = (metadataAttribute.minOccurs < int.MaxValue) ? decimal.ToInt32(metadataAttribute.minOccurs) : (int?)null; if (metadataAttribute.maxOccurs != null) { long res; if (long.TryParse(metadataAttribute.maxOccurs.ToString(), out res)) { this.maxOccurs = Convert.ToInt32(res); } else { this.maxOccurs = null; // unbounded } } if (metadataAttribute.isPresentational) { this.presentational = TertiaryBool.ParseBoolean(metadataAttribute.isPresentational); } if (metadataAttribute.MetadataAttribute != null) { foreach (MetadataAttribute currentMaType in metadataAttribute.MetadataAttribute) { this.metadataAttributes.Add(new MetadataAttributeObjectCore(currentMaType.Content, this)); } } try { this.Validate(); } catch (SdmxSemmanticException e) { throw new SdmxSemmanticException(e, ExceptionCode.FailValidation, this); } }
private static void Fill_Reported_Attribute_ChildAttributes(ReportedAttributeType ReportedAttribute, MetadataAttributeType MetadataAttribute, string IndicatorNId, Dictionary<string, string> DictMetadataMapping, DIConnection DIConnection, DIQueries DIQueries) { ReportedAttributeType ChilReportedAttribute; if (MetadataAttribute.MetadataAttribute != null && MetadataAttribute.MetadataAttribute.Count > 0) { ReportedAttribute.ReportedAttribute = new List<ReportedAttributeType>(); foreach (MetadataAttributeType ChildMetadataAttribute in MetadataAttribute.MetadataAttribute) { ChilReportedAttribute = new ReportedAttributeType(); ChilReportedAttribute.Annotations = null; ChilReportedAttribute.conceptID = ChildMetadataAttribute.conceptRef; Fill_Reported_Attribute_Value(ChilReportedAttribute, IndicatorNId, DictMetadataMapping, DIConnection, DIQueries); Fill_Reported_Attribute_ChildAttributes(ChilReportedAttribute, ChildMetadataAttribute, IndicatorNId, DictMetadataMapping, DIConnection, DIQueries); ReportedAttribute.ReportedAttribute.Add(ChilReportedAttribute); } } }