/// <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); }
/// <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> /// 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); } }