コード例 #1
0
 public ArtefactNodeInfo(string WsId, BaseComponentInfo ArtComponentInfo, ArtefactType artTypeInfo, string DataFlowID)
 {
     webServiceID          = WsId;
     artType               = artTypeInfo;
     artefactInfo          = null;
     artefactComponentInfo = ArtComponentInfo;
     dataFlowID            = DataFlowID;
 }
コード例 #2
0
        public List <BaseComponentInfo> GetSubSetList(string subsetId)
        {
            try
            {
                string queryString = VTLSqlStatement.SubSetList;

                IDataReader reader = _provider.ExecuteReaderWithParam(queryString, "ID", subsetId, DbType.String);
                if (reader == null)
                {
                    throw new Exception("Database connection failed");
                }

                var posValueId    = reader.GetOrdinal("ITEM_ID");
                var posValueSeqId = reader.GetOrdinal("ITEM_SEQ_ID");
                var posLocale     = reader.GetOrdinal("LANGUAGE");
                var posLabel      = reader.GetOrdinal("LABEL");

                string valueId    = String.Empty;
                string valueIdOld = string.Empty;
                string valueSeqId = string.Empty;
                string label      = String.Empty;
                string locale     = String.Empty;

                string vtlOld = String.Empty;
                string vtlNew = String.Empty;
                List <BaseComponentInfo> components = new List <BaseComponentInfo>();
                BaseComponentInfo        tmpVal     = null;
                List <LocalizedValue>    names      = null;

                valueId = null;
                while (reader.Read())
                {
                    valueId    = reader.GetString(posValueId);
                    valueSeqId = reader.GetInt32(posValueSeqId).ToString();

                    if (valueId != valueIdOld)
                    {
                        tmpVal = new BaseComponentInfo()
                        {
                            vtlId = valueId, seq_id = valueSeqId
                        };
                        names       = new List <LocalizedValue>();
                        tmpVal.name = names;
                    }

                    label  = reader.GetString(posLabel);
                    locale = reader.GetString(posLocale);

                    names.Add(new LocalizedValue {
                        lang = locale, value = label
                    });

                    if (valueId != valueIdOld)
                    {
                        components.Add(tmpVal);
                    }
                    valueIdOld = valueId;
                }

                return(components);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #3
0
        private void cm_ItemImportClicked(object sender, System.EventArgs e)
        {
            try
            {
                TreeNode                     tmpNode = (TreeNode)((MenuItem)sender).Tag;
                ArtefactNodeInfo             artInfo = (ArtefactNodeInfo)tmpNode.Tag;
                VTLInt_Service.ServiceClient VTLMan  = VTLInt_ServiceManager.GetClient(CommonItem.CurrentSettings.InteractionWebService);

                MetadataLoader mtl = null;

                //VTLMan.LineCountEvent += LineCountEventManager;


                switch (artInfo.artType)
                {
                case ArtefactNodeInfo.ArtefactType.ValueDomains:
                    string vd_id      = artInfo.artefactInfo.sdmxId;
                    string vd_agency  = artInfo.artefactInfo.sdmxAgency;
                    string vd_version = artInfo.artefactInfo.sdmxVersion;

                    if (MessageBox.Show("Do you want import into the VTL database the codelist: \n " + vd_id + " " + vd_agency + " " + vd_version, "Import codelist", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        CommonItem.WaitOn();

                        mtl = new MetadataLoader(CommonItem.CurrentSettings.QueriesPath, new WebServiceLayer.classes.service.Net.WebServiceLayer(CommonItem.CurrentSettings, int.Parse(artInfo.webServiceID)));
                        List <BaseArtefactInfo> dsList = mtl.LoadCodelistCodes21(vd_id, vd_agency, vd_version);

                        VTLMan.InsertValueDomain(vd_id, vd_agency, vd_version, artInfo.artefactInfo.name.ToArray(), dsList.ToArray(), true, BaseArtefactInfo.CREATION_TYPE.SDMX_WS_UPLOAD, ArtefactInfo.VTL.VTL_Model.VTL_DATATYPE.String);

                        CommonItem.WaitOff();

                        MessageBox.Show("Value domain :" + vd_id + " " + vd_agency + " " + vd_version + " successufully imported", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        tmpNode.ForeColor = Color.Gray;
                    }

                    break;

                case ArtefactNodeInfo.ArtefactType.DataStructureComponents:
                    string[] globIdent = CommonConstant.splitGlobalID(((ArtefactInfo.model.DataStructureComponentInfo)(artInfo.artefactComponentInfo)).valuedomain_id);

                    string cmp_id      = globIdent[0];
                    string cmp_agency  = globIdent[1];
                    string cmp_version = globIdent[2];

                    CommonItem.WaitOn();

                    mtl = new MetadataLoader(CommonItem.CurrentSettings.QueriesPath, new WebServiceLayer.classes.service.Net.WebServiceLayer(CommonItem.CurrentSettings, int.Parse(artInfo.webServiceID)));
                    List <BaseArtefactInfo> cmpList = mtl.LoadCodelistCodes21(cmp_id, cmp_agency, cmp_version);

                    VTLMan.InsertValueDomain(cmp_id, cmp_agency, cmp_version, artInfo.artefactInfo.name.ToArray(), cmpList.ToArray(), true, BaseArtefactInfo.CREATION_TYPE.SDMX_WS_UPLOAD, ArtefactInfo.VTL.VTL_Model.VTL_DATATYPE.String);

                    CommonItem.WaitOff();

                    MessageBox.Show("Value domain :" + cmp_id + " " + cmp_agency + " " + cmp_version + " successufully imported", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    tmpNode.ForeColor = Color.Gray;
                    break;

                case ArtefactNodeInfo.ArtefactType.DataStructures:
                    string dsd_id      = artInfo.artefactInfo.sdmxId;
                    string dsd_agency  = artInfo.artefactInfo.sdmxAgency;
                    string dsd_version = artInfo.artefactInfo.sdmxVersion;
                    List <BaseArtefactInfo>  valueDomainValueList;
                    List <BaseComponentInfo> componentsList = new List <BaseComponentInfo>();

                    if (MessageBox.Show("Do you want import into the VTL database the Datastructure: \n " + dsd_id + " " + dsd_agency + " " + dsd_version + "\n and all the referenced artefacts?", "Import datastructure", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        CommonItem.WaitOn();
                        label1.Text = DateTime.Now.ToString();

                        mtl = new MetadataLoader(CommonItem.CurrentSettings.QueriesPath, new WebServiceLayer.classes.service.Net.WebServiceLayer(CommonItem.CurrentSettings, int.Parse(artInfo.webServiceID)));
                        List <BaseArtefactInfo> componentList = mtl.LoadDataStructuresComponents21(dsd_id, dsd_agency, dsd_version);

                        foreach (BaseComponentInfo comp in componentList[0].DataStructureDetails.Components)
                        {
                            BaseComponentInfo tmpComponentInfo     = new BaseComponentInfo();
                            ValueDomainInfoInDataStructure tmpInfo = new ValueDomainInfoInDataStructure();
                            string[] globalId = null;

                            tmpComponentInfo.vtlId = comp.vtlId;
                            tmpComponentInfo.name  = comp.name;
                            tmpComponentInfo.datastructure_id_ref = comp.datastructure_id_ref;
                            tmpComponentInfo.seq_id = comp.seq_id;

                            switch (((ArtefactInfo.model.DataStructureComponentInfo)(comp)).role)
                            {
                            case "Dimension":
                                tmpComponentInfo.Role = "Identifier";
                                if (!String.IsNullOrEmpty(((ArtefactInfo.model.DataStructureComponentInfo)(comp)).valuedomain_id))
                                {
                                    globalId = CommonConstant.splitGlobalID(((ArtefactInfo.model.DataStructureComponentInfo)(comp)).valuedomain_id);
                                }
                                break;

                            case "TimeDimension":
                                tmpComponentInfo.Role = "Identifier";
                                globalId = CommonConstant.splitGlobalID(CommonItem.CurrentSettings.TIME_PERIOD_default_valueDomainID);
                                break;

                            case "PrimaryMeasure":
                                tmpComponentInfo.Role = "Measure";
                                globalId = CommonConstant.splitGlobalID(CommonItem.CurrentSettings.OBS_default_valueDomainID);
                                break;
                            }

                            tmpInfo.vd_id      = globalId[0];
                            tmpInfo.vd_agency  = globalId[1];
                            tmpInfo.vd_version = globalId[2];

                            valueDomainValueList = mtl.LoadCodelistCodes21(globalId[0], globalId[1], globalId[2]);

                            if (valueDomainValueList != null)
                            {
                                tmpInfo.values = valueDomainValueList;
                            }

                            if (comp.name != null)
                            {
                                tmpInfo.names = comp.name;
                            }
                            else
                            {
                                tmpInfo.names = new List <LocalizedValue>();
                                tmpInfo.names.Add(new LocalizedValue("EN", comp.vtlId));
                            }

                            tmpComponentInfo.ValueDomainInfo = tmpInfo;

                            componentsList.Add(tmpComponentInfo);
                        }
                        try
                        {
                            VTLMan.InsertDataStructure(dsd_id, dsd_agency, dsd_version, artInfo.artefactInfo.name.ToArray(), componentsList.ToArray(), BaseArtefactInfo.CREATION_TYPE.SDMX_WS_UPLOAD);
                        }
                        catch (TimeoutException ext)
                        {
                            MessageBox.Show("Time out exception");
                            return;
                        }

                        label2.Text = DateTime.Now.ToString();
                        CommonItem.WaitOff();

                        MessageBox.Show("Data structures :" + dsd_id + " " + dsd_agency + " " + dsd_version + "  and all the linked components successufully imported", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        tmpNode.ForeColor = Color.Gray;
                    }
                    break;

                case ArtefactNodeInfo.ArtefactType.DataFlows:
                    string ref_dsd_id      = ((DataSetInfo)artInfo.artefactInfo).sdmx_DataStructure_id;
                    string ref_dsd_agency  = ((DataSetInfo)artInfo.artefactInfo).sdmx_DataStructure_agency;
                    string ref_dsd_version = ((DataSetInfo)artInfo.artefactInfo).sdmx_DataStructure_version;
                    string df_id           = ((DataSetInfo)artInfo.artefactInfo).sdmxId;
                    string df_agency       = ((DataSetInfo)artInfo.artefactInfo).sdmxAgency;
                    string df_version      = ((DataSetInfo)artInfo.artefactInfo).sdmxVersion;

                    List <BaseArtefactInfo>  ds_valueDomainValueList;
                    List <BaseComponentInfo> ds_componentsList = new List <BaseComponentInfo>();

                    if (MessageBox.Show("Do you want import into the VTL database the DataSet: \n " + df_id + " " + df_agency + " " + df_version + "\n and all the referenced artefacts?", "Import datastructure", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        CommonItem.WaitOn();
                        label1.Text = DateTime.Now.ToString();

                        mtl = new MetadataLoader(CommonItem.CurrentSettings.QueriesPath, new WebServiceLayer.classes.service.Net.WebServiceLayer(CommonItem.CurrentSettings, int.Parse(artInfo.webServiceID)));
                        List <BaseArtefactInfo> componentList = mtl.LoadDataStructuresComponents21(ref_dsd_id, ref_dsd_agency, ref_dsd_version);

                        BaseComponentInfo tmpInfo;
                        ValueDomainInfoInDataStructure tmpValueDomain;

                        foreach (BaseComponentInfo comp in componentList[0].DataStructureDetails.Components)
                        {
                            tmpInfo       = new BaseComponentInfo();
                            tmpInfo.vtlId = comp.vtlId;
                            tmpInfo.name  = comp.name;
                            string[] globalId = null;


                            switch (((ArtefactInfo.model.DataStructureComponentInfo)(comp)).role)
                            {
                            case "Dimension":
                                tmpInfo.Role = "Identifier";
                                if (!String.IsNullOrEmpty(((ArtefactInfo.model.DataStructureComponentInfo)(comp)).valuedomain_id))
                                {
                                    globalId = CommonConstant.splitGlobalID(((ArtefactInfo.model.DataStructureComponentInfo)(comp)).valuedomain_id);
                                }
                                break;

                            case "TimeDimension":
                                tmpInfo.Role = "Identifier";
                                globalId     = CommonConstant.splitGlobalID(CommonItem.CurrentSettings.TIME_PERIOD_default_valueDomainID);
                                break;

                            case "PrimaryMeasure":
                                tmpInfo.Role = "Measure";
                                globalId     = CommonConstant.splitGlobalID(CommonItem.CurrentSettings.OBS_default_valueDomainID);
                                break;
                            }
                            tmpValueDomain = new ValueDomainInfoInDataStructure();

                            tmpValueDomain.vd_id      = globalId[0];
                            tmpValueDomain.vd_agency  = globalId[1];
                            tmpValueDomain.vd_version = globalId[2];

                            if (comp.name != null)
                            {
                                tmpValueDomain.names = comp.name;
                            }
                            else
                            {
                                tmpValueDomain.names = new List <LocalizedValue>();
                                tmpValueDomain.names.Add(new LocalizedValue("EN", comp.vtlId));
                            }

                            ds_valueDomainValueList = mtl.LoadCodelistCodes21(globalId[0], globalId[1], globalId[2]);

                            if (ds_valueDomainValueList != null)
                            {
                                tmpValueDomain.values = ds_valueDomainValueList;
                            }

                            tmpInfo.ValueDomainInfo = tmpValueDomain;
                            ds_componentsList.Add(tmpInfo);
                        }
                        try
                        {
                            VTLMan.InsertDataSet(ref_dsd_id, ref_dsd_agency, ref_dsd_version, df_id, df_agency, df_version, artInfo.artefactInfo.name.ToArray(), ds_componentsList.ToArray(), BaseArtefactInfo.CREATION_TYPE.SDMX_WS_UPLOAD);
                        }
                        catch (TimeoutException ds_ext)
                        {
                            MessageBox.Show("Time out exception");
                            return;
                        }

                        label2.Text = DateTime.Now.ToString();
                        CommonItem.WaitOff();

                        MessageBox.Show("Data set :" + df_id + " " + df_agency + " " + df_version + "  and all the linked components successufully imported", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        tmpNode.ForeColor = Color.Gray;
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                CommonItem.ErrManger.ErrorManagement(ex, false, this);
            }
            finally
            {
                CommonItem.WaitOff();
            }
        }