/// <summary> /// The add annotation. /// </summary> /// <param name="annotation"> /// The annotation. /// </param> public virtual void AddAnnotation(IAnnotationMutableObject annotation) { if (annotation == null) _annotations = new List<IAnnotationMutableObject>(); this._annotations.Add(annotation); }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM MUTABLE OBJECT ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// #region Constructors and Destructors /// <summary> /// Initializes a new instance of the <see cref="AnnotationObjectCore"/> class. /// </summary> /// <param name="annotationMutable"> /// The annotation mutable. /// </param> /// <param name="parent"> /// The parent. /// </param> /// <exception cref="SdmxException"> /// Throws Validate exception. /// </exception> public AnnotationObjectCore(IAnnotationMutableObject annotationMutable, ISdmxObject parent) : base(annotationMutable, parent) { this._text = new List<ITextTypeWrapper>(); this._id = annotationMutable.Id; this._title = annotationMutable.Title; this._type = annotationMutable.Type; if (annotationMutable.Text != null) { foreach (ITextTypeWrapperMutableObject mutable in annotationMutable.Text) { if (!string.IsNullOrWhiteSpace(mutable.Value)) { this._text.Add(new TextTypeWrapperImpl(mutable, this)); } } } this.Uri = annotationMutable.Uri; try { this.Validate(); } catch (SdmxException ex) { throw new SdmxException("Annotation is not valid", ex); } catch (Exception th) { throw new SdmxException("Annotation is not valid", th); } }