/// <summary>
        /// Gets the annotations type.
        /// </summary>
        /// <param name="annotable">
        /// The object that can be annotated..
        /// </param>
        /// <returns>
        /// The <see cref="AnnotationsType"/> .
        /// </returns>
        internal AnnotationsType GetAnnotationsType(IAnnotableObject annotable)
        {
            if (!ObjectUtil.ValidCollection(annotable.Annotations))
            {
                return null;
            }

            var returnType = new AnnotationsType();

            /* foreach */
            foreach (IAnnotation currentAnnotationBean in annotable.Annotations)
            {
                var annotation = new AnnotationType();
                returnType.Annotation.Add(annotation);
                annotation.AnnotationText = this.GetTextType(currentAnnotationBean.Text);
                annotation.AnnotationTitle = currentAnnotationBean.Title;
                annotation.AnnotationType1 = currentAnnotationBean.Type;
                if (currentAnnotationBean.Uri != null)
                {
                    annotation.AnnotationURL = currentAnnotationBean.Uri;
                }
            }

            return returnType;
        }
		public AnnotableMutableObjectBaseCore(IAnnotableObject annotableObject) {
			this._annotations = new HashSet<IAnnotationMutableObjectBase>();
			if (annotableObject.Annotations != null) {
				/* foreach */
				foreach (IAnnotation annotation  in  annotableObject.Annotations) {
					_annotations.Add(new AnnotationMutableObjectBaseCore(annotation));
				}
			}
		}
 /// <summary>
 /// Initializes a new instance of the <see cref="AnnotableMutableCore"/> class.
 /// </summary>
 /// <param name="objTarget">
 /// The obj target. 
 /// </param>
 protected AnnotableMutableCore(IAnnotableObject objTarget)
     : base(objTarget)
 {
     this._annotations = new List<IAnnotationMutableObject>();
     if (objTarget.Annotations != null)
     {
         foreach (IAnnotation annotation in objTarget.Annotations)
         {
             this._annotations.Add(new AnnotationMutableCore(annotation));
         }
     }
 }
		public AnnotableObjectBaseCore(IAnnotableObject annotableType) : base(annotableType) {
			this._annotations = new HashSet<IAnnotationObjectBase>();
			this._annotationByType = new Dictionary<String, IAnnotationObjectBase>();
			if (annotableType != null && annotableType.Annotations != null) {
				/* foreach */
				foreach (IAnnotation currentAnnotation  in  annotableType
						.Annotations) {
					IAnnotationObjectBase annotation = new AnnotationObjectBaseCore(
							currentAnnotation);
					_annotations.Add(annotation);
					if (Org.Sdmxsource.Util.ObjectUtil.ValidString(annotation.Type)) {
						_annotationByType.Add(annotation.Type, annotation);
					}
				}
			}
		}
        /// <summary>
        /// Gets annotations type.
        /// </summary>
        /// <param name="annotable">
        /// The annotable.
        /// </param>
        /// <returns>
        /// The <see cref="AnnotationsType"/>.
        /// </returns>
        internal AnnotationsType GetAnnotationsType(IAnnotableObject annotable)
        {
            if (!ObjectUtil.ValidCollection(annotable.Annotations))
            {
                return null;
            }

            var returnType = new AnnotationsType();

            /* foreach */
            foreach (IAnnotation currentAnnotationBean in annotable.Annotations)
            {
                var annotation = new AnnotationType();
                returnType.Annotation.Add(annotation);
                string value2 = currentAnnotationBean.Id;
                if (!string.IsNullOrWhiteSpace(value2))
                {
                    annotation.id = currentAnnotationBean.Id;
                }

                if (ObjectUtil.ValidCollection(currentAnnotationBean.Text))
                {
                    annotation.AnnotationText = this.GetTextType(currentAnnotationBean.Text);
                }

                string value1 = currentAnnotationBean.Title;
                if (!string.IsNullOrWhiteSpace(value1))
                {
                    annotation.AnnotationTitle = currentAnnotationBean.Title;
                }

                string value = currentAnnotationBean.Type;
                if (!string.IsNullOrWhiteSpace(value))
                {
                    annotation.AnnotationType1 = currentAnnotationBean.Type;
                }

                if (currentAnnotationBean.Uri != null)
                {
                    annotation.AnnotationURL = currentAnnotationBean.Uri;
                }
            }

            return returnType;
        }
