/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM MUTABLE OBJECTS ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// #region Constructors and Destructors /// <summary> /// Initializes a new instance of the <see cref="ReportStructureCore"/> class. /// </summary> /// <param name="parent"> /// The parent. /// </param> /// <param name="rs"> /// The rs. /// </param> /// <exception cref="SdmxSemmanticException"> Throws SdmxSemmanticException. /// </exception> /// <exception cref="SdmxSemmanticException"> /// Throws Validate exception. /// </exception> public ReportStructureCore(IMetadataStructureDefinitionObject parent, IReportStructureMutableObject rs) : base(rs, parent) { this.metadataAttributes = new List<IMetadataAttributeObject>(); this.targetMetadatas = new List<string>(); try { if (rs.MetadataAttributes != null) { foreach (IMetadataAttributeMutableObject currentMa in rs.MetadataAttributes) { this.metadataAttributes.Add(new MetadataAttributeObjectCore(this, currentMa)); } } if (rs.TargetMetadatas != null) { this.targetMetadatas = new List<string>(rs.TargetMetadatas); } } catch (Exception th) { throw new SdmxSemmanticException(th, ExceptionCode.ObjectStructureConstructionError, this); } try { this.Validate(); } catch (SdmxSemmanticException e) { throw new SdmxSemmanticException(e, ExceptionCode.FailValidation, this); } }
/// <summary> /// Handles the child elements. /// </summary> /// <param name="parent">The parent.</param> /// <param name="elementLocalName">Name of the element local.</param> /// <returns>The <see cref="StructureReaderBaseV20.ElementActions"/>.</returns> private ElementActions HandleChildElements(IReportStructureMutableObject parent, object elementLocalName) { if (ElementNameTable.MetadataAttribute.Is(elementLocalName)) { IMetadataAttributeMutableObject attribute = new MetadataAttributeMutableCore(); ParseAttributes(attribute, this.Attributes); parent.MetadataAttributes.Add(attribute); return this.AddAnnotableAction(attribute, this.HandleChildElements, DoNothing); } return null; }