Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="artefact"></param>
        /// <param name="sysId"></param>
        private void GetCodeListMapCrossReference(IStructureSetMutableObject artefact, ICodelistMapMutableObject clm, long sysId)
        {
            var inParameter = MappingStoreDb.CreateInParameter(ParameterNameConstants.IdParameter, DbType.Int64, sysId);

            using (DbCommand command = MappingStoreDb.GetSqlStringCommandParam(StructureSetConstant.SqlCLMReference, inParameter))
            {
                using (IDataReader dataReader = this.MappingStoreDb.ExecuteReader(command))
                {
                    if (dataReader.Read())
                    {
                        IStructureReference sourceRef;
                        IStructureReference targetRef;

                        string s_ID, s_Agency, s_Version;
                        string t_ID, t_Agency, t_Version;

                        s_ID      = dataReader["S_ID"].ToString();
                        s_Agency  = dataReader["S_AGENCY"].ToString();
                        s_Version = dataReader["S_Version"].ToString();

                        t_ID      = dataReader["T_ID"].ToString();
                        t_Agency  = dataReader["T_AGENCY"].ToString();
                        t_Version = dataReader["T_Version"].ToString();

                        sourceRef = new StructureReferenceImpl(s_Agency, s_ID, s_Version, SdmxStructureEnumType.CodeList, "");
                        targetRef = new StructureReferenceImpl(t_Agency, t_ID, t_Version, SdmxStructureEnumType.CodeList, "");

                        clm.SourceRef = sourceRef;
                        clm.TargetRef = targetRef;
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="artefact"></param>
        /// <param name="sysId"></param>
        /// <returns></returns>
        private bool GetCodeListMapInfo(IStructureSetMutableObject artefact, long sysId)
        {
            // add for estat annotation
            this._identifiableAnnotationRetrieverEngine = new IdentifiableAnnotationRetrieverEngine(_mappingStoreDb, StructureSetConstant.CLMItemTableInfo);
            var itemMap = new Dictionary <long, ICodelistMapMutableObject>();

            var inParameter = MappingStoreDb.CreateInParameter(ParameterNameConstants.IdParameter, DbType.Int64, sysId);
            //AnnotationRetrievalEngine annRetrieval = new AnnotationRetrievalEngine(MappingStoreDb, StructureSetConstant.TableInfo, StructureSetConstant.CLMItemTableInfo, AnnotationCommandBuilder.AnnotationType.Item, sysId);

            bool clmFound = false;

            using (DbCommand command = MappingStoreDb.GetSqlStringCommandParam(StructureSetConstant.SqlCLMInfo, inParameter))
            {
                using (IDataReader dataReader = this.MappingStoreDb.ExecuteReader(command))
                {
                    int    txtIdx  = dataReader.GetOrdinal("TEXT");
                    int    langIdx = dataReader.GetOrdinal("LANGUAGE");
                    int    typeIdx = dataReader.GetOrdinal("TYPE");
                    long   clmID   = 0;
                    string ID;
                    long   currCLM = 0;

                    ICodelistMapMutableObject clm = null;

                    while (dataReader.Read())
                    {
                        clmFound = true;
                        clmID    = (long)dataReader["ITEM_ID"];
                        if (clmID != currCLM)
                        {
                            if (clm != null)
                            {
                                GetCLMItemAndReference(artefact, clm, currCLM);
                            }

                            clm    = new CodelistMapMutableCore();
                            ID     = dataReader["ID"].ToString();
                            clm.Id = ID;
                            //annRetrieval.AddAnnotation(clm, clmID);

                            // add for estat annotation
                            itemMap.Add(clmID, clm);

                            currCLM = clmID;
                        }

                        ReadLocalisedString(clm, typeIdx, txtIdx, langIdx, dataReader);
                    }

                    if (clm != null)
                    {
                        GetCLMItemAndReference(artefact, clm, currCLM);
                    }
                }
            }

            // add for estat annotation
            this.IdentifiableAnnotationRetrieverEngine.RetrieveAnnotations(sysId, itemMap);
            return(clmFound);
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="artefact"></param>
        /// <param name="sysId"></param>
        private void PopulateCubeRegion(IContentConstraintMutableObject artefact, long sysId)
        {
            var inParameter = MappingStoreDb.CreateInParameter(ParameterNameConstants.IdParameter, DbType.Int64, sysId);

            using (DbCommand command = MappingStoreDb.GetSqlStringCommandParam(ContentConstraintConstant.SqlConsItem, inParameter))
            {
                using (IDataReader dataReader = this.MappingStoreDb.ExecuteReader(command))
                {
                    string keyValueIDCurr    = String.Empty;
                    string componentTypeCurr = String.Empty;

                    artefact.IncludedCubeRegion = new CubeRegionMutableCore();

                    IKeyValuesMutable key = null;

                    while (dataReader.Read())
                    {
                        if (dataReader["CUBE_REGION_KEY_VALUE_ID"].ToString() != keyValueIDCurr)
                        {
                            if (key != null)
                            {
                                if (componentTypeCurr == "Attribute")
                                {
                                    artefact.IncludedCubeRegion.AddAttributeValue(key);
                                }
                                if (componentTypeCurr == "Dimension")
                                {
                                    artefact.IncludedCubeRegion.AddKeyValue(key);
                                }
                            }

                            keyValueIDCurr    = dataReader["CUBE_REGION_KEY_VALUE_ID"].ToString();
                            componentTypeCurr = dataReader["COMPONENT_TYPE"].ToString();

                            key = new KeyValuesMutableImpl();
                        }

                        if (String.IsNullOrEmpty(key.Id))
                        {
                            key.Id = dataReader["MEMBER_ID"].ToString();
                        }

                        key.AddValue(dataReader["MEMBER_VALUE"].ToString());
                    }

                    if (componentTypeCurr == "Attribute")
                    {
                        artefact.IncludedCubeRegion.AddAttributeValue(key);
                    }
                    if (componentTypeCurr == "Dimension")
                    {
                        artefact.IncludedCubeRegion.AddKeyValue(key);
                    }
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="artefact"></param>
        /// <param name="sysId"></param>
        private void PopulateConstraintGeneral(IContentConstraintMutableObject artefact, long sysId)
        {
            var inParameter = MappingStoreDb.CreateInParameter(ParameterNameConstants.IdParameter, DbType.Int64, sysId);

            using (DbCommand command = MappingStoreDb.GetSqlStringCommandParam(ContentConstraintConstant.SqlConsInfo, inParameter))
            {
                using (IDataReader dataReader = this.MappingStoreDb.ExecuteReader(command))
                {
                    bool bGeneral = true;

                    artefact.ReleaseCalendar      = new ReleaseCalendarMutableCore();
                    artefact.ConstraintAttachment = new ContentConstraintAttachmentMutableCore();

                    while (dataReader.Read())
                    {
                        if (bGeneral)
                        {
                            if (dataReader["PERIODICITY"] != DBNull.Value)
                            {
                                artefact.ReleaseCalendar.Periodicity = dataReader["PERIODICITY"].ToString();
                            }

                            if (dataReader["OFFSET"] != DBNull.Value)
                            {
                                artefact.ReleaseCalendar.Offset = dataReader["OFFSET"].ToString();
                            }

                            if (dataReader["TOLERANCE"] != DBNull.Value)
                            {
                                artefact.ReleaseCalendar.Tolerance = dataReader["TOLERANCE"].ToString();
                            }

                            if (String.IsNullOrEmpty(artefact.ReleaseCalendar.Periodicity))
                            {
                                artefact.ReleaseCalendar = null;
                            }

                            bGeneral = false;
                        }


                        IStructureReference structRef = new StructureReferenceImpl(dataReader["AGENCY"].ToString(),
                                                                                   dataReader["ID"].ToString(), dataReader["VERSION"].ToString(),
                                                                                   SdmxStructureType.GetFromEnum((SdmxStructureEnumType)Enum.Parse(typeof(SdmxStructureEnumType), dataReader["ARTEFACT_TYPE"].ToString())),
                                                                                   new string[] { });

                        artefact.ConstraintAttachment.AddStructureReference(structRef);
                    }
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="artefact"></param>
        /// <param name="sysId"></param>
        private void GetCodeListMapItems(IStructureSetMutableObject artefact, ICodelistMapMutableObject clm, long sysId)
        {
            var inParameter = MappingStoreDb.CreateInParameter(ParameterNameConstants.IdParameter, DbType.Int64, sysId);

            using (DbCommand command = MappingStoreDb.GetSqlStringCommandParam(StructureSetConstant.SqlCLMItem, inParameter))
            {
                using (IDataReader dataReader = this.MappingStoreDb.ExecuteReader(command))
                {
                    ItemMapMutableCore clmItem;

                    while (dataReader.Read())
                    {
                        clmItem = new ItemMapMutableCore();

                        clmItem.SourceId = dataReader["S_ID"].ToString();
                        clmItem.TargetId = dataReader["T_ID"].ToString();

                        clm.AddItem(clmItem);
                    }
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="artefact"></param>
        /// <param name="sysId"></param>
        private void GetStructureMapItems(IStructureSetMutableObject artefact, IStructureMapMutableObject sm, long sysId)
        {
            var inParameter = MappingStoreDb.CreateInParameter(ParameterNameConstants.IdParameter, DbType.Int64, sysId);

            using (DbCommand command = MappingStoreDb.GetSqlStringCommandParam(StructureSetConstant.SqlSMItem, inParameter))
            {
                using (IDataReader dataReader = this.MappingStoreDb.ExecuteReader(command))
                {
                    ComponentMapMutableCore smComp;

                    while (dataReader.Read())
                    {
                        smComp = new ComponentMapMutableCore();

                        smComp.MapConceptRef       = dataReader["S_ID"].ToString();
                        smComp.MapTargetConceptRef = dataReader["T_ID"].ToString();

                        sm.AddComponent(smComp);
                    }
                }
            }
        }