示例#1
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);
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DsdRetrievalEngine"/> class.
        ///     Initializes a new instance of the <see cref="DataflowRetrievalEngine"/> class.
        /// </summary>
        /// <param name="mappingStoreDb">
        /// The mapping store DB.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="mappingStoreDb"/> is null.
        /// </exception>
        public DsdRetrievalEngine(Database mappingStoreDb)
            : base(mappingStoreDb)
        {
            var sqlQueryBuilder = new ReferencedSqlQueryBuilder(this.MappingStoreDb, null);

            this._attributeGroupQueryInfo    = sqlQueryBuilder.Build(DsdConstant.AttributeAttachmentGroupQueryFormat);
            this._attributeMeasureQueryInfo  = sqlQueryBuilder.Build(DsdConstant.AttributeAttachmentMeasureQueryFormat);
            this._groupQueryInfo             = sqlQueryBuilder.Build(DsdConstant.GroupQueryFormat);
            this._attributeDimensionRefsInfo = sqlQueryBuilder.Build(DsdConstant.AttributeDimensionFormat);
            this._componentQueryInfo         = sqlQueryBuilder.Build(DsdConstant.ComponentQueryFormat);
            this._componentQueryInfo.OrderBy = DsdConstant.ComponentOrderBy;
            this._commandBuilder             = new ItemCommandBuilder(this.MappingStoreDb);

            this._componentAnnotationRetrieverEngine = new IdentifiableAnnotationRetrieverEngine(
                mappingStoreDb,
                new ItemTableInfo(SdmxStructureEnumType.Component)
            {
                ForeignKey = "DSD_ID", PrimaryKey = "COMP_ID", Table = "COMPONENT"
            });

            this._groupAnnotationRetrieverEngine = new IdentifiableAnnotationRetrieverEngine(
                mappingStoreDb,
                new ItemTableInfo(SdmxStructureEnumType.Group)
            {
                ForeignKey = "DSD_ID", PrimaryKey = "GR_ID", Table = "DSD_GROUP"
            });
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ItemSchemeRetrieverEngine{TMaintaible,TItem}"/> class.
        /// </summary>
        /// <param name="mappingStoreDb">
        /// The mapping store DB.
        /// </param>
        /// <param name="orderBy">
        /// The order By.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="mappingStoreDb"/> is null
        /// </exception>
        protected ItemSchemeRetrieverEngine(Database mappingStoreDb, string orderBy = null)
            : base(mappingStoreDb, orderBy)
        {
            this._itemCommandBuilder = new ItemCommandBuilder(mappingStoreDb);
            var       itemTableInfoBuilder = new ItemTableInfoBuilder();
            TableInfo tableInfo            = new TableInfoBuilder().Build(typeof(TMaintaible));
            var       itemTableInfo        = itemTableInfoBuilder.Build(tableInfo.StructureType);
            var       itemSqlQueryBuilder  = new ItemSqlQueryBuilder(mappingStoreDb, null);

            this._itemSqlQueryInfo = itemSqlQueryBuilder.Build(itemTableInfo);

            this._identifiableAnnotationRetrieverEngine = new IdentifiableAnnotationRetrieverEngine(mappingStoreDb, itemTableInfo);
        }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HierarchicalCodeListRetrievealEngine"/> class.
        /// </summary>
        /// <param name="mappingStoreDb">
        /// The mapping store DB.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="mappingStoreDb"/> is null.
        /// </exception>
        public HierarchicalCodeListRetrievealEngine(Database mappingStoreDb)
            : base(mappingStoreDb)
        {
            var sqlQueryBuilder = new ReferencedSqlQueryBuilder(this.MappingStoreDb, null);

            this._hierarchyQueryInfo   = sqlQueryBuilder.Build(HclConstant.HierarchyQueryFormat);
            this._codelistRefQueryInfo = sqlQueryBuilder.Build(HclConstant.CodelistRefQueryFormat);
            this._codeRefQueryInfo     = sqlQueryBuilder.Build(HclConstant.CodeRefQueryFormat);
            this._levelQueryInfo       = sqlQueryBuilder.Build(HclConstant.LevelQueryFormat);
            this._itemCommandBuilder   = new ItemCommandBuilder(this.MappingStoreDb);

            this._hierarchalCodeAnnotationRetrieverEngine = new IdentifiableAnnotationRetrieverEngine(mappingStoreDb, new ItemTableInfo(SdmxStructureEnumType.HierarchicalCode)
            {
                ForeignKey = "H_ID", PrimaryKey = "HCODE_ID", Table = "HCL_CODE"
            });
            this._levelAnnotationRetrieverEngine = new IdentifiableAnnotationRetrieverEngine(mappingStoreDb, new ItemTableInfo(SdmxStructureEnumType.HierarchicalCode)
            {
                ForeignKey = "H_ID", PrimaryKey = "LEVEL_ID", Table = "HLEVEL"
            });
            this._hierarchyAnnotationRetrieverEngine = new IdentifiableAnnotationRetrieverEngine(mappingStoreDb, new ItemTableInfo(SdmxStructureEnumType.HierarchicalCode)
            {
                ForeignKey = "HCL_ID", PrimaryKey = "H_ID", Table = "HIERARCHY"
            });
        }