/// <summary>
        /// retrieves the DSD from database
        /// </summary>
        /// <param name="refObj">Referenced Objects</param>
        /// <returns>list of DataStructure for SDMXObject</returns>
        public List <DataStructureObjectImpl> GetDSDsReferences(IReferencesObject refObj)
        {
            try
            {
                if (refObj.FoundedDataflows == null)
                {
                    return(GetDSDs());
                }

                ReferencesObject.DSDs = new List <DataStructureObjectImpl>();
                if (ReferencesObject.Codelists == null)
                {
                    ReferencesObject.Codelists = new List <ICodelistMutableObject>();
                }
                if (ReferencesObject.Concepts == null)
                {
                    ReferencesObject.Concepts = new Dictionary <string, List <IConceptObjectImpl> >();
                }
                foreach (var df in refObj.FoundedDataflows)
                {
                    ReferencesObject.DSDs.Add(BuildDataStructure(df.Id));
                }
                return(ReferencesObject.DSDs);
            }
            catch (SdmxException) { throw; }
            catch (Exception ex)
            {
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.BuildDSD, ex);
            }
        }
        /// <summary>
        /// Build a DataFlows
        /// </summary>
        /// <returns>list of IDataflowObject for SdmxObject</returns>
        public List <IDataflowObject> GetDataFlows()
        {
            if (ReferencesObject == null)
            {
                ReferencesObject = new IReferencesObject();
            }

            ReferencesObject.FoundedDataflows = new List <IDataflowObject>();


            string DataflowCodeMaintenableId = this.parsingObject.MaintainableId;

            MSDataflows = GetDataflows();
            for (int i = MSDataflows.Count - 1; i >= 0; i--)
            {
                MSDataflow item = MSDataflows[i];
                if ((!string.IsNullOrEmpty(DataflowCodeMaintenableId)) && item.DFCode.Trim().ToUpper() != DataflowCodeMaintenableId.Trim().ToUpper())
                {
                    MSDataflows.RemoveAt(i);
                    continue;
                }

                DataflowBuilder dfbuilder = dfbuilder = new DataflowBuilder(item.DFCode, item.Descr, this.parsingObject, this.versionTypeResp);
                //DsdManager dsdMan = new DsdManager(this.parsingObject.CloneForReferences(), this.versionTypeResp);
                dfbuilder.DataStrunctureRef = item.GetDataStrunctureRef(MSDataflows[i].DsdCode, MSDataflows[i].DsdAgency, MSDataflows[i].DsdVersion);
                ReferencesObject.FoundedDataflows.Add(dfbuilder.BuildDataflow(item.DFAgency, item.DFVersion));
            }

            return(ReferencesObject.FoundedDataflows);
        }
예제 #3
0
        /// <summary>
        /// Build a CategoryScheme
        /// </summary>
        /// <returns>ICategorySchemeObject for SdmxObject</returns>
        public List <ICategorySchemeObject> GetCategoryScheme()
        {
            if (ReferencesObject == null)
            {
                ReferencesObject = new IReferencesObject();
            }

            CategorySchemeBuilder _CategorySchemeBuilder = new CategorySchemeBuilder(this.parsingObject, this.versionTypeResp);

            if (_categoryschemeMapping == null)
            {
                _categorisationMapping = new List <InternalDatasetObject>();
                _categoryschemeMapping = CreateCategoryObjects(out _categorisationMapping);
            }

            if (!parsingObject.ReturnStub)
            {
                List <ICategoryMutableObject> CategoriesHierarchy = RecursiveCreateCategoryHierarchy(_categoryschemeMapping);
                this.ReferencesObject.CategoryScheme = new List <ICategorySchemeObject>()
                {
                    _CategorySchemeBuilder.BuildCategorySchemeObject(CategoriesHierarchy)
                };
            }
            else
            {
                this.ReferencesObject.CategoryScheme = new List <ICategorySchemeObject>()
                {
                    _CategorySchemeBuilder.BuildCategorySchemeObject(null)
                };
            }
            return(this.ReferencesObject.CategoryScheme);
        }
