public ValueDomainContainer(BaseArtefactInfo compInfo) { vtlID = compInfo.vtlId; componentObject = compInfo; isEnumerated = ((ArtefactInfo.model.ValueDomainInfo)compInfo).isEnumerated; restrictionText = ((ArtefactInfo.model.ValueDomainInfo)compInfo).value_restriction; }
public ArtefactNodeInfo(string WsId, BaseComponentInfo ArtComponentInfo, ArtefactType artTypeInfo, string DataFlowID) { webServiceID = WsId; artType = artTypeInfo; artefactInfo = null; artefactComponentInfo = ArtComponentInfo; dataFlowID = DataFlowID; }
private void UserDefinedValueDomainPanel_Load(object sender, EventArgs e) { EnumeratedPanel.Enabled = false; EnumeratedPanel.BackColor = Color.Gray; FillValueDomainListBox(); ValueDomainListComboBox.SelectedIndex = 0; _selectedParent = null; }
public List <BaseArtefactInfo> GetTransformationList() { IDataReader reader = null; try { string queryString = VTLSqlStatement.Trasformations; reader = _provider.ExecuteReader(queryString); List <BaseArtefactInfo> trasformationList = new List <BaseArtefactInfo>(); int transfId; string transfName; if (reader == null) { throw new Exception("Database connection failed"); } int pos_item_seq_id = reader.GetOrdinal("ARTEFACT_SEQ_ID"); int pos_transfID = reader.GetOrdinal("ARTEFACT_ID"); while (reader.Read()) { transfId = reader.GetInt32(pos_item_seq_id); transfName = reader.GetString(pos_transfID).Trim(); BaseArtefactInfo tmp = new BaseArtefactInfo(); tmp.vtlId = transfName; trasformationList.Add(tmp); } return(trasformationList); } catch (Exception ex) { throw new Exception(ex.Message); } finally { if (reader != null) { reader.Close(); } } }
private bool SwitchRecursive(TreeNode treeNode) { bool raiseError = false; if (treeNode.Tag != null) { BaseArtefactInfo bs = ((ArtefactNodeInfo)treeNode.Tag).artefactInfo; if (switchTreeView.isCode()) { if (bs.vtlId != null) { treeNode.Text = bs.vtlId; } else { treeNode.Text = bs.sdmxId; } } else if (bs.name == null) { raiseError = true; } else if (bs.name.Count == 0) { raiseError = true; } else { treeNode.Text = bs.name[0].value.ToString(); } } // Print each node recursively. foreach (TreeNode tn in treeNode.Nodes) { SwitchRecursive(tn); } return(raiseError); }
public void setEnumeratedDescribedView(bool Enumerated, BaseArtefactInfo artInfo) { try { DescribedPanel.Enabled = false; EnumeratedPanel.Enabled = false; if (Enumerated) { EnumeratedPanel.Enabled = true; ValueDomainListComboBox.SelectedIndex = ValueDomainListComboBox.FindStringExact(((ArtefactInfo.model.ValueDomainSubsetInfo)(artInfo)).vd_id_ref); VTLInt_Service.ServiceClient VTL_service = VTLInt_ServiceManager.GetClient(CommonItem.CurrentSettings.InteractionWebService); BaseComponentInfo[] values = VTL_service.GetSubSetList(((ArtefactInfo.model.ValueDomainSubsetInfo)(artInfo)).vtlId); foreach (BaseComponentInfo bs in values) { for (int i = 0; i < ValuesCheckedListBox.Items.Count; i++) { ValValueDomainObject vl = (ValValueDomainObject)ValuesCheckedListBox.Items[i]; if (vl.value_seq_id.ToString() == bs.seq_id) { ValuesCheckedListBox.SetItemCheckState(i, CheckState.Checked); } } } } else { DescribedPanel.Enabled = true; ValueDomainListComboBox.SelectedIndex = ValueDomainListComboBox.FindStringExact(((ArtefactInfo.model.ValueDomainSubsetInfo)(artInfo)).vd_id_ref + DESCRIBED_SUFFIX); DescribedCriterionTextBox.Text = ((ArtefactInfo.model.ValueDomainSubsetInfo)(artInfo)).set_criterion_id; } } catch (Exception) { throw; } }
public static List <BaseArtefactInfo> ParseDataStructureResponse(XmlDocument doc, string returnDetails) { List <BaseArtefactInfo> dataStructures = new List <BaseArtefactInfo>(); XDocument xDoc2 = RetrievingUtility.ToXDocument(doc); XNamespace ns = RetrievingUtility.NS_SDMX_STRUCTURE; switch (returnDetails) { case "Stub": XmlDocument docWithoutNSa = RetrievingUtility.RemoveXmlns(doc); XmlNodeList nodeList = docWithoutNSa.SelectNodes("//DataStructure"); foreach (XmlNode xmlNd in nodeList) { BaseArtefactInfo tmpBaseArtefact = new BaseArtefactInfo(); tmpBaseArtefact.sdmxId = xmlNd.Attributes["id"].Value; tmpBaseArtefact.sdmxAgency = xmlNd.Attributes["agencyID"].Value; tmpBaseArtefact.sdmxVersion = xmlNd.Attributes["version"].Value; tmpBaseArtefact.dataSource = "SUM"; tmpBaseArtefact.vtlId = String.Concat(new String[] { tmpBaseArtefact.sdmxId, RetrievingUtility.VTLID_SEPARATOR, tmpBaseArtefact.sdmxAgency, RetrievingUtility.VTLID_SEPARATOR, tmpBaseArtefact.sdmxVersion }); XmlNodeList nodeLocalizedListxml = xmlNd.SelectNodes("./Name"); tmpBaseArtefact.name = new List <LocalizedValue>(); foreach (XmlNode localString in nodeLocalizedListxml) { LocalizedValue tmpLocalized = new LocalizedValue(); tmpLocalized.lang = localString.Attributes["xml:lang"].Value; tmpLocalized.value = localString.InnerText; tmpBaseArtefact.name.Add(tmpLocalized); } XmlNodeList nodeLocalizedDescListxml = xmlNd.SelectNodes("./Description"); foreach (XmlNode localString in nodeLocalizedDescListxml) { LocalizedValue tmpLocalized = new LocalizedValue(); tmpBaseArtefact.name = new List <LocalizedValue>(); tmpLocalized.lang = localString.Attributes["xml:lang"].Value; tmpLocalized.value = localString.InnerText; tmpBaseArtefact.description.Add(tmpLocalized); } dataStructures.Add(tmpBaseArtefact); } //var dataStructs2 = (from x in xDoc2.Root.Descendants(ns + "DataStructure") // select // new BaseArtefactInfo // { // vtlId = String.Concat(new String[] { (string)x.Attribute("id"), VTLID_SEPARATOR, (string)x.Attribute("agencyID"), VTLID_SEPARATOR, (string)x.Attribute("version") }), // name = x.Elements("Name") // .Select(r => new LocalizedValue // { // lang = (string)r.Attribute("lang").Value, // value = (string)r.Value // }).ToList(), // description = x.Elements("Description") // .Select(r => new LocalizedValue // { // lang = (string)r.Attribute("lang").Value, // value = (string)r.Value // }).ToList(), // sdmxId = (string)x.Attribute("id"), // sdmxAgency = (string)x.Attribute("agencyID"), // sdmxVersion = (string)x.Attribute("version"), // dataSource = "SUM" // } // ).ToList(); //foreach (BaseArtefactInfo x in dataStructs2) //{ // dataStructures.Add(x); //} break; case "Full": goto case "CompleteStub"; case "CompleteStub": XmlDocument docWithoutNS = RetrievingUtility.RemoveXmlns(doc); //List DataStructure's Components XmlNodeList itemNodes = docWithoutNS.SelectNodes("//DataStructures"); BaseArtefactInfo baInfo = new BaseArtefactInfo(); foreach (XmlNode itemNode in itemNodes) { baInfo.sdmxId = itemNode.SelectSingleNode("DataStructure/@id").Value; baInfo.sdmxAgency = itemNode.SelectSingleNode("DataStructure/@agencyID").Value; baInfo.sdmxVersion = itemNode.SelectSingleNode("DataStructure/@version").Value; XmlNodeList listNames = itemNode.SelectNodes(".//Name"); List <LocalizedValue> names = new List <LocalizedValue>(); foreach (XmlNode i in listNames) { names.Add(new LocalizedValue() { lang = i.Attributes["xml:lang"].Value, value = i.InnerText }); } baInfo.name = names; //Add Dimensions XmlNodeList listDims = itemNode.SelectNodes("//DimensionList/Dimension"); List <BaseComponentInfo> compon = new List <BaseComponentInfo>(); int compCounter = 2; foreach (XmlNode dim in listDims) { compon.Add(new DataStructureComponentInfo() { vtlId = dim.Attributes["id"].Value, valuedomain_id = String.Format(RetrievingUtility.SDMX_ID_FORMAT, (string)dim.SelectSingleNode("LocalRepresentation/Enumeration/Ref/@id").Value, (string)dim.SelectSingleNode("LocalRepresentation/Enumeration/Ref/@agencyID").Value, (string)dim.SelectSingleNode("LocalRepresentation/Enumeration/Ref/@version").Value), role = "Dimension" }); compon.Last().name = new List <LocalizedValue>(); LocalizedValue tmpName = new LocalizedValue("EN", (string)dim.Attributes["id"].Value); compon.Last().name.Add(tmpName); //try{ // tmpcomp.name.Add(baInfo.name[compCounter]); // tmpcomp.name.Add(baInfo.name[compCounter + 1]); //}catch (Exception ex){} //compCounter+=2; } //Add TimeDimension XmlNode timeDim = itemNode.SelectSingleNode("//DimensionList/TimeDimension"); compon.Add(new DataStructureComponentInfo() { vtlId = timeDim.Attributes["id"].Value, role = "TimeDimension" }); //Add PrimaryMeasure XmlNode primaryDim = itemNode.SelectSingleNode("//MeasureList/PrimaryMeasure"); compon.Add(new DataStructureComponentInfo() { vtlId = primaryDim.Attributes["id"].Value, role = "PrimaryMeasure" }); //Add Attributes XmlNodeList listAttr = itemNode.SelectNodes("//DimensionList/Attribute"); foreach (XmlNode attr in listAttr) { compon.Add(new DataStructureComponentInfo() { vtlId = attr.Attributes["id"].Value, valuedomain_id = String.Format(RetrievingUtility.SDMX_ID_FORMAT, (string)attr.SelectSingleNode("LocalRepresentation/Enumeration/Ref/@id").Value, (string)attr.SelectSingleNode("LocalRepresentation/Enumeration/Ref/@agencyID").Value, (string)attr.SelectSingleNode("LocalRepresentation/Enumeration/Ref/@version").Value), role = "Attribute" }); } baInfo.DataStructureDetails.Components = compon; } dataStructures.Add(baInfo); break; } return(dataStructures); }
public static List <BaseArtefactInfo> ParseValueDomainResponse(XmlDocument doc, string returnDetails) { List <BaseArtefactInfo> codeLists = new List <BaseArtefactInfo>(); XDocument xDoc2 = RetrievingUtility.ToXDocument(doc); XNamespace ns = RetrievingUtility.NS_SDMX_STRUCTURE; XNamespace nsCommon = RetrievingUtility.NS_SDMX_21_COMMON; switch (returnDetails) { case "Stub": XmlDocument docWithoutNSa = RetrievingUtility.RemoveXmlns(doc); XmlNodeList nodeList = docWithoutNSa.SelectNodes("//Codelist"); foreach (XmlNode xmlNd in nodeList) { BaseArtefactInfo tmpBaseArtefact = new BaseArtefactInfo(); tmpBaseArtefact.sdmxId = xmlNd.Attributes["id"].Value; tmpBaseArtefact.sdmxAgency = xmlNd.Attributes["agencyID"].Value; tmpBaseArtefact.sdmxVersion = xmlNd.Attributes["version"].Value; tmpBaseArtefact.dataSource = "SUM"; tmpBaseArtefact.vtlId = String.Concat(new String[] { tmpBaseArtefact.sdmxId, RetrievingUtility.VTLID_SEPARATOR, tmpBaseArtefact.sdmxAgency, RetrievingUtility.VTLID_SEPARATOR, tmpBaseArtefact.sdmxVersion }); XmlNodeList nodeLocalizedListxml = xmlNd.SelectNodes("./Name"); tmpBaseArtefact.name = new List <LocalizedValue>(); foreach (XmlNode localString in nodeLocalizedListxml) { LocalizedValue tmpLocalized = new LocalizedValue(); tmpLocalized.lang = localString.Attributes["xml:lang"].Value; tmpLocalized.value = localString.InnerText; tmpBaseArtefact.name.Add(tmpLocalized); } XmlNodeList nodeLocalizedDescListxml = xmlNd.SelectNodes("./Description"); foreach (XmlNode localString in nodeLocalizedDescListxml) { LocalizedValue tmpLocalized = new LocalizedValue(); tmpBaseArtefact.name = new List <LocalizedValue>(); tmpLocalized.lang = localString.Attributes["xml:lang"].Value; tmpLocalized.value = localString.InnerText; tmpBaseArtefact.description.Add(tmpLocalized); } codeLists.Add(tmpBaseArtefact); } break; case "Full": goto case "CompleteStub"; case "CompleteStub": XmlDocument docWithoutNS = RetrievingUtility.RemoveXmlns(doc); //List DataStructure's Components XmlNodeList itemNodes = docWithoutNS.SelectNodes("//Codelist"); BaseArtefactInfo baInfo; foreach (XmlNode itemNode in itemNodes) { //baInfo.sdmxId = itemNode.SelectSingleNode("Codelist/@id").Value; //baInfo.sdmxAgency = itemNode.SelectSingleNode("Codelist/@agencyID").Value; //baInfo.sdmxVersion = itemNode.SelectSingleNode("Codelist/@version").Value; baInfo = new BaseArtefactInfo(); baInfo.sdmxId = itemNode.Attributes["id"].Value; baInfo.sdmxAgency = itemNode.Attributes["agencyID"].Value; baInfo.sdmxVersion = itemNode.Attributes["version"].Value; XmlNodeList listNames = itemNode.SelectNodes("Name"); List <LocalizedValue> names = new List <LocalizedValue>(); //foreach (XmlNode i in listNames) //{ for (int l = 0; l < listNames.Count; l++) { XmlNode i = listNames[l]; names.Add(new LocalizedValue() { lang = i.Attributes["xml:lang"].Value, value = i.InnerText }); } //} baInfo.name = names; //Add Dimensions XmlNodeList listCodes = itemNode.SelectNodes("Code"); List <BaseComponentInfo> compon = new List <BaseComponentInfo>(); baInfo.DataStructureDetails = new BaseArtefactInfo.DataStructureInformation(); foreach (XmlNode code in listCodes) { XmlNodeList lCodeNames = code.SelectNodes("./Name"); List <LocalizedValue> codenames = new List <LocalizedValue>(); foreach (XmlNode nodeCode in lCodeNames) { codenames.Add(new LocalizedValue() { lang = nodeCode.Attributes["xml:lang"].Value, value = nodeCode.InnerText }); } compon.Add(new BaseComponentInfo() { vtlId = code.Attributes["id"].Value, name = codenames }); } baInfo.DataStructureDetails.Components = compon; codeLists.Add(baInfo); } break; } return(codeLists); }
private void ValueDomainListComboBox_SelectedIndexChanged(object sender, EventArgs e) { try { BaseComponentInfo[] values; KeyValuePair <int, string>[] value_seq_id; DescribedCriterionTextBox.Clear(); valDomParentDescrTextBox.Clear(); ValuesCheckedListBox.Items.Clear(); if (this.ValueDomainListComboBox.SelectedItem.GetType().ToString() != "System.String") { ValueDomainContainer valCont = (ValueDomainContainer)this.ValueDomainListComboBox.SelectedItem; _selectedParent = valCont.componentObject; if (valCont.isEnumerated) { DescribedPanel.Enabled = false; DescribedPanel.BackColor = Color.Gray; EnumeratedPanel.Enabled = true; EnumeratedPanel.BackColor = Color.SteelBlue; VTLInt_Service.ServiceClient VTL_service = VTLInt_ServiceManager.GetClient(CommonItem.CurrentSettings.InteractionWebService); values = VTL_service.GetValueDomainValues(valCont.vtlID); value_seq_id = VTL_service.GetValueDomain_seq_id(valCont.vtlID); if (values.Count() == 0) { MessageBox.Show("No values found!", "Values missing", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } foreach (BaseComponentInfo val in values) { ValValueDomainObject tmpVal = new ValValueDomainObject(); tmpVal.name = val.name[0].value; tmpVal.Vtl_ID = val.vtlId; var tmpVar = from seq_id in value_seq_id where seq_id.Value == val.vtlId select seq_id.Key; tmpVal.value_seq_id = (int)tmpVar.First(); ValuesCheckedListBox.Items.Add(tmpVal); } } else { DescribedPanel.Enabled = true; DescribedPanel.BackColor = Color.SteelBlue; EnumeratedPanel.Enabled = false; EnumeratedPanel.BackColor = Color.Gray; valDomParentDescrTextBox.Text = valCont.restrictionText; } } else { _selectedParent = null; } } catch (Exception) { throw; } }
public List <BaseArtefactInfo> GetDataStructure() { //string strWhere = GetWhereCondition(id, version, agId); string queryString = VTLSqlStatement.DataStructure;// +strWhere; IDataReader reader = _provider.ExecuteReader(queryString); if (reader == null) { throw new Exception("Database connection failed"); } var posIdStruttura = reader.GetOrdinal("ARTEFACT_ID"); var posSdmxId = reader.GetOrdinal("SDMX_ID"); var posAgency = reader.GetOrdinal("SDMX_AGENCY"); var posVersion = reader.GetOrdinal("SDMX_VERSION"); var posLocale = reader.GetOrdinal("LANGUAGE"); var posLabel = reader.GetOrdinal("NAME"); var posCreationType = reader.GetOrdinal("CREATION_TYPE"); //var posFinal = reader.GetOrdinal("FINAL"); List <BaseArtefactInfo> l = new List <BaseArtefactInfo>(); string vtlOld = String.Empty; string vtlNew = String.Empty; string locale, label, vtlId, sdmxId, sdmxAg, sdmxVer; int creation_Type; bool bFirst = true; List <LocalizedValue> lv = null; BaseArtefactInfo dsi = null;; try { while (reader.Read()) { if (bFirst) { bFirst = false; vtlId = reader.GetString(posIdStruttura).Trim(); sdmxId = reader.GetString(posSdmxId).Trim(); sdmxAg = reader.GetString(posAgency).Trim(); sdmxVer = reader.GetString(posVersion).Trim(); locale = reader.GetString(posLocale).Trim(); label = reader.GetString(posLabel).Trim(); creation_Type = reader.GetInt32(posCreationType); dsi = new BaseArtefactInfo { vtlId = vtlId, sdmxId = sdmxId, sdmxAgency = sdmxAg, sdmxVersion = sdmxVer, dataSource = "VTL", creationType = creation_Type }; lv = new List <LocalizedValue>(); lv.Add(new LocalizedValue { lang = locale, value = label }); vtlOld = vtlId; } else { vtlId = reader.GetString(posIdStruttura).TrimEnd(); if (!String.Equals(vtlOld, vtlId)) { dsi.name = lv; l.Add(dsi); sdmxId = reader.GetString(posSdmxId).Trim(); sdmxAg = reader.GetString(posAgency).Trim(); sdmxVer = reader.GetString(posVersion).Trim(); creation_Type = reader.GetInt32(posCreationType); dsi = new BaseArtefactInfo { vtlId = vtlId, sdmxId = sdmxId, sdmxAgency = sdmxAg, sdmxVersion = sdmxVer, dataSource = "VTL", creationType = creation_Type }; lv = new List <LocalizedValue>(); vtlOld = vtlId; } locale = reader.GetString(posLocale).Trim(); label = reader.GetString(posLabel).Trim(); lv.Add(new LocalizedValue { lang = locale, value = label }); } } if (lv == null) { return(null); } dsi.name = lv; l.Add(dsi); } catch (Exception ex) { throw new Exception(ex.Message); } finally { reader.Close(); } return(l); }