/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM MUTABLE OBJECTS ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// #region Constructors and Destructors /// <summary> /// Initializes a new instance of the <see cref="CrossSectionalMeasureCore"/> class. /// </summary> /// <param name="itemMutableObject"> /// The itemMutableObject. /// </param> /// <param name="parent"> /// The parent. /// </param> /// <exception cref="SdmxSemmanticException"> /// Throws Validate exception. /// </exception> public CrossSectionalMeasureCore( ICrossSectionalMeasureMutableObject itemMutableObject, ICrossSectionalDataStructureObject parent) : base(itemMutableObject, parent) { this.measureDimension = itemMutableObject.MeasureDimension; this.code = itemMutableObject.Code; try { this.Validate(); } catch (SdmxSemmanticException ex) { throw new SdmxSemmanticException(ex, ExceptionCode.ObjectStructureConstructionError, this.Urn); } catch (Exception th) { throw new SdmxException(th, ExceptionCode.ObjectStructureConstructionError, this.Urn); } }
/// <summary> /// Write a KeyFamily/Components/CrossSectionalMeasure element from a ICrossSectionalMeasureMutableObject object /// </summary> /// <param name="xsm"> /// The ICrossSectionalMeasureMutableObject object to write /// </param> private void WriteComponent(ICrossSectionalMeasureMutableObject xsm) { this.WriteStartElement(this.DefaultPrefix, ElementNameTable.CrossSectionalMeasure); this.WriteComponentAttributes(xsm); this.WriteRepresentation(xsm.Representation); this.TryWriteAttribute(AttributeNameTable.measureDimension, xsm.MeasureDimension); this.TryWriteAttribute(AttributeNameTable.code, xsm.Code); this.WriteComponentContent(xsm); this.WriteEndElement(); }
/// <summary> /// Add component reference to cross sectional measures. /// </summary> /// <param name="crossSectionalMeasure"> /// The cross sectional measure. /// </param> public void AddCrossSectionalMeasures(ICrossSectionalMeasureMutableObject crossSectionalMeasure) { this._crossSectionalMeasures.Add(crossSectionalMeasure); }
///// <summary> ///// Populates the proporties of the given IPrimaryMeasureMutableObject object from the given xml attributes dictionary ///// </summary> ///// <param name="measure">The given IPrimaryMeasureMutableObject objectt</param> ///// <param name="attributes">The dictionary contains the attributes of the element</param> // private static void ParseAttributes(IPrimaryMeasureMutableObject measure, IDictionary<string, string> attributes) { // ParseAttributes((IComponentMutableObject) measure, attributes); // } /// <summary> /// Populates the properties of the given ICrossSectionalMeasureMutableObject object from the given xml attributes dictionary /// </summary> /// <param name="artefact"> /// The <see cref="ICrossSectionalDataStructureMutableObject"/> /// </param> /// <param name="measure"> /// The given ICrossSectionalMeasureMutableObject object /// </param> /// <param name="attributes"> /// The dictionary contains the attributes of the element /// </param> private static void ParseAttributes(ICrossSectionalDataStructureMutableObject artefact, ICrossSectionalMeasureMutableObject measure, IDictionary<string, string> attributes) { ParseComponentBaseAttributes(artefact, measure, attributes); measure.MeasureDimension = Helper.TrySetFromAttribute(attributes, AttributeNameTable.measureDimension, measure.MeasureDimension); measure.Code = Helper.TrySetFromAttribute(attributes, AttributeNameTable.code, measure.Code); }