Example #1
0
        /// <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);
                IFLAGManager      _FlagManager      = new FlyDotStat_implementation.Manager.Metadata.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 Contrain of Dimension from database
        /// </summary>
        /// <param name="dimension">Instance of Dimension "DimensionConcept"</param>
        /// <returns>list of Mutable Code Object</returns>
        public List <ICodeMutableObject> GetDimensionCodelistNoContrain(IDimensionConcept dimension)
        {
            try
            {
                if (this.DbAccess.CheckExistStoreProcedure(DBOperationEnum.GetDimensionCodelistNOConstrain))
                {
                    if (dimension.DimensionType == DimensionTypeEnum.Time)
                    {
                        return(new List <ICodeMutableObject>());
                    }
                    if (dimension.DimensionType == DimensionTypeEnum.Frequency)
                    {
                        if (dimension.IsFakeFrequency)
                        {
                            SpecialCodelistsManager sp = new SpecialCodelistsManager(this.parsingObject, this.versionTypeResp);
                            return(sp.GetFrequencyCodelist());
                        }
                        else
                        {
                            return(InternalGetDimensionCodelistNOConstrain(dimension.CodelistCode));
                        }
                    }

                    return(InternalGetDimensionCodelistNOConstrain(dimension.CodelistCode));
                }
                else
                {
                    if (FlyConfiguration.CodelistWhitoutConstrain)
                    {
                        IDataflowsManager         dfMan    = new MetadataFactory().InstanceDataflowsManager(this.parsingObject.CloneForReferences(), this.versionTypeResp);
                        List <ICodeMutableObject> listCode = new List <ICodeMutableObject>();
                        var _foundedDataflow = dfMan.GetDataFlows();
                        List <SdmxObjectNameDescription> nomiDf = new List <SdmxObjectNameDescription>();
                        foreach (var df in _foundedDataflow)
                        {
                            string                   dfCode = df.Id;
                            DimensionManager         dim    = new DimensionManager(this.parsingObject, this.versionTypeResp);
                            List <IDimensionConcept> conc   = dim.GetDimensionConceptObjects(dfCode, out nomiDf);
                            if (conc.Exists(c => c.Id == dimension.Id))
                            {
                                foreach (ICodeMutableObject item in GetDimensionCodelistContrain(dfCode, conc.Find(c => c.Id == dimension.Id)))
                                {
                                    if (!listCode.Exists(cl => cl.Id == item.Id))
                                    {
                                        listCode.Add(item);
                                    }
                                }
                            }
                        }
                        return(listCode);
                    }
                    else
                    {
                        throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.CodelistContrainRequired);
                    }
                }
            }
            catch (SdmxException) { throw; }
            catch (Exception ex)
            {
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.CreateICodeMutableObject, ex);
            }
        }