예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MetadataTargetCore"/> class.
        /// </summary>
        /// <param name="fullTarget">The SDMX v2.0 full target identifier.</param>
        /// <param name="parent">The parent.</param>
        protected internal MetadataTargetCore(FullTargetIdentifierType fullTarget, IMetadataStructureDefinitionObject parent)
            : base(fullTarget, SdmxStructureType.GetFromEnum(SdmxStructureEnumType.MetadataTarget), fullTarget.id, fullTarget.uri, fullTarget.Annotations, parent)
        {
            if (fullTarget.IdentifierComponent != null)
            {
                foreach (var currentIdentifier in fullTarget.IdentifierComponent)
                {
                    var identifiableTarget = new IdentifiableTargetMutableCore() { Id = currentIdentifier.id, Uri = currentIdentifier.uri };
                    if (currentIdentifier.Annotations != null && currentIdentifier.Annotations.Annotation != null)
                    {
                        foreach (var annotationType in currentIdentifier.Annotations.Annotation)
                        {
                            var annotation = new AnnotationMutableCore { Title = annotationType.AnnotationTitle, Type = annotationType.AnnotationType1, Uri = annotationType.AnnotationURL };
                            foreach (var textType in annotationType.AnnotationText)
                            {
                                annotation.AddText(textType.lang, textType.TypedValue);
                            }

                            identifiableTarget.AddAnnotation(annotation);
                        }
                    }

                    if (currentIdentifier.RepresentationScheme != null)
                    {
                        var id = currentIdentifier.RepresentationScheme.representationScheme;
                        var agency = currentIdentifier.RepresentationScheme.representationSchemeAgency;
                        var schemaType = XmlobjectsEnumUtil.GetSdmxStructureTypeFromRepresentationSchemeTypeV20(currentIdentifier.RepresentationScheme.representationSchemeType1);

                        // Only on .NET
                        var version = currentIdentifier.RepresentationScheme.RepresentationSchemeVersionEstat ?? MaintainableObject.DefaultVersion;

                        var representation = new RepresentationMutableCore();
                        var representationRef = new StructureReferenceImpl(new MaintainableRefObjectImpl(agency, id, version), schemaType);
                        representation.Representation = representationRef;
                        identifiableTarget.Representation = representation;
                    }

                    if (currentIdentifier.TargetObjectClass != null)
                    {
                        identifiableTarget.ReferencedStructureType = XmlobjectsEnumUtil.GetSdmxStructureType(currentIdentifier.TargetObjectClass);
                    }

                    this._identifiableTarget.Add(new IdentifiableTargetCore(identifiableTarget, this));
                }
            }
        }
 /// <summary>
 /// Handles the child elements.
 /// </summary>
 /// <param name="parent">The full target mutable object.</param>
 /// <param name="localName">The local name of the element.</param>
 /// <returns>The <see cref="StructureReaderBaseV20.ElementActions"/>.</returns>
 private ElementActions HandleChildElements(IMetadataTargetMutableObject parent, object localName)
 {
     if (NameTableCache.IsElement(localName, ElementNameTable.IdentifierComponent))
     {
         IIdentifiableTargetMutableObject identifiableTarget = new IdentifiableTargetMutableCore();
         parent.IdentifiableTarget.Add(identifiableTarget); 
         ParseAttributes(identifiableTarget, this.Attributes);
         return this.AddAnnotableAction(identifiableTarget, this.HandleChildElements, this.HandleTextChildElement);
     }
     
     return null;
 }