예제 #4
0
        /// <summary>
        /// Build a DataFlows
        /// </summary>
        /// <returns>list of IDataflowObject for SdmxObject</returns>
        public List <IDataflowObject> GetDataFlows()
        {
            if (ReferencesObject == null)
            {
                ReferencesObject = new IReferencesObject();
            }


            ReferencesObject.FoundedDataflows = new List <IDataflowObject>();

            string DataflowCodeMaintenableId = this.parsingObject.MaintainableId;
            Dictionary <string, List <SdmxObjectNameDescription> > df = GetDataflows(DataflowCodeMaintenableId);
            List <DataflowBuilder> res = new List <DataflowBuilder>();

            foreach (var item in df)
            {
                if (string.IsNullOrEmpty(DataflowCodeMaintenableId) || item.Key.Trim().ToUpper() == DataflowCodeMaintenableId.Trim().ToUpper())
                {
                    res.Add(new DataflowBuilder(item.Key, item.Value, this.parsingObject, this.versionTypeResp));
                }
            }

            foreach (DataflowBuilder dfbuilder in res)
            {
                ReferencesObject.FoundedDataflows.Add(dfbuilder.BuildDataflow(FlyConfiguration.MainAgencyId, FlyConfiguration.Version));
            }

            return(ReferencesObject.FoundedDataflows);
        }
예제 #5
0
 /// <summary>
 /// Build a CategoryScheme
 /// </summary>
 /// <param name="refObj">Referenced Objects</param>
 /// <returns>ICategorySchemeObject for SdmxObject</returns>
 public List <ICategorySchemeObject> GetCategorySchemeReferences(IReferencesObject refObj)
 {
     if (refObj.CategoryScheme != null)
     {
         return(refObj.CategoryScheme);
     }
     return(GetCategoryScheme());
 }
예제 #6
0
 /// <summary>
 /// Build a Categorisation
 /// </summary>
 /// <param name="refObj">Referenced Objects</param>
 /// <returns>list of ICategorisationObject for SdmxObject</returns>
 public List <ICategorisationObject> GetCategorisationReferences(IReferencesObject refObj)
 {
     if (refObj.Categorisation != null)
     {
         return(refObj.Categorisation);
     }
     return(GetCategorisation());
 }
예제 #7
0
 /// <summary>
 /// Build a DataFlows
 /// </summary>
 /// <param name="refObj">Referenced Objects</param>
 /// <returns>list of IDataflowObject for SdmxObject</returns>
 public List <IDataflowObject> GetDataFlowsReferences(IReferencesObject refObj)
 {
     if (refObj.FoundedDataflows != null)
     {
         return(refObj.FoundedDataflows);
     }
     else
     {
         return(GetDataFlows());//Chiunque referenzia i dataflow gia li ha gia istanziati
     }
 }
예제 #8
0
        /// <summary>
        /// retrieves the codelist Contrain from database
        /// </summary>
        /// <returns>list of Mutable Code Object</returns>
        public List <ICodelistMutableObject> GetCodelistNoConstrain()
        {
            if (ReferencesObject == null)
            {
                ReferencesObject = new IReferencesObject();
            }


            if (ReferencesObject.FoundedDataflows == null || ReferencesObject.FoundedDataflows.Count == 0)
            {
                IDataflowsManager gdf = new MetadataFactory().InstanceDataflowsManager((ISdmxParsingObject)this.parsingObject.Clone(), this.versionTypeResp);
                gdf.parsingObject.MaintainableId  = null;
                ReferencesObject.FoundedDataflows = gdf.GetDataFlows();
            }

            if (ReferencesObject.FoundedDataflows == null || ReferencesObject.FoundedDataflows.Count == 0)
            {
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.DataflowNotFound, new Exception(this.parsingObject.ConstrainDataFlow));
            }

            if (ReferencesObject.Concepts == null)
            {
                ReferencesObject.Concepts = new Dictionary <string, List <IConceptObjectImpl> >();
            }
            foreach (var df in ReferencesObject.FoundedDataflows)
            {
                List <IConceptObjectImpl> concepts = new ConceptSchemeManager(this.parsingObject, this.versionTypeResp).GetConceptList(df.Id);
                ReferencesObject.Concepts.Add(string.Format(FlyConfiguration.ConceptSchemeFormat, df.Id), concepts);
                if (!string.IsNullOrEmpty(this.parsingObject.MaintainableId))
                {
                    FlyNameArtefactSettings fnas   = new FlyNameArtefactSettings(this.parsingObject);
                    string             ConceptCode = fnas.GetConceptCodeFromCodelist();
                    IConceptObjectImpl Concept     = concepts.Find(c => c.ConceptObjectCode.Trim().ToLower() == ConceptCode.Trim().ToLower());
                    if (Concept == null)
                    {
                        continue;
                    }

                    BuildCodelist(null, Concept);
                    break;
                }
                else
                {
                    foreach (var Concept in concepts)
                    {
                        BuildCodelist(null, Concept);
                    }
                }
            }
            return(ReferencesObject.Codelists);
        }
