/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM MUTABLE OBJECT ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// #region Constructors and Destructors /// <summary> /// Initializes a new instance of the <see cref="ConceptCore"/> class. /// </summary> /// <param name="parent"> /// The parent. /// </param> /// <param name="itemMutableObject"> /// The sdmxObject. /// </param> public ConceptCore(IConceptSchemeObject parent, IConceptMutableObject itemMutableObject) : base(itemMutableObject, parent) { if(itemMutableObject.CoreRepresentation != null && (itemMutableObject.CoreRepresentation.TextFormat != null || itemMutableObject.CoreRepresentation.Representation != null)) { this.coreRepresentation = new RepresentationCore(itemMutableObject.CoreRepresentation, this); } if (itemMutableObject.IsoConceptReference != null) { this.isoConceptReference = new CrossReferenceImpl(this, itemMutableObject.IsoConceptReference); } this.parentConcept = itemMutableObject.ParentConcept; this.parentAgency = itemMutableObject.ParentAgency; }
/// <summary> /// Write the element Concept using the given IConceptMutableObject object /// </summary> /// <param name="item"> /// The IConceptMutableObject object to write /// </param> private void WriteConcept(IConceptMutableObject item) { this.WriteStartElement(this.DefaultPrefix, ElementNameTable.Concept); this.WriteIdentifiableArtefactAttributes(item); ////TryWriteAttribute(AttributeNameTable.version, item.Version); ////TryWriteAttribute(AttributeNameTable.validFrom, (item).ValidFrom); ////TryWriteAttribute(AttributeNameTable.validTo, (item).ValidTo); this.TryWriteAttribute(AttributeNameTable.parent, item.ParentConcept); this.TryWriteAttribute(AttributeNameTable.parentAgency, item.ParentAgency); IStructureReference representation = null; ITextFormatMutableObject textFormat = null; if (item.CoreRepresentation != null) { representation = item.CoreRepresentation.Representation; textFormat = item.CoreRepresentation.TextFormat; } if (representation != null) { this.TryWriteAttribute( AttributeNameTable.coreRepresentation, representation.MaintainableReference.MaintainableId); this.TryWriteAttribute( AttributeNameTable.coreRepresentationAgency, representation.MaintainableReference.AgencyId); ////TryWriteAttribute(AttributeNameTable.coreRepresentationVersion, item.CoreRepresentation.Representation.MaintainableReference.Version); } this.WriteIdentifiableArtefactContent(item); if (textFormat != null) { this.WriteTextFormat(textFormat); } this.WriteAnnotations(ElementNameTable.Annotations, item.Annotations); this.WriteEndElement(); }
/// <summary> /// Handles the Concept element child elements /// </summary> /// <param name="parent"> /// The parent IConceptMutableObject object /// </param> /// <param name="localName"> /// The name of the current xml element /// </param> private ElementActions HandleChildElements(IConceptMutableObject parent, object localName) { if (NameTableCache.IsElement(localName, ElementNameTable.TextFormat)) { parent.CoreRepresentation = new RepresentationMutableCore { TextFormat = HandleTextFormat(this.Attributes) }; return ElementActions.Empty; } return null; }