/// <summary> /// The process structure map. /// </summary> /// <param name="structureSetType"> /// The structure set type. /// </param> /// <param name="buildFrom"> /// The build from. /// </param> private void ProcessStructureMap(StructureSetType structureSetType, IStructureMapObject buildFrom) { var structureMapType = new StructureMapType(); structureSetType.StructureMap = structureMapType; structureMapType.isExtension = buildFrom.Extension; string str0 = buildFrom.Id; if (!string.IsNullOrWhiteSpace(str0)) { structureMapType.id = buildFrom.Id; } IList<ITextTypeWrapper> names = buildFrom.Names; if (ObjectUtil.ValidCollection(names)) { structureMapType.Name = this.GetTextType(names); } IList<ITextTypeWrapper> descriptions = buildFrom.Descriptions; if (ObjectUtil.ValidCollection(descriptions)) { structureMapType.Description = this.GetTextType(descriptions); } if (buildFrom.SourceRef != null) { if (buildFrom.SourceRef.TargetReference.EnumType == SdmxStructureEnumType.Dsd) { var keyFamilyRef = new KeyFamilyRefType(); structureMapType.KeyFamilyRef = keyFamilyRef; SetDataStructureRefAttributes(keyFamilyRef, buildFrom.SourceRef); } else if (buildFrom.SourceRef.TargetReference.EnumType == SdmxStructureEnumType.Msd) { var refType = new MetadataStructureRefType(); structureMapType.MetadataStructureRef = refType; SetMetadataStructureRefAttributes(refType, buildFrom.SourceRef); } } if (buildFrom.TargetRef != null) { if (buildFrom.TargetRef.TargetReference.EnumType == SdmxStructureEnumType.Dsd) { var keyFamilyRef = new KeyFamilyRefType(); structureMapType.TargetKeyFamilyRef = keyFamilyRef; SetDataStructureRefAttributes(keyFamilyRef, buildFrom.TargetRef); } else if (buildFrom.TargetRef.TargetReference.EnumType == SdmxStructureEnumType.Msd) { var refType1 = new MetadataStructureRefType(); structureMapType.TargetMetadataStructureRef = refType1; SetMetadataStructureRefAttributes(refType1, buildFrom.TargetRef); } } IList<IComponentMapObject> componentMapObjects = buildFrom.Components; if (ObjectUtil.ValidCollection(componentMapObjects)) { /* foreach */ foreach (IComponentMapObject componentMapBean in componentMapObjects) { var componentMapType = new ComponentMapType(); structureMapType.ComponentMap.Add(componentMapType); this.ProcessComponent(componentMapType, componentMapBean); } } if (this.HasAnnotations(buildFrom)) { structureMapType.Annotations = this.GetAnnotationsType(buildFrom); } }
/// <summary> /// The process organisation scheme map. /// </summary> /// <param name="structureSetType"> /// The structure set type. /// </param> /// <param name="buildFrom"> /// The build from. /// </param> private void ProcessOrganisationSchemeMap(StructureSetType structureSetType, IItemSchemeMapObject buildFrom) { var orgSchemeMap = new OrganisationSchemeMapType(); structureSetType.OrganisationSchemeMap = orgSchemeMap; string str0 = buildFrom.Id; if (!string.IsNullOrWhiteSpace(str0)) { orgSchemeMap.id = buildFrom.Id; } IList<ITextTypeWrapper> names = buildFrom.Names; if (ObjectUtil.ValidCollection(names)) { orgSchemeMap.Name = this.GetTextType(names); } IList<ITextTypeWrapper> descriptions = buildFrom.Descriptions; if (ObjectUtil.ValidCollection(descriptions)) { orgSchemeMap.Description = this.GetTextType(descriptions); } if (buildFrom.SourceRef != null) { var refType = new OrganisationSchemeRefType(); orgSchemeMap.OrganisationSchemeRef = refType; SetOrganisationSchemeRefAttributes(refType, buildFrom.SourceRef); } if (buildFrom.TargetRef != null) { var refType0 = new OrganisationSchemeRefType(); orgSchemeMap.TargetOrganisationSchemeRef = refType0; SetOrganisationSchemeRefAttributes(refType0, buildFrom.TargetRef); } IList<IItemMap> itemMapBeans = buildFrom.Items; if (ObjectUtil.ValidCollection(itemMapBeans)) { /* foreach */ foreach (IItemMap itemMapBean in itemMapBeans) { var orgMaptype = new OrganisationMapType(); orgSchemeMap.OrganisationMap.Add(orgMaptype); string str1 = itemMapBean.SourceId; if (!string.IsNullOrWhiteSpace(str1)) { orgMaptype.OrganisationID = itemMapBean.SourceId; } string str2 = itemMapBean.TargetId; if (!string.IsNullOrWhiteSpace(str2)) { orgMaptype.TargetOrganisationID = itemMapBean.TargetId; } } } if (this.HasAnnotations(buildFrom)) { orgSchemeMap.Annotations = this.GetAnnotationsType(buildFrom); } }
/// <summary> /// The process codelist map. /// </summary> /// <param name="structureSetType"> /// The structure set type. /// </param> /// <param name="buildFrom"> /// The build from. /// </param> private void ProcessCodelistMap(StructureSetType structureSetType, IItemSchemeMapObject buildFrom) { var codelistMap = new CodelistMapType(); structureSetType.CodelistMap = codelistMap; string str0 = buildFrom.Id; if (!string.IsNullOrWhiteSpace(str0)) { codelistMap.id = buildFrom.Id; } IList<ITextTypeWrapper> names = buildFrom.Names; if (ObjectUtil.ValidCollection(names)) { codelistMap.Name = this.GetTextType(names); } IList<ITextTypeWrapper> descriptions = buildFrom.Descriptions; if (ObjectUtil.ValidCollection(descriptions)) { codelistMap.Description = this.GetTextType(descriptions); } if (buildFrom.SourceRef != null) { if (buildFrom.SourceRef.TargetReference.EnumType == SdmxStructureEnumType.CodeList) { var refType = new CodelistRefType(); codelistMap.CodelistRef = refType; SetCodelistRefAttributes(refType, buildFrom.SourceRef); } else if (buildFrom.SourceRef.TargetReference.EnumType == SdmxStructureEnumType.HierarchicalCodelist) { var refType0 = new HierarchicalCodelistRefType(); codelistMap.HierarchicalCodelistRef = refType0; SetHclRefAttributes(refType0, buildFrom.SourceRef); } } if (buildFrom.TargetRef != null) { if (buildFrom.TargetRef.TargetReference.EnumType == SdmxStructureEnumType.CodeList) { var refType1 = new CodelistRefType(); codelistMap.TargetCodelistRef = refType1; SetCodelistRefAttributes(refType1, buildFrom.TargetRef); } else if (buildFrom.TargetRef.TargetReference.EnumType == SdmxStructureEnumType.HierarchicalCodelist) { var refType2 = new HierarchicalCodelistRefType(); codelistMap.TargetHierarchicalCodelistRef = refType2; SetHclRefAttributes(refType2, buildFrom.TargetRef); } } IList<IItemMap> itemMapBeans = buildFrom.Items; if (ObjectUtil.ValidCollection(itemMapBeans)) { /* foreach */ foreach (IItemMap itemMapBean in itemMapBeans) { var codeMaptype = new CodeMapType(); codelistMap.CodeMap.Add(codeMaptype); string value1 = itemMapBean.SourceId; if (!string.IsNullOrWhiteSpace(value1)) { codeMaptype.MapCodeRef = itemMapBean.SourceId; } string value = itemMapBean.TargetId; if (!string.IsNullOrWhiteSpace(value)) { codeMaptype.MapTargetCodeRef = itemMapBean.TargetId; } } } if (this.HasAnnotations(buildFrom)) { codelistMap.Annotations = this.GetAnnotationsType(buildFrom); } }
/// <summary> /// The process category scheme map. /// </summary> /// <param name="structureSetType"> /// The structure set type. /// </param> /// <param name="buildFrom"> /// The build from. /// </param> private void ProcessCategorySchemeMap(StructureSetType structureSetType, ICategorySchemeMapObject buildFrom) { var catSchemeMap = new CategorySchemeMapType(); structureSetType.CategorySchemeMap = catSchemeMap; string value = buildFrom.Id; if (!string.IsNullOrWhiteSpace(value)) { catSchemeMap.id = buildFrom.Id; } IList<ITextTypeWrapper> names = buildFrom.Names; if (ObjectUtil.ValidCollection(names)) { catSchemeMap.Name = this.GetTextType(names); } IList<ITextTypeWrapper> descriptions = buildFrom.Descriptions; if (ObjectUtil.ValidCollection(descriptions)) { catSchemeMap.Description = this.GetTextType(descriptions); } if (buildFrom.SourceRef != null) { var catRefType = new CategorySchemeRefType(); catSchemeMap.CategorySchemeRef = catRefType; SetCategorySchemeRefAttributes(catRefType, buildFrom.SourceRef); } if (buildFrom.TargetRef != null) { var catRefType0 = new CategorySchemeRefType(); catSchemeMap.TargetCategorySchemeRef = catRefType0; SetCategorySchemeRefAttributes(catRefType0, buildFrom.TargetRef); } IList<ICategoryMap> categoryMapBeans = buildFrom.CategoryMaps; if (ObjectUtil.ValidCollection(categoryMapBeans)) { /* foreach */ foreach (ICategoryMap categoryMapBean in categoryMapBeans) { var categoryMapType = new CategoryMapType(); catSchemeMap.CategoryMap.Add(categoryMapType); string value1 = categoryMapBean.Alias; if (!string.IsNullOrWhiteSpace(value1)) { categoryMapType.categoryAlias = categoryMapBean.Alias; } if (categoryMapBean.SourceId != null) { var categoryIdType = new CategoryIDType(); categoryMapType.CategoryID = categoryIdType; SetCategoryIdAttributes(categoryIdType, categoryMapBean.SourceId); } if (categoryMapBean.TargetId != null) { var categoryIdType1 = new CategoryIDType(); categoryMapType.TargetCategoryID = categoryIdType1; SetCategoryIdAttributes(categoryIdType1, categoryMapBean.TargetId); } } } if (this.HasAnnotations(buildFrom)) { catSchemeMap.Annotations = this.GetAnnotationsType(buildFrom); } }
/// <summary> /// Build <see cref="StructureSetType"/> from <paramref name="buildFrom"/>. /// </summary> /// <param name="buildFrom"> /// The source SDMX Object. /// </param> /// <returns> /// The <see cref="StructureSetType"/> from <paramref name="buildFrom"/> . /// </returns> public StructureSetType Build(IStructureSetObject buildFrom) { var builtObj = new StructureSetType(); // MAINTAINABLE ATTRIBUTES string str0 = buildFrom.AgencyId; if (!string.IsNullOrWhiteSpace(str0)) { builtObj.agencyID = buildFrom.AgencyId; } string str1 = buildFrom.Id; if (!string.IsNullOrWhiteSpace(str1)) { builtObj.id = buildFrom.Id; } if (buildFrom.Uri != null) { builtObj.uri = buildFrom.Uri; } else if (buildFrom.StructureUrl != null) { builtObj.uri = buildFrom.StructureUrl; } else if (buildFrom.ServiceUrl != null) { builtObj.uri = buildFrom.StructureUrl; } builtObj.urn = buildFrom.Urn; string str3 = buildFrom.Version; if (!string.IsNullOrWhiteSpace(str3)) { builtObj.version = buildFrom.Version; } if (buildFrom.StartDate != null) { builtObj.validFrom = buildFrom.StartDate.Date; } if (buildFrom.EndDate != null) { builtObj.validTo = buildFrom.EndDate.Date; } IList<ITextTypeWrapper> names = buildFrom.Names; if (ObjectUtil.ValidCollection(names)) { builtObj.Name = this.GetTextType(names); } IList<ITextTypeWrapper> descriptions = buildFrom.Descriptions; if (ObjectUtil.ValidCollection(descriptions)) { builtObj.Description = this.GetTextType(descriptions); } if (this.HasAnnotations(buildFrom)) { builtObj.Annotations = this.GetAnnotationsType(buildFrom); } if (buildFrom.IsExternalReference.IsSet()) { builtObj.isExternalReference = buildFrom.IsExternalReference.IsTrue; } if (buildFrom.IsFinal.IsSet()) { builtObj.isFinal = buildFrom.IsFinal.IsTrue; } // MAPS ProcessRelatedStructures(builtObj, buildFrom); if (buildFrom.StructureMapList != null) { /* foreach */ foreach (IStructureMapObject each in buildFrom.StructureMapList) { this.ProcessStructureMap(builtObj, each); } } if (buildFrom.CodelistMapList != null) { /* foreach */ foreach (ICodelistMapObject each0 in buildFrom.CodelistMapList) { this.ProcessCodelistMap(builtObj, each0); } } if (buildFrom.CategorySchemeMapList != null) { /* foreach */ foreach (ICategorySchemeMapObject each1 in buildFrom.CategorySchemeMapList) { this.ProcessCategorySchemeMap(builtObj, each1); } } if (buildFrom.ConceptSchemeMapList != null) { /* foreach */ foreach (IConceptSchemeMapObject each2 in buildFrom.ConceptSchemeMapList) { this.ProcessConceptSchemeMap(builtObj, each2); } } if (buildFrom.OrganisationSchemeMapList != null) { /* foreach */ foreach (IOrganisationSchemeMapObject each3 in buildFrom.OrganisationSchemeMapList) { this.ProcessOrganisationSchemeMap(builtObj, each3); } } return builtObj; }
/// <summary> /// Process related structures. /// </summary> /// <param name="structureSetType"> /// The structure set type. /// </param> /// <param name="buildFrom"> /// The build from. /// </param> private static void ProcessRelatedStructures(StructureSetType structureSetType, IStructureSetObject buildFrom) { if (buildFrom.RelatedStructures != null) { var relatedStructuresType = new RelatedStructuresType(); structureSetType.RelatedStructures = relatedStructuresType; IRelatedStructures relatedStructures = buildFrom.RelatedStructures; // KEY FAMILY REF foreach (ICrossReference xref in relatedStructures.DataStructureRef) { var keyFamilyRefType = new KeyFamilyRefType(); relatedStructuresType.KeyFamilyRef.Add(keyFamilyRefType); SetDataStructureRefAttributes(keyFamilyRefType, xref); } // METADATA STRUCTURE REF foreach (ICrossReference ref0 in relatedStructures.MetadataStructureRef) { var refType = new MetadataStructureRefType(); relatedStructuresType.MetadataStructureRef.Add(refType); SetMetadataStructureRefAttributes(refType, ref0); } // CONCEPT SCHEME REF foreach (ICrossReference ref1 in relatedStructures.ConceptSchemeRef) { var refType2 = new ConceptSchemeRefType(); relatedStructuresType.ConceptSchemeRef.Add(refType2); SetConceptSchemeRefAttributes(refType2, ref1); } // CATEGORY SCHEME REF foreach (ICrossReference ref3 in relatedStructures.CategorySchemeRef) { var refType4 = new CategorySchemeRefType(); relatedStructuresType.CategorySchemeRef.Add(refType4); SetCategorySchemeRefAttributes(refType4, ref3); } // ORGANISATION SCHEME REF foreach (ICrossReference ref5 in relatedStructures.OrgSchemeRef) { var refType6 = new OrganisationSchemeRefType(); relatedStructuresType.OrganisationSchemeRef.Add(refType6); SetOrganisationSchemeRefAttributes(refType6, ref5); } // HCL REF foreach (ICrossReference ref7 in relatedStructures.HierCodelistRef) { var refType8 = new HierarchicalCodelistRefType(); relatedStructuresType.HierarchicalCodelistRef.Add(refType8); SetHclRefAttributes(refType8, ref7); } } }