예제 #9
0
        /// <summary>
        /// Populate a list of Codelist property of SDMXObjectBuilder for insert this in DataStructure response
        /// Whitout Call all Dataflows and Concepts
        /// </summary>
        public void BuildCodelist(string DataFlowCode, IConceptObjectImpl Concept)
        {
            if (ReferencesObject == null)
            {
                ReferencesObject = new IReferencesObject();
            }


            if (Concept.ConceptType == ConceptTypeEnum.Dimension && ((IDimensionConcept)Concept).DimensionType == DimensionTypeEnum.Time)
            {
                return;
            }
            if (Concept.ConceptType == ConceptTypeEnum.Attribute && ((IAttributeConcept)Concept).IsValueAttribute)
            {
                return;
            }
            if (string.IsNullOrEmpty(Concept.CodelistCode))
            {
                return;
            }
            CodelistBuilder _CodelistBuilder = new CodelistBuilder(this.parsingObject, this.versionTypeResp);

            _CodelistBuilder.Code  = string.Format(FlyConfiguration.CodelistFormat, Concept.CodelistCode.Substring(3));
            _CodelistBuilder.Names = Concept.ConceptObjectNames;

            if (!this.parsingObject.ReturnStub)
            {
                _CodelistBuilder.CodesObjects = GetCodelist(DataFlowCode, Concept);
            }
            if (this.ReferencesObject.Codelists == null)
            {
                this.ReferencesObject.Codelists = new List <ICodelistMutableObject>();
            }

            if (this.ReferencesObject.Codelists.Exists(cl => cl.Id == _CodelistBuilder.Code))
            {
                _CodelistBuilder.AddItemto(this.ReferencesObject.Codelists.Find(cl => cl.Id == _CodelistBuilder.Code));
            }
            else
            {
                if (Concept == null || Concept.ConceptType != ConceptTypeEnum.Special)
                {
                    this.ReferencesObject.Codelists.Add(_CodelistBuilder.BuildCodelist(FlyConfiguration.MainAgencyId, FlyConfiguration.Version));
                }
                else
                {
                    this.ReferencesObject.Codelists.Add(_CodelistBuilder.BuildCodelist(this.parsingObject.AgencyId, this.parsingObject._version));
                }
            }
        }
예제 #10
0
        /// <summary>
        /// Build a CategoryScheme
        /// </summary>
        /// <returns>ICategorySchemeObject for SdmxObject</returns>
        public List <ICategorySchemeObject> GetCategoryScheme()
        {
            if (ReferencesObject == null)
            {
                ReferencesObject = new IReferencesObject();
            }

            if (ReferencesObject.CategoryScheme != null)
            {
                return(ReferencesObject.CategoryScheme);
            }

            GetAllCategoryInformation();

            return(ReferencesObject.CategoryScheme);
        }
예제 #11
0
        /// <summary>
        /// Build a Categorisation
        /// </summary>
        /// <returns>list of ICategorisationObject for SdmxObject</returns>
        public List <ICategorisationObject> GetCategorisation()
        {
            if (ReferencesObject == null)
            {
                ReferencesObject = new IReferencesObject();
            }

            if (ReferencesObject.Categorisation != null && ReferencesObject.Categorisation.Count > 0)
            {
                return(ReferencesObject.Categorisation);
            }

            GetAllCategoryInformation();

            return(ReferencesObject.Categorisation);
        }
