/// <summary> /// Initialie a new instance of the <see cref="RetrievalManager"/> class. /// </summary> /// <param name="_dataFlowID"> /// Dataflow ID /// </param> /// <param name="_versionType">Sdmx Version</param> public RetrievalManager(string _dataFlowID, SdmxSchemaEnumType _versionType) { try { this.DataFlowID = _dataFlowID; this.VersionType = _versionType; DataStructureEngineObject ds = new DataStructureEngineObject(); ISDMXObjectBuilder Builder = ds.CreateBuilder(new SdmxParsingObject(SdmxStructureEnumType.Dataflow) { MaintainableId = DataFlowID, References = StructureReferenceDetailEnumType.Specific, SpecificReference = new List <SdmxStructureType>() { SdmxStructureType.GetFromEnum(SdmxStructureEnumType.Dsd), SdmxStructureType.GetFromEnum(SdmxStructureEnumType.ConceptScheme), }, QueryDetail = StructureQueryDetailEnumType.Full, }, _versionType); Builder.Build(); Builder.AddReferences(); if (Builder._KeyFamily == null || Builder._KeyFamily.Count == 0) { throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.InternalError, new Exception(string.Format("Dsd Not found for Dataflow code: {0}", DataFlowID))); } //1DF = 1DSD this._dsd = Builder._KeyFamily[0]; if (Builder._Dataflows.Count > 0) { this.DataFlowTitle = Builder._Dataflows[0].Name; } else { throw new Exception("No Dataflow Found"); } this._sdmxObjects = Builder.CreateDSD(); this.DataFlowID = Builder._Dataflows[0].Id; GetGroups(); } catch (SdmxException) { throw; } catch (Exception ex) { throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.InternalError, ex); //non sono riuscito a cambiare il nome che è arrivato dalla query con quello effettivo della dsd } }
/// <summary> /// Entrypoint of class FlyEngine that processes the request /// and produces a response or an error /// </summary> /// <param name="_parsingObject">Processed request</param> /// <param name="_versionType">Sdmx Version</param> public void Engine(ISdmxParsingObject _parsingObject, SdmxSchemaEnumType _versionType) { try { this.VersionTypeResp = _versionType; //IDBAccess DbAccess = new DWHAccess(FlyConfiguration.ConnectionString); _parsingObject.PreliminarCheck(); FlyLog.WriteLog(this, FlyLog.LogTypeEnum.All, "Query Preliminar Check passed. Start creation of SDMXObject"); Builder = CreateBuilder(_parsingObject, _versionType); if (Builder == null) { throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.NotSupportedRegistryType, new Exception(_parsingObject.SdmxStructureType.ToString())); } FlyLog.WriteLog(this, FlyLog.LogTypeEnum.All, "Parsing Metadata: {0}", _parsingObject.SdmxStructureType.ToString()); Builder.Build(); ParseOtherRegistry(_parsingObject); Builder.AddReferences(); } catch (SdmxException sdmxerr) { HaveError = true; ErrorMessage = sdmxerr; } catch (Exception err) { HaveError = true; ErrorMessage = new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.InternalError, err); } }
private void ParseOtherRegistry(ISdmxParsingObject _parsingObject) { if (_parsingObject.OtherRegistry != null && _parsingObject.OtherRegistry.Count > 0) { foreach (var _parsingOther in _parsingObject.OtherRegistry) { ISDMXObjectBuilder OtherRegistry = CreateBuilder(_parsingOther, this.VersionTypeResp); if (OtherRegistry == null) { FlyLog.WriteLog(this, FlyLog.LogTypeEnum.Error, "NotSupportedRegistryType (Other Registry) SdmxStructureType {0}", _parsingOther.SdmxStructureType.ToString()); continue; } FlyLog.WriteLog(this, FlyLog.LogTypeEnum.All, "Parsing Metadata (Other Registry): {0}", _parsingOther.SdmxStructureType.ToString()); OtherRegistry.Build(); switch (_parsingOther.SdmxStructureType) { case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.Dataflow: if (Builder._Dataflows == null || Builder._Dataflows.Count == 0) { Builder._Dataflows = OtherRegistry._Dataflows; } else { Builder._Dataflows.AddRange(OtherRegistry._Dataflows); } break; case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.ConceptScheme: if (Builder._Conceptscheme == null || Builder._Conceptscheme.Count == 0) { Builder._Conceptscheme = OtherRegistry._Conceptscheme; } else { Builder._Conceptscheme.AddRange(OtherRegistry._Conceptscheme); } break; case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.CodeList: if (Builder._Codelists == null || Builder._Codelists.Count == 0) { Builder._Codelists = OtherRegistry._Codelists; } else { Builder._Codelists.AddRange(OtherRegistry._Codelists); } break; case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.AgencyScheme: case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.OrganisationScheme: Builder._AgencyScheme = OtherRegistry._AgencyScheme; break; case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.CategoryScheme: case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.Categorisation: if (Builder._CategorisationObject == null || Builder._CategorisationObject.Count == 0) { Builder._CategorisationObject = OtherRegistry._CategorisationObject; } else { Builder._CategorisationObject.AddRange(OtherRegistry._CategorisationObject); } break; case Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.Dsd: if (Builder._KeyFamily == null || Builder._KeyFamily.Count == 0) { Builder._KeyFamily = OtherRegistry._KeyFamily; } else { Builder._KeyFamily.AddRange(OtherRegistry._KeyFamily); } break; } } } }