public static ICodelistObject GetConceptSchemeItems(SDMXIdentifier sdmxKey)
        {
            ISdmxMutableObjectRetrievalManager manager = GetManager();

            IMaintainableRefObject query = new MaintainableRefObjectImpl(sdmxKey.agencyid, sdmxKey.id, sdmxKey.version);

            Org.Sdmxsource.Sdmx.SdmxObjects.Model.Mutable.Codelist.CodelistMutableCore codelist =
                new Org.Sdmxsource.Sdmx.SdmxObjects.Model.Mutable.Codelist.CodelistMutableCore();

            codelist.Id = sdmxKey.id;
            codelist.AgencyId = sdmxKey.agencyid;
            codelist.Version = sdmxKey.version;
            codelist.StructureType = Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureType.GetFromEnum(Org.Sdmxsource.Sdmx.Api.Constants.SdmxStructureEnumType.CodeList);
            //codelist.StartDate = codelist.EndDate = DateTime.Now;
            codelist.FinalStructure = Org.Sdmxsource.Sdmx.Api.Constants.TertiaryBool.GetFromEnum(Org.Sdmxsource.Sdmx.Api.Constants.TertiaryBoolEnumType.True);

            IConceptSchemeMutableObject concepts = manager.GetMutableConceptScheme(query, false, false);

            foreach (ITextTypeWrapper IText in concepts.ImmutableInstance.Names)
                codelist.Names.Add(new Org.Sdmxsource.Sdmx.SdmxObjects.Model.Mutable.Base.TextTypeWrapperMutableCore(IText));
            foreach (ITextTypeWrapper IText in concepts.ImmutableInstance.Descriptions)
                codelist.Descriptions.Add(new Org.Sdmxsource.Sdmx.SdmxObjects.Model.Mutable.Base.TextTypeWrapperMutableCore(IText));

            foreach (IConceptObject concept in concepts.ImmutableInstance.Items)
            {

                Org.Sdmxsource.Sdmx.SdmxObjects.Model.Mutable.Codelist.CodeMutableCore code =
                    new Org.Sdmxsource.Sdmx.SdmxObjects.Model.Mutable.Codelist.CodeMutableCore();

                code.Id = concept.Id;
                code.ParentCode = concept.ParentConcept;

                foreach (ITextTypeWrapper IText in concept.Names)
                    code.Names.Add(new Org.Sdmxsource.Sdmx.SdmxObjects.Model.Mutable.Base.TextTypeWrapperMutableCore(IText));
                foreach (ITextTypeWrapper IText in concept.Descriptions)
                    code.Descriptions.Add(new Org.Sdmxsource.Sdmx.SdmxObjects.Model.Mutable.Base.TextTypeWrapperMutableCore(IText));

                codelist.AddItem(code);

            }
            return codelist.ImmutableInstance;
        }
Exemple #2
0
        private ICodelistObject GenerateTimePeriodCodelist(IDataflowObject DataFlowItem, IDimension timeDimension)
        {
            try
            {
                Org.Sdmxsource.Sdmx.Api.Model.Mutable.Codelist.ICodelistMutableObject codelist = new Org.Sdmxsource.Sdmx.SdmxObjects.Model.Mutable.Codelist.CodelistMutableCore();
                codelist.Id       = "CL_TIME_PERIOD";
                codelist.AgencyId = DataFlowItem.AgencyId;
                codelist.Version  = "1.0";
                codelist.AddName("en", "Time Dimension Start and End periods");

                codelist.CreateItem("1950", "Start Time Period");
                codelist.CreateItem(DateTime.Now.Year.ToString(), "End Time Period");

                return(codelist.ImmutableInstance);
            }
            catch (Exception e)
            {
                throw new Exception("[GetDataDLL.Model.ApplicationModel.MetadataLoader.extraceStructureArtefact] - " + e.Message);
            }
        }