예제 #12
0
        /// <summary>
        /// retrieves the codelist Contrain from database
        /// </summary>
        /// <param name="refObj">Referenced Objects</param>
        /// <returns>list of Mutable Code Object</returns>
        public List <ICodelistMutableObject> GetCodelistReferences(IReferencesObject refObj)
        {
            if (refObj.FoundedDataflows == null)
            {
                return(new List <ICodelistMutableObject>());
            }

            if (refObj.Concepts != null)
            {
                foreach (var df in refObj.FoundedDataflows)
                {
                    List <IConceptObjectImpl> concepts = new ConceptSchemeManager(this.parsingObject, this.versionTypeResp).GetConceptList(df.Id);
                    foreach (var Concept in concepts)
                    {
                        BuildCodelist(df.Id, Concept);
                    }
                }
            }
            else
            {
                foreach (var df in refObj.FoundedDataflows)
                {
                    string cs = string.Format(FlyConfiguration.ConceptSchemeFormat, df.Id);
                    if (refObj.Concepts.ContainsKey(cs))
                    {
                        foreach (var Concept in refObj.Concepts[cs])
                        {
                            BuildCodelist(df.Id, Concept);
                        }
                    }
                    else
                    {
                        BuildCodelist(df.Id);
                    }
                    foreach (List <IConceptObjectImpl> Concepts in refObj.Concepts.Values)
                    {
                        foreach (var Concept in Concepts)
                        {
                            BuildCodelist(df.Id, Concept);
                        }
                    }
                }
            }

            return(ReferencesObject.Codelists);
        }
        /// <summary>
        /// Build a ConceptSchemes
        /// </summary>
        /// <returns>list of IConceptSchemeObject for SdmxObject</returns>
        public List <IConceptSchemeObject> GetConceptSchemes()
        {
            try
            {
                if (ReferencesObject == null)
                {
                    ReferencesObject = new IReferencesObject();
                }

                this.ReferencesObject.ConceptSchemes = new List <IConceptSchemeObject>();
                this.ReferencesObject.Concepts       = new Dictionary <string, List <IConceptObjectImpl> >();


                //Cerco tutti i DataFlow Per Capire se esiste
                IDataflowsManager gdf = new MetadataFactory().InstanceDataflowsManager((ISdmxParsingObject)this.parsingObject.Clone(), this.versionTypeResp);
                gdf.parsingObject.MaintainableId = null;

                ReferencesObject.FoundedDataflows = gdf.GetDataFlows();
                if (!string.IsNullOrEmpty(this.parsingObject.MaintainableId))
                {
                    FlyNameArtefactSettings fnas = new FlyNameArtefactSettings(this.parsingObject);
                    string DataflowCode          = fnas.GetDataFlowCodeFromConceptSchema();
                    if (ReferencesObject.FoundedDataflows.Exists(d => d.Id.Trim().ToUpper() == DataflowCode.Trim().ToUpper()))
                    {
                        ReferencesObject.FoundedDataflows = new List <IDataflowObject>()
                        {
                            ReferencesObject.FoundedDataflows.Find(d => d.Id.Trim().ToUpper() == DataflowCode.Trim().ToUpper())
                        }
                    }
                    ;
                }

                foreach (var referenceDF in ReferencesObject.FoundedDataflows)
                {
                    BuildConcepts(referenceDF.Id);
                }

                return(ReferencesObject.ConceptSchemes);
            }
            catch (SdmxException) { throw; }
            catch (Exception ex)
            {
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.GetConceptsScheme, ex);
            }
        }
        /// <summary>
        /// Build a ConceptSchemes
        /// </summary>
        /// <param name="refObj">Referenced Objects</param>
        /// <returns>list of IConceptSchemeObject for SdmxObject</returns>
        public List <IConceptSchemeObject> GetConceptSchemesReferences(IReferencesObject refObj)
        {
            try
            {
                this.ReferencesObject.ConceptSchemes = new List <IConceptSchemeObject>();
                this.ReferencesObject.Concepts       = new Dictionary <string, List <IConceptObjectImpl> >();
                if (refObj.FoundedDataflows == null)
                {
                    return(this.ReferencesObject.ConceptSchemes);
                }

                if (refObj.Concepts == null)
                {
                    foreach (var referenceDF in refObj.FoundedDataflows)
                    {
                        BuildConcepts(referenceDF.Id);
                    }
                }
                else
                {
                    foreach (var referenceDF in refObj.FoundedDataflows)
                    {
                        string cs = string.Format(FlyConfiguration.ConceptSchemeFormat, referenceDF.Id);
                        if (refObj.Concepts.ContainsKey(cs))
                        {
                            BuildConcepts(referenceDF.Id, refObj.Concepts[cs]);
                        }
                        else
                        {
                            BuildConcepts(referenceDF.Id);
                        }
                    }
                }

                return(ReferencesObject.ConceptSchemes);
            }
            catch (SdmxException) { throw; }
            catch (Exception ex)
            {
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.GetConceptsScheme, ex);
            }
        }