Beispiel #6
0
        /// <summary>
        /// Insert the specified <paramref name="items"/> to the mapping store with <paramref name="state"/>
        /// </summary>
        /// <param name="state">
        ///     The MAPPING STORE connection and transaction state
        /// </param>
        /// <param name="items">
        ///     The items.
        /// </param>
        /// <param name="parentArtefact">
        ///     The primary key of the parent artefact.
        /// </param>
        /// <returns>
        /// The <see cref="IEnumerable{Long}"/>.
        /// </returns>
        public ItemStatusCollection Insert(DbTransactionState state, IEnumerable <IGroup> items, long parentArtefact)
        {
            var storedProcedure = _insertDsdGroup;
            var annotations     = new List <Tuple <long, IGroup> >();
            var groupIds        = new ItemStatusCollection();

            using (DbCommand command = storedProcedure.CreateCommand(state))
            {
                DbParameter dsdParameter = storedProcedure.CreateDsdIdParameter(command);

                DbParameter idParameter = storedProcedure.CreateIdParameter(command);

                DbParameter outputParameter = storedProcedure.CreateOutputParameter(command);

                foreach (var group in items)
                {
                    idParameter.Value  = group.Id;
                    dsdParameter.Value = parentArtefact;

                    command.ExecuteNonQuery();

                    var id = (long)outputParameter.Value;
                    groupIds.Add(new ItemStatus(group.Id, id));
                    if (group.Annotations.Count > 0)
                    {
                        annotations.Add(new Tuple <long, IGroup>(id, group));
                    }
                }
            }

            foreach (var annotation in annotations)
            {
                IAnnotableObject annotableObject = annotation.Item2;
                _annotationInsertEngine.Insert(state, annotation.Item1, _insertGroupAnnotation, annotableObject.Annotations);
            }

            return(groupIds);
        }
Beispiel #7
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////BUILD FROM ITSELF, CREATES STUB OBJECT //////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////    

        #region Constructors and Destructors

        /// <summary>
        ///   Initializes a new instance of the <see cref="AnnotableCore" /> class.
        /// </summary>
        /// <param name="agencyScheme"> The agencyScheme. </param>
        protected internal AnnotableCore(IAnnotableObject agencyScheme)
            : base(agencyScheme)
        {
            this.annotations = new List<IAnnotation>();
        }
Beispiel #8
0
 /// <summary>
 ///   The deep equals internal.
 /// </summary>
 /// <param name="annotableObject"> The agencyScheme. </param>
 /// <returns> The <see cref="bool" /> . </returns>
 protected internal bool DeepEqualsInternalAnnotable(
     IAnnotableObject annotableObject, bool includeFinalProperties)
 {
     if (includeFinalProperties)
     {
         IList<IAnnotation> thatAnnotations = annotableObject.Annotations;
         if (!this.Equivalent(thatAnnotations, this.annotations, includeFinalProperties))
         {
             return false;
         }
     }
     return true;
 }
        /// <summary>
        /// Check if <paramref name="annotable"/> has annotations.
        /// </summary>
        /// <param name="annotable">
        /// The object that can be annotated.
        /// </param>
        /// <returns>
        /// True if <paramref name="annotable"/> has annotations.
        /// </returns>
        internal bool HasAnnotations(IAnnotableObject annotable)
        {
            if (ObjectUtil.ValidCollection(annotable.Annotations))
            {
                return true;
            }

            return false;
        }