/// <summary>
        /// retrieves the codelist Contrain of Dimension from database
        /// </summary>
        /// <param name="DataflowCode">Dataflow Code</param>
        /// <param name="dimension">Instance of Dimension "DimensionConcept"</param>
        /// <returns>list of Mutable Code Object</returns>
        public List <ICodeMutableObject> GetDimensionCodelistContrain(string DataflowCode, IDimensionConcept dimension)
        {
            try
            {
                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(DataflowCode));
                    }
                    else
                    {
                        return(InternalGetDimensionCodelistConstrain(DataflowCode, dimension.RealNameFreq));
                    }
                }

                return(InternalGetDimensionCodelistConstrain(DataflowCode, dimension.ConceptObjectCode));
            }
            catch (SdmxException) { throw; }
            catch (Exception ex)
            {
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.CreateICodeMutableObject, ex);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Create a list of Code that compose a Codelist
        /// </summary>
        /// <param name="_dataFlowCode">Dataflow Code</param>
        /// <param name="_concept">Concept Object</param>
        /// <returns>List of ICodeMutableObject</returns>
        public List <ICodeMutableObject> GetCodelist(string _dataFlowCode, IConceptObjectImpl _concept)
        {
            try
            {
                DimensionCodelistsManager cm = new DimensionCodelistsManager(this.parsingObject, this.versionTypeResp);
                AttributeCodelistsManager at = new AttributeCodelistsManager(this.parsingObject, this.versionTypeResp);
                FLAGCodelistManager       fl = new FLAGCodelistManager(this.parsingObject, this.versionTypeResp);
                SpecialCodelistsManager   sp = new SpecialCodelistsManager(this.parsingObject, this.versionTypeResp);

                switch (_concept.ConceptType)
                {
                case ConceptTypeEnum.Dimension:
                    if (string.IsNullOrEmpty(_dataFlowCode))
                    {
                        return(cm.GetDimensionCodelistNoContrain(_concept as IDimensionConcept));
                    }
                    else
                    {
                        return(cm.GetDimensionCodelistContrain(_dataFlowCode, _concept as IDimensionConcept));
                    }

                case ConceptTypeEnum.Attribute:
                    if (((IAttributeConcept)_concept).IsFlagAttribute)
                    {
                        return(fl.GetFlagCodelist(_dataFlowCode, _concept as IAttributeConcept));
                    }
                    else if (!((IAttributeConcept)_concept).IsValueAttribute)
                    {
                        if (string.IsNullOrEmpty(_dataFlowCode))
                        {
                            return(at.GetAttributeCodelistNoConstrain(_concept as IAttributeConcept));
                        }
                        else
                        {
                            return(at.GetAttributeCodelistConstrain(_dataFlowCode, _concept as IAttributeConcept));
                        }
                    }
                    break;

                case ConceptTypeEnum.Special:
                    return(sp.GetSpecialCodelist(_dataFlowCode, _concept as ISpecialConcept));
                }
                return(null);
            }
            catch (SdmxException) { throw; }
            catch (Exception ex)
            {
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.GetCodelist, 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 (FlyConfiguration.CodelistWhitoutConstrain)
         {
             if (dimension.IsFakeFrequency)
             {
                 SpecialCodelistsManager sp = new SpecialCodelistsManager(this.parsingObject, this.versionTypeResp);
                 return(sp.GetFrequencyCodelist());
             }
             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);
     }
 }