예제 #15
0
        /// <summary>
        /// Build a Categorisation
        /// </summary>
        /// <returns>list of ICategorisationObject for SdmxObject</returns>
        public List <ICategorisationObject> GetCategorisation()
        {
            if (ReferencesObject == null)
            {
                ReferencesObject = new IReferencesObject();
            }

            CategorySchemeBuilder _CategorySchemeBuilder = new CategorySchemeBuilder(this.parsingObject, this.versionTypeResp);

            if (_categoryschemeMapping == null)
            {
                _categorisationMapping = new List <InternalDatasetObject>();
                _categoryschemeMapping = CreateCategoryObjects(out _categorisationMapping);
            }

            this.ReferencesObject.Categorisation = new List <ICategorisationObject>();
            foreach (InternalDatasetObject dfl in _categorisationMapping)
            {
                this.ReferencesObject.Categorisation.Add(_CategorySchemeBuilder.BuildCategorisation(dfl.Code, dfl.Agency, dfl.Version, dfl.CategoryParent));
            }
            return(this.ReferencesObject.Categorisation);
        }
 /// <summary>
 /// Build a DataFlows
 /// </summary>
 /// <param name="refObj">Referenced Objects</param>
 /// <returns>list of IDataflowObject for SdmxObject</returns>
 public List <IDataflowObject> GetDataFlowsReferences(IReferencesObject refObj)
 {
     if (refObj.FoundedDataflows != null)
     {
         return(refObj.FoundedDataflows);
     }
     else
     {
         List <IDataflowObject> dfs = GetDataFlows();
         if (refObj.DSDs != null)
         {
             for (int i = dfs.Count - 1; i >= 0; i--)
             {
                 if (!refObj.DSDs.Exists(dsd => dsd.Id == dfs[i].DataStructureRef.MaintainableId))
                 {
                     dfs.RemoveAt(i);
                 }
             }
         }
         return(dfs);
     }
 }
예제 #17
0
        /// <summary>
        /// retrieves the codelist Contrain  from database
        /// </summary>
        /// <returns>list of Mutable Code Object</returns>
        public List <ICodelistMutableObject> GetCodelistConstrain()
        {
            if (ReferencesObject == null)
            {
                ReferencesObject = new IReferencesObject();
            }

            if (ReferencesObject.FoundedDataflows == null || ReferencesObject.FoundedDataflows.Count == 0)
            {
                IDataflowsManager gdf = new MetadataFactory().InstanceDataflowsManager((ISdmxParsingObject)this.parsingObject.Clone(), this.versionTypeResp);
                gdf.parsingObject.MaintainableId  = null;
                ReferencesObject.FoundedDataflows = gdf.GetDataFlows();
            }

            if (ReferencesObject.FoundedDataflows == null || ReferencesObject.FoundedDataflows.Count == 0)
            {
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.DataflowNotFound, new Exception(this.parsingObject.ConstrainDataFlow));
            }

            if (ReferencesObject.Concepts == null)
            {
                ReferencesObject.Concepts = new Dictionary <string, List <IConceptObjectImpl> >();
            }

            IConceptObjectImpl Concept = null;
            SpecialTypeEnum    specType;

            if (!string.IsNullOrEmpty(this.parsingObject.MaintainableId) &&
                Enum.TryParse <SpecialTypeEnum>(this.parsingObject.MaintainableId.Trim().ToUpper(), out specType) &&
                this.parsingObject.AgencyId == "MA")
            {
                if (!string.IsNullOrEmpty(this.parsingObject.ConstrainConcept))
                {
                    Concept = new SpecialConcept(this.parsingObject.ConstrainConcept, specType);
                }
                else
                {
                    Concept = new SpecialConcept(specType.ToString(), specType);
                }
                Concept.CodelistCode = this.parsingObject.MaintainableId;
            }
            else
            {
                List <IConceptObjectImpl> concepts = new ConceptSchemeManager(this.parsingObject, this.versionTypeResp).GetConceptList(this.parsingObject.ConstrainDataFlow);
                ReferencesObject.Concepts.Add(string.Format(FlyConfiguration.ConceptSchemeFormat, this.parsingObject.ConstrainDataFlow), concepts);
                Concept = concepts.Find(c => c.ConceptObjectCode.Trim().ToLower() == this.parsingObject.ConstrainConcept.Trim().ToLower());
                if (Concept == null)
                {
                    throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.CodelistInvalid, new Exception(string.Format("Concept {0} Not Found in Dataflow {1}", this.parsingObject.ConstrainConcept, this.parsingObject.ConstrainDataFlow)));
                }

                if (this.parsingObject.ContrainConceptREF != null && this.parsingObject.ContrainConceptREF.Keys.Count > 0)
                {
                    ISpecialConcept sc = new SpecialConcept(Concept.Id, SpecialTypeEnum.CL_CONTRAINED);
                    sc.CodelistCode = Concept.CodelistCode;
                    sc.SetNames(Concept.ConceptObjectNames);
                    sc.TimeDimensionRef   = concepts.Find(c => c.ConceptType == ConceptTypeEnum.Dimension && ((IDimensionConcept)c).DimensionType == DimensionTypeEnum.Time);
                    sc.ContrainConceptREF = this.parsingObject.ContrainConceptREF;
                    Concept = sc;
                }
            }

            BuildCodelist(this.parsingObject.ConstrainDataFlow, Concept);
            return(ReferencesObject.Codelists);
        }
예제 #18
0
        /// <summary>
        /// retrieves the codelist Contrain from database
        /// </summary>
        /// <returns>list of Mutable Code Object</returns>
        public List <ICodelistMutableObject> GetCodelistNoConstrain()
        {
            if (ReferencesObject == null)
            {
                ReferencesObject = new IReferencesObject();
            }


            if (ReferencesObject.FoundedDataflows == null || ReferencesObject.FoundedDataflows.Count == 0)
            {
                IDataflowsManager gdf = new MetadataFactory().InstanceDataflowsManager((ISdmxParsingObject)this.parsingObject.Clone(), this.versionTypeResp);
                gdf.parsingObject.MaintainableId  = null;
                ReferencesObject.FoundedDataflows = gdf.GetDataFlows();
            }

            if (ReferencesObject.FoundedDataflows == null || ReferencesObject.FoundedDataflows.Count == 0)
            {
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.DataflowNotFound, new Exception(this.parsingObject.ConstrainDataFlow));
            }

            if (ReferencesObject.Concepts == null)
            {
                ReferencesObject.Concepts = new Dictionary <string, List <IConceptObjectImpl> >();
            }
            foreach (var df in ReferencesObject.FoundedDataflows)
            {
                List <IConceptObjectImpl> concepts = new ConceptSchemeManager(this.parsingObject, this.versionTypeResp).GetConceptList(df.Id);
                ReferencesObject.Concepts.Add(string.Format(FlyConfiguration.ConceptSchemeFormat, df.Id), concepts);
                if (!string.IsNullOrEmpty(this.parsingObject.MaintainableId))
                {
                    string PossibleDimTable = this.parsingObject.MaintainableId.Trim().ToUpper();
                    string PossibleAttTable = this.parsingObject.MaintainableId.Trim().ToUpper();
                    if (PossibleDimTable.StartsWith(FlyConfiguration.CodelistFormat.ToUpper().Replace("{0}", "")))
                    {
                        PossibleDimTable = string.Format("DIM{0}", PossibleDimTable.Substring(FlyConfiguration.CodelistFormat.ToUpper().Replace("{0}", "").Length));
                        PossibleAttTable = string.Format("ATT{0}", PossibleDimTable.Substring(FlyConfiguration.CodelistFormat.ToUpper().Replace("{0}", "").Length));
                    }
                    else if (PossibleDimTable.EndsWith(FlyConfiguration.CodelistFormat.ToUpper().Replace("{0}", "")))
                    {
                        PossibleDimTable = string.Format("DIM{0}", PossibleDimTable.Substring(0, PossibleDimTable.Length - FlyConfiguration.CodelistFormat.ToUpper().Replace("{0}", "").Length));
                        PossibleAttTable = string.Format("ATT{0}", PossibleDimTable.Substring(0, PossibleDimTable.Length - FlyConfiguration.CodelistFormat.ToUpper().Replace("{0}", "").Length));
                    }
                    IConceptObjectImpl Concept = concepts.Find(c => !string.IsNullOrEmpty(c.CodelistCode) && (c.CodelistCode.Trim().ToUpper() == PossibleDimTable || c.CodelistCode.Trim().ToUpper() == PossibleAttTable));
                    if (Concept == null)
                    {
                        continue;
                    }

                    BuildCodelist(null, Concept);
                    break;
                }
                else
                {
                    foreach (var Concept in concepts)
                    {
                        BuildCodelist(null, Concept);
                    }
                }
            }
            return(ReferencesObject.Codelists);
        }
        /// <summary>
        /// retrieves the DSD from database
        /// </summary>
        /// <returns>list of DataStructure for SDMXObject</returns>
        public List <DataStructureObjectImpl> GetDSDs()
        {
            try
            {
                if (ReferencesObject == null)
                {
                    ReferencesObject = new IReferencesObject();
                }

                if (ReferencesObject.DSDs != null)
                {
                    return(ReferencesObject.DSDs);
                }

                if (ReferencesObject.FoundedDataflows == null || ReferencesObject.FoundedDataflows.Count == 0)
                {
                    IDataflowsManager gdf = new MetadataFactory().InstanceDataflowsManager((ISdmxParsingObject)this.parsingObject.Clone(), this.versionTypeResp);
                    gdf.parsingObject.MaintainableId  = null;
                    ReferencesObject.FoundedDataflows = gdf.GetDataFlows();
                }

                if (ReferencesObject.FoundedDataflows == null || ReferencesObject.FoundedDataflows.Count == 0)
                {
                    throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.DataflowNotFound, new Exception(this.parsingObject.ConstrainDataFlow));
                }



                if (!string.IsNullOrEmpty(this.parsingObject.MaintainableId))
                {
                    FlyNameArtefactSettings fnas = new FlyNameArtefactSettings(this.parsingObject);
                    string DataFlowCode          = fnas.GetDataFlowCodeFromKeyFamily();
                    //Controllo se esiste il Dataflow
                    ReferencesObject.FoundedDataflows = new List <IDataflowObject>()
                    {
                        ReferencesObject.FoundedDataflows.Find(df => df.Id.Trim().ToUpper() == DataFlowCode.Trim().ToUpper())
                    };
                }

                if (ReferencesObject.FoundedDataflows == null)
                {
                    throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.DataflowNotFound);
                }

                ReferencesObject.DSDs = new List <DataStructureObjectImpl>();
                if (ReferencesObject.Codelists == null)
                {
                    ReferencesObject.Codelists = new List <ICodelistMutableObject>();
                }
                if (ReferencesObject.Concepts == null)
                {
                    ReferencesObject.Concepts = new Dictionary <string, List <IConceptObjectImpl> >();
                }
                foreach (var df in ReferencesObject.FoundedDataflows)
                {
                    ReferencesObject.DSDs.Add(BuildDSD(df));
                }
                return(ReferencesObject.DSDs);
            }
            catch (SdmxException) { throw; }
            catch (Exception ex)
            {
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.BuildDSD, ex);
            }
        }