/// <summary> /// Create a list of Concept object in Dataflow /// </summary> /// <param name="_dataflowCode">Dataflow Code</param> /// <returns>list of ConceptObjectImpl</returns> public List <IConceptObjectImpl> GetConceptList(string _dataflowCode) { try { List <IConceptObjectImpl> _concepts = new List <IConceptObjectImpl>(); IDimensionManager _DimensionManager = new DimensionManager(this.parsingObject, this.versionTypeResp); List <SdmxObjectNameDescription> _names; List <IDimensionConcept> _dimensions = _DimensionManager.GetDimensionConceptObjects(_dataflowCode, out _names); this.ConceptSchemeNames = _names; if (this.versionTypeResp == SdmxSchemaEnumType.VersionTwoPointOne) {//Modifico il nome del Concept Time IDimensionConcept timedim = _dimensions.Find(x => x.DimensionType == DimensionTypeEnum.Time); timedim.RealNameTime = timedim.ConceptObjectCode; timedim.ConceptObjectCode = "TIME_PERIOD"; timedim.Id = "TIME_PERIOD"; } if (_dimensions != null && _dimensions.Count > 0) { _concepts.AddRange(_dimensions); } IAttributeManager _AttributeManager = new AttributeManagerSP(this.parsingObject, this.versionTypeResp); if (!this.DbAccess.CheckExistStoreProcedure(DBOperationEnum.GetAttributes)) { _AttributeManager = new AttributeManager_FromFile(this.parsingObject, this.versionTypeResp); } IFLAGManager _FlagManager = new FLAGManager(this.parsingObject, this.versionTypeResp); IConceptObjectImpl _flag = _FlagManager.GetFlag(); if (_flag != null) { _concepts.Add(_flag); } List <IAttributeConcept> _attributes = _AttributeManager.GetAttribute(_dataflowCode); if (_attributes != null && _attributes.Count > 0) { _concepts.AddRange(_attributes); } _concepts.Add(_AttributeManager.GetObsValue()); return(_concepts); } catch (SdmxException) { throw; } catch (Exception ex) { throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.GetConceptsScheme, ex); } }
/// <summary> /// retrieves the codelist of an attribute from SP Attribute codelist NoConstrain or from the file "AttributeConcept.xml" /// </summary> /// <param name="attribute">Instance of Attribute "AttributeConcept"</param> /// <returns>list of Mutable Code Object</returns> public List <ICodeMutableObject> GetAttributeCodelistNoConstrain(IAttributeConcept attribute) { if (!this.DbAccess.CheckExistStoreProcedure(DBOperationEnum.GetAttributeCodelistConstrain)) { return(AttributeCodelistFromFile(attribute)); } else if (!FlyConfiguration.CodelistWhitoutConstrain) { throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.CodelistContrainRequired); } else { IDataflowsManager dfMan = new MetadataFactory().InstanceDataflowsManager(this.parsingObject.CloneForReferences(), this.versionTypeResp); List <ICodeMutableObject> listCode = new List <ICodeMutableObject>(); var _foundedDataflow = dfMan.GetDataFlows(); foreach (var df in _foundedDataflow) { string dfCode = df.Id; IAttributeManager _AttributeManager = new AttributeManagerSP(this.parsingObject, this.versionTypeResp); if (!this.DbAccess.CheckExistStoreProcedure(DBOperationEnum.GetAttributes)) { _AttributeManager = new AttributeManager_FromFile(this.parsingObject, this.versionTypeResp); } List <IAttributeConcept> conc = _AttributeManager.GetAttribute(dfCode); if (conc.Exists(c => c.Id == attribute.Id)) { foreach (ICodeMutableObject item in GetAttributeCodelistConstrain(dfCode, conc.Find(c => c.Id == attribute.Id))) { if (!listCode.Exists(cl => cl.Id == item.Id)) { listCode.Add(item); } } } } return(listCode); } }