private bool SendQuerySubmit(IDataConsumerSchemeMutableObject dataConsumerScheme)
        {
            try
            {

                ISdmxObjects sdmxObjects = new SdmxObjectsImpl();

                sdmxObjects.AddDataConsumerScheme(dataConsumerScheme.ImmutableInstance);

                WSModel modelDataConsumerScheme = new WSModel();

                XmlDocument result = modelDataConsumerScheme.SubmitStructure(sdmxObjects);

                Utils.GetXMLResponseError(result);

                return true;

            }
            catch (Exception ex)
            {
                return false;
            }
        }
        protected void btnConfirmImport_Click(object sender, EventArgs e)
        {
            bool oneRowIsOk = false;
            GridViewRowCollection rows = gridView.Rows;

            foreach (GridViewRow row in rows)
            {
                if (((CheckBox)row.Cells[4].Controls[1]).Checked)
                {
                    oneRowIsOk = true;
                    break;
                }
            }

            if (oneRowIsOk)
            {
                WSModel wsModel = new WSModel();
                XmlDocument xDocStructure = new XmlDocument();
                XmlDocument xDocMessage = new XmlDocument();
                XmlDocument xRet;
                WSUtils utils = new WSUtils();
                List<ImportedItem> myItems = Session[IMPORTED_ITEMS_STRING] as List<ImportedItem>;
                ISdmxObjects sdmxObjects = (ISdmxObjects)Session[IMPORTED_SDMX_OBJECT];
                ISdmxObjects newSdmxObjects = new SdmxObjectsImpl();
                List<ImportedItem> reportItems = new List<ImportedItem>();
                string objectsSummary = string.Empty;

                foreach (GridViewRow row in gridView.Rows)
                {
                    string currentId = ((Label)row.Cells[0].Controls[1]).Text;
                    string currentAgency = ((Label)row.Cells[1].Controls[1]).Text;
                    string currentVersion = ((Label)row.Cells[2].Controls[1]).Text;
                    ImportedItem myCurrentItem = myItems.Find(item => item.ID.Equals(currentId) && item.Agency.Equals(currentAgency) && item.Version.Equals(currentVersion));

                    if (((CheckBox)row.Cells[4].Controls[1]).Checked)
                    {
                        switch (myCurrentItem._type)
                        {
                            case "CODELIST":
                                ICodelistObject tmpCodeList = sdmxObjects.Codelists.First(codelist => codelist.Id.Equals(currentId) && codelist.AgencyId.Equals(currentAgency) && codelist.Version.Equals(currentVersion));
                                newSdmxObjects.AddCodelist(tmpCodeList);
                                objectsSummary += string.Format(Resources.Messages.msg_codelist_imported, tmpCodeList.Id, tmpCodeList.AgencyId, tmpCodeList.Version);
                                break;
                            case "CONCEPT_SCHEME":
                                IConceptSchemeObject tmpConceptScheme = sdmxObjects.ConceptSchemes.First(conceptScheme => conceptScheme.Id.Equals(currentId) && conceptScheme.AgencyId.Equals(currentAgency) && conceptScheme.Version.Equals(currentVersion));
                                newSdmxObjects.AddConceptScheme(tmpConceptScheme);
                                objectsSummary += string.Format(Resources.Messages.msg_concept_scheme_imported, tmpConceptScheme.Id, tmpConceptScheme.AgencyId, tmpConceptScheme.Version);
                                break;
                            case "CATEGORY_SCHEME":
                                ICategorySchemeObject tmpCategoryScheme = sdmxObjects.CategorySchemes.First(categoryScheme => categoryScheme.Id.Equals(currentId) && categoryScheme.AgencyId.Equals(currentAgency) && categoryScheme.Version.Equals(currentVersion));
                                newSdmxObjects.AddCategoryScheme(tmpCategoryScheme);
                                objectsSummary += string.Format(Resources.Messages.msg_category_scheme_imported, tmpCategoryScheme.Id, tmpCategoryScheme.AgencyId, tmpCategoryScheme.Version);
                                break;
                            case "DSD":
                                IDataStructureObject tmpDataStructure = sdmxObjects.DataStructures.First(dataStructure => dataStructure.Id.Equals(currentId) && dataStructure.AgencyId.Equals(currentAgency) && dataStructure.Version.Equals(currentVersion));
                                newSdmxObjects.AddDataStructure(tmpDataStructure);
                                objectsSummary += string.Format(Resources.Messages.msg_data_structure_imported, tmpDataStructure.Id, tmpDataStructure.AgencyId, tmpDataStructure.Version);
                                break;
                            case "AGENCY_SCHEME":
                                IAgencyScheme tmpAgencyScheme = sdmxObjects.AgenciesSchemes.First(agencyScheme => agencyScheme.Id.Equals(currentId) && agencyScheme.AgencyId.Equals(currentAgency) && agencyScheme.Version.Equals(currentVersion));
                                newSdmxObjects.AddAgencyScheme(tmpAgencyScheme);
                                objectsSummary += string.Format(Resources.Messages.msg_agency_scheme_imported, tmpAgencyScheme.Id, tmpAgencyScheme.AgencyId, tmpAgencyScheme.Version);
                                break;
                            case "DATA_PROVIDER_SCHEME":
                                IDataProviderScheme tmpDataProviderScheme = sdmxObjects.DataProviderSchemes.First(dataProviderScheme => dataProviderScheme.Id.Equals(currentId) && dataProviderScheme.AgencyId.Equals(currentAgency) && dataProviderScheme.Version.Equals(currentVersion));
                                newSdmxObjects.AddDataProviderScheme(tmpDataProviderScheme);
                                objectsSummary += string.Format(Resources.Messages.msg_data_provider_scheme_imported, tmpDataProviderScheme.Id, tmpDataProviderScheme.AgencyId, tmpDataProviderScheme.Version);
                                break;
                            case "DATA_CONSUMER_SCHEME":
                                IDataConsumerScheme tmpDataConsumerScheme = sdmxObjects.DataConsumerSchemes.First(dataConsumerScheme => dataConsumerScheme.Id.Equals(currentId) && dataConsumerScheme.AgencyId.Equals(currentAgency) && dataConsumerScheme.Version.Equals(currentVersion));
                                newSdmxObjects.AddDataConsumerScheme(tmpDataConsumerScheme);
                                objectsSummary += string.Format(Resources.Messages.msg_data_consumer_scheme_imported, tmpDataConsumerScheme.Id, tmpDataConsumerScheme.AgencyId, tmpDataConsumerScheme.Version);
                                break;
                            case "ORGANIZATION_UNIT_SCHEME":
                                IOrganisationUnitSchemeObject tmpOrganizationUnitScheme = sdmxObjects.OrganisationUnitSchemes.First(organizationUnitScheme => organizationUnitScheme.Id.Equals(currentId) && organizationUnitScheme.AgencyId.Equals(currentAgency) && organizationUnitScheme.Version.Equals(currentVersion));
                                newSdmxObjects.AddOrganisationUnitScheme(tmpOrganizationUnitScheme);
                                objectsSummary += string.Format(Resources.Messages.msg_organization_unit_scheme_imported, tmpOrganizationUnitScheme.Id, tmpOrganizationUnitScheme.AgencyId, tmpOrganizationUnitScheme.Version);
                                break;
                            case "STRUCTURE_SET":
                                IStructureSetObject tmpStructureSet = sdmxObjects.StructureSets.First(structureSet => structureSet.Id.Equals(currentId) && structureSet.AgencyId.Equals(currentAgency) && structureSet.Version.Equals(currentVersion));
                                newSdmxObjects.AddStructureSet(tmpStructureSet);
                                objectsSummary += string.Format(Resources.Messages.msg_structure_set_imported, tmpStructureSet.Id, tmpStructureSet.AgencyId, tmpStructureSet.Version);
                                break;
                            case "CONTENT_CONSTRAINT":
                                IContentConstraintObject tmpContentConstraint = sdmxObjects.ContentConstraintObjects.First(contentConstraint => contentConstraint.Id.Equals(currentId) && contentConstraint.AgencyId.Equals(currentAgency) && contentConstraint.Version.Equals(currentVersion));
                                newSdmxObjects.AddContentConstraintObject(tmpContentConstraint);
                                objectsSummary += string.Format(Resources.Messages.msg_content_constraint_imported, tmpContentConstraint.Id, tmpContentConstraint.AgencyId, tmpContentConstraint.Version);
                                break;
                            case "HIERARCHICAL_CODELIST":
                                IHierarchicalCodelistObject tmpHierarchicalCodelist = sdmxObjects.HierarchicalCodelists.First(hierarchicalCodelist => hierarchicalCodelist.Id.Equals(currentId) && hierarchicalCodelist.AgencyId.Equals(currentAgency) && hierarchicalCodelist.Version.Equals(currentVersion));
                                newSdmxObjects.AddHierarchicalCodelist(tmpHierarchicalCodelist);
                                objectsSummary += string.Format(Resources.Messages.msg_hierarchical_codelist_imported, tmpHierarchicalCodelist.Id, tmpHierarchicalCodelist.AgencyId, tmpHierarchicalCodelist.Version);
                                break;
                            case "CATEGORISATION":
                                ICategorisationObject tmpCategorisation = sdmxObjects.Categorisations.First(cat => cat.Id.Equals(currentId) && cat.AgencyId.Equals(currentAgency) && cat.Version.Equals(currentVersion));
                                newSdmxObjects.AddCategorisation(tmpCategorisation);
                                objectsSummary += string.Format(Resources.Messages.msg_categorisation_imported, tmpCategorisation.Id, tmpCategorisation.AgencyId, tmpCategorisation.Version);
                                break;
                        }
                        reportItems.Add(myCurrentItem);
                    }
                }
                Session[REPORT_ITEMS] = reportItems;

                // Carico l'SDMXObject in un XML Message da passare al WS
                //xDocMessage = utils.GetXmlMessage(newSdmxObjects);

                newSdmxObjects = PopolateAnnotationID(newSdmxObjects);

                //Richiamo il metodo SubmitStructure per l'inserimento nel DB
                try
                {
                    xRet = wsModel.SubmitStructure(newSdmxObjects);
                }
                catch (Exception ex)
                {
                    Utils.ShowDialog(ex.Message);
                    Utils.ForceBlackClosing();
                    return;
                }

                string CheckError = Utils.GetXMLResponseError(xRet);

                if (CheckError != String.Empty)
                {
                    Utils.ShowDialog(CheckError);
                    Utils.ForceBlackClosing();
                    return;
                }

                // lblInfo.Text = CreateArtefactImportedString(sdmxObjects);
                lblInfo.Text = objectsSummary;
                gridView.DataSource = null;
                gridView.DataBind();
            }
            else
            {
                Utils.ShowDialog( Resources.Messages.err_at_least_one_row );
                Utils.AppendScript("openPopUp('importedItemsGridDiv', 600);");
                return;
            }
            Utils.AppendScript("openPopUp('dialog-form', 600);");
            /*gridView.DataSource = myItems;
            gridView.DataBind();*/
        }
        public void Test()
        {
            var s = new SdmxObjectsImpl();
            var s2 = new SdmxObjectsImpl(new HeaderImpl("PAOK", "OLE"));
            Assert.IsFalse(s2.HasStructures());
            Assert.NotNull(s2.Header);
            var s3 = new SdmxObjectsImpl(DatasetAction.GetFromEnum(DatasetActionEnumType.Append));

            Assert.AreEqual(s.Action.EnumType, DatasetActionEnumType.Information);
            Assert.AreEqual(s3.Action.EnumType, DatasetActionEnumType.Append);
            Assert.IsNull(s.Header);
            Assert.IsNotNull(s.Agencies);
            CollectionAssert.IsEmpty(s.Agencies);
            Assert.AreNotSame(s.Agencies, s.Agencies);

            Assert.IsNotNull(s.AgenciesSchemes);
            CollectionAssert.IsEmpty(s.AgenciesSchemes);
            Assert.AreNotSame(s.AgenciesSchemes, s.AgenciesSchemes);

            Assert.IsNotNull(s.AllMaintainables);
            CollectionAssert.IsEmpty(s.AllMaintainables);
            Assert.AreNotSame(s.AllMaintainables, s.AllMaintainables);

            Assert.IsNotNull(s.AttachmentConstraints);
            CollectionAssert.IsEmpty(s.AttachmentConstraints);
            Assert.AreNotSame(s.AttachmentConstraints, s.AttachmentConstraints);

            Assert.IsNotNull(s.Categorisations);
            CollectionAssert.IsEmpty(s.Categorisations);
            Assert.AreNotSame(s.Categorisations, s.Categorisations);

            Assert.IsNotNull(s.CategorySchemes);
            CollectionAssert.IsEmpty(s.CategorySchemes);
            Assert.AreNotSame(s.CategorySchemes, s.CategorySchemes);

            Assert.IsNotNull(s.Codelists);
            CollectionAssert.IsEmpty(s.Codelists);
            Assert.AreNotSame(s.Codelists, s.Codelists);

            Assert.IsNotNull(s.ConceptSchemes);
            CollectionAssert.IsEmpty(s.ConceptSchemes);
            Assert.AreNotSame(s.ConceptSchemes, s.ConceptSchemes);

            Assert.IsNotNull(s.ContentConstraintObjects);
            CollectionAssert.IsEmpty(s.ContentConstraintObjects);
            Assert.AreNotSame(s.ContentConstraintObjects, s.ContentConstraintObjects);

            Assert.IsNotNull(s.DataConsumerSchemes);
            CollectionAssert.IsEmpty(s.DataConsumerSchemes);
            Assert.AreNotSame(s.DataConsumerSchemes, s.DataConsumerSchemes);

            Assert.IsNotNull(s.DataProviderSchemes);
            CollectionAssert.IsEmpty(s.DataProviderSchemes);
            Assert.AreNotSame(s.DataProviderSchemes, s.DataProviderSchemes);

            Assert.IsNotNull(s.DataStructures);
            CollectionAssert.IsEmpty(s.DataStructures);
            Assert.AreNotSame(s.DataStructures, s.DataStructures);

            Assert.IsNotNull(s.Dataflows);
            CollectionAssert.IsEmpty(s.Dataflows);
            Assert.AreNotSame(s.Dataflows, s.Dataflows);

            Assert.IsNotNull(s.HierarchicalCodelists);
            CollectionAssert.IsEmpty(s.HierarchicalCodelists);
            Assert.AreNotSame(s.HierarchicalCodelists, s.HierarchicalCodelists);

            Assert.IsNotNull(s.MetadataStructures);
            CollectionAssert.IsEmpty(s.MetadataStructures);
            Assert.AreNotSame(s.MetadataStructures, s.MetadataStructures);

            Assert.IsNotNull(s.Metadataflows);
            CollectionAssert.IsEmpty(s.Metadataflows);
            Assert.AreNotSame(s.Metadataflows, s.Metadataflows);

            Assert.IsNotNull(s.OrganisationUnitSchemes);
            CollectionAssert.IsEmpty(s.OrganisationUnitSchemes);
            Assert.AreNotSame(s.OrganisationUnitSchemes, s.OrganisationUnitSchemes);

            Assert.IsNotNull(s.Processes);
            CollectionAssert.IsEmpty(s.Processes);
            Assert.AreNotSame(s.Processes, s.Processes);

            Assert.IsNotNull(s.ProvisionAgreements);
            CollectionAssert.IsEmpty(s.ProvisionAgreements);
            Assert.AreNotSame(s.ProvisionAgreements, s.ProvisionAgreements);

            Assert.IsNotNull(s.Registrations);
            CollectionAssert.IsEmpty(s.Registrations);
            Assert.AreNotSame(s.Registrations, s.Registrations);

            Assert.IsNotNull(s.ReportingTaxonomys);
            CollectionAssert.IsEmpty(s.ReportingTaxonomys);
            Assert.AreNotSame(s.ReportingTaxonomys, s.ReportingTaxonomys);

            Assert.IsNotNull(s.StructureSets);
            CollectionAssert.IsEmpty(s.StructureSets);
            Assert.AreNotSame(s.StructureSets, s.StructureSets);

            Assert.IsNotNull(s.Subscriptions);
            CollectionAssert.IsEmpty(s.Subscriptions);
            Assert.AreNotSame(s.Subscriptions, s.Subscriptions);

            var agencySchemeMock = new Mock<IAgencyScheme>();
            agencySchemeMock.Setup(o => o.StructureType)
                            .Returns(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.AgencyScheme));

            agencySchemeMock.Setup(o => o.AgencyId).Returns("TEST_AGENCY");
            agencySchemeMock.Setup(o => o.Id).Returns("ID_AGENCYSCHEME");
            agencySchemeMock.Setup(o => o.Version).Returns("1.2");
            agencySchemeMock.Setup(o => o.StructureType)
                            .Returns(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.AgencyScheme));
            IAgencyScheme agencyScheme = agencySchemeMock.Object;
            s.AddAgencyScheme(agencyScheme);
            CollectionAssert.IsNotEmpty(s.AgenciesSchemes);
            s.RemoveAgencyScheme(agencyScheme);
            CollectionAssert.IsEmpty(s.AgenciesSchemes);
            s.AddIdentifiable(agencyScheme);
            CollectionAssert.IsNotEmpty(s.AgenciesSchemes);
            s2.Merge(s);
            CollectionAssert.IsNotEmpty(s2.AgenciesSchemes);

            var attachmentConstraintObjectMock = new Mock<IAttachmentConstraintObject>();
            attachmentConstraintObjectMock.Setup(o => o.StructureType)
                                          .Returns(
                                              SdmxStructureType.GetFromEnum(SdmxStructureEnumType.AttachmentConstraint));

            attachmentConstraintObjectMock.Setup(o => o.AgencyId).Returns("TEST_AGENCY");
            attachmentConstraintObjectMock.Setup(o => o.Id).Returns("ID_ATTACHMENTCONSTRAINTOBJECT");
            attachmentConstraintObjectMock.Setup(o => o.Version).Returns("1.2");
            IAttachmentConstraintObject attachmentConstraintObject = attachmentConstraintObjectMock.Object;
            s.AddAttachmentConstraint(attachmentConstraintObject);
            CollectionAssert.IsNotEmpty(s.AttachmentConstraints);
            s.RemoveAttachmentConstraintObject(attachmentConstraintObject);
            CollectionAssert.IsEmpty(s.AttachmentConstraints);
            s.AddIdentifiable(attachmentConstraintObject);
            CollectionAssert.IsNotEmpty(s.AttachmentConstraints);
            s2.Merge(s);
            CollectionAssert.IsNotEmpty(s2.AttachmentConstraints);

            var categorisationObjectMock = new Mock<ICategorisationObject>();
            categorisationObjectMock.Setup(o => o.StructureType)
                                    .Returns(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.Categorisation));

            categorisationObjectMock.Setup(o => o.AgencyId).Returns("TEST_AGENCY");
            categorisationObjectMock.Setup(o => o.Id).Returns("ID_CATEGORISATIONOBJECT");
            categorisationObjectMock.Setup(o => o.Version).Returns("1.2");
            ICategorisationObject categorisationObject = categorisationObjectMock.Object;
            s.AddCategorisation(categorisationObject);
            CollectionAssert.IsNotEmpty(s.Categorisations);
            s.RemoveCategorisation(categorisationObject);
            CollectionAssert.IsEmpty(s.Categorisations);
            s.AddIdentifiable(categorisationObject);
            CollectionAssert.IsNotEmpty(s.Categorisations);
            s2.Merge(s);
            CollectionAssert.IsNotEmpty(s2.Categorisations);

            var categorySchemeObjectMock = new Mock<ICategorySchemeObject>();
            categorySchemeObjectMock.Setup(o => o.StructureType)
                                    .Returns(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.CategoryScheme));

            categorySchemeObjectMock.Setup(o => o.AgencyId).Returns("TEST_AGENCY");
            categorySchemeObjectMock.Setup(o => o.Id).Returns("ID_CATEGORYSCHEMEOBJECT");
            categorySchemeObjectMock.Setup(o => o.Version).Returns("1.2");
            ICategorySchemeObject categorySchemeObject = categorySchemeObjectMock.Object;
            s.AddCategoryScheme(categorySchemeObject);
            CollectionAssert.IsNotEmpty(s.CategorySchemes);
            s.RemoveCategoryScheme(categorySchemeObject);
            CollectionAssert.IsEmpty(s.CategorySchemes);
            s.AddIdentifiable(categorySchemeObject);
            CollectionAssert.IsNotEmpty(s.CategorySchemes);
            s2.Merge(s);
            CollectionAssert.IsNotEmpty(s2.CategorySchemes);

            var codelistObjectMock = new Mock<ICodelistObject>();
            codelistObjectMock.Setup(o => o.StructureType)
                              .Returns(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.CodeList));

            codelistObjectMock.Setup(o => o.AgencyId).Returns("TEST_AGENCY");
            codelistObjectMock.Setup(o => o.Id).Returns("ID_CODELISTOBJECT");
            codelistObjectMock.Setup(o => o.Version).Returns("1.2");
            ICodelistObject codelistObject = codelistObjectMock.Object;
            s.AddCodelist(codelistObject);
            CollectionAssert.IsNotEmpty(s.Codelists);
            s.RemoveCodelist(codelistObject);
            CollectionAssert.IsEmpty(s.Codelists);
            s.AddIdentifiable(codelistObject);
            CollectionAssert.IsNotEmpty(s.Codelists);
            s2.Merge(s);
            CollectionAssert.IsNotEmpty(s2.Codelists);

            var conceptSchemeObjectMock = new Mock<IConceptSchemeObject>();
            conceptSchemeObjectMock.Setup(o => o.StructureType)
                                   .Returns(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.ConceptScheme));

            conceptSchemeObjectMock.Setup(o => o.AgencyId).Returns("TEST_AGENCY");
            conceptSchemeObjectMock.Setup(o => o.Id).Returns("ID_CONCEPTSCHEMEOBJECT");
            conceptSchemeObjectMock.Setup(o => o.Version).Returns("1.2");
            IConceptSchemeObject conceptSchemeObject = conceptSchemeObjectMock.Object;
            s.AddConceptScheme(conceptSchemeObject);
            CollectionAssert.IsNotEmpty(s.ConceptSchemes);
            s.RemoveConceptScheme(conceptSchemeObject);
            CollectionAssert.IsEmpty(s.ConceptSchemes);
            s.AddIdentifiable(conceptSchemeObject);
            CollectionAssert.IsNotEmpty(s.ConceptSchemes);
            s2.Merge(s);
            CollectionAssert.IsNotEmpty(s2.ConceptSchemes);

            var contentConstraintObjectMock = new Mock<IContentConstraintObject>();
            contentConstraintObjectMock.Setup(o => o.StructureType)
                                       .Returns(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.ContentConstraint));

            contentConstraintObjectMock.Setup(o => o.AgencyId).Returns("TEST_AGENCY");
            contentConstraintObjectMock.Setup(o => o.Id).Returns("ID_CONTENTCONSTRAINTOBJECT");
            contentConstraintObjectMock.Setup(o => o.Version).Returns("1.2");
            IContentConstraintObject contentConstraintObject = contentConstraintObjectMock.Object;
            s.AddContentConstraintObject(contentConstraintObject);
            CollectionAssert.IsNotEmpty(s.ContentConstraintObjects);
            s.RemoveContentConstraintObject(contentConstraintObject);
            CollectionAssert.IsEmpty(s.ContentConstraintObjects);
            s.AddIdentifiable(contentConstraintObject);
            CollectionAssert.IsNotEmpty(s.ContentConstraintObjects);
            s2.Merge(s);
            CollectionAssert.IsNotEmpty(s2.ContentConstraintObjects);

            var dataConsumerSchemeMock = new Mock<IDataConsumerScheme>();
            dataConsumerSchemeMock.Setup(o => o.StructureType)
                                  .Returns(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.DataConsumerScheme));

            dataConsumerSchemeMock.Setup(o => o.AgencyId).Returns("TEST_AGENCY");
            dataConsumerSchemeMock.Setup(o => o.Id).Returns("ID_DATACONSUMERSCHEME");
            dataConsumerSchemeMock.Setup(o => o.Version).Returns("1.2");
            IDataConsumerScheme dataConsumerScheme = dataConsumerSchemeMock.Object;
            s.AddDataConsumerScheme(dataConsumerScheme);
            CollectionAssert.IsNotEmpty(s.DataConsumerSchemes);
            s.RemoveDataConsumerScheme(dataConsumerScheme);
            CollectionAssert.IsEmpty(s.DataConsumerSchemes);
            s.AddIdentifiable(dataConsumerScheme);
            CollectionAssert.IsNotEmpty(s.DataConsumerSchemes);
            s2.Merge(s);
            CollectionAssert.IsNotEmpty(s2.DataConsumerSchemes);

            var dataProviderSchemeMock = new Mock<IDataProviderScheme>();
            dataProviderSchemeMock.Setup(o => o.StructureType)
                                  .Returns(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.DataProviderScheme));

            dataProviderSchemeMock.Setup(o => o.AgencyId).Returns("TEST_AGENCY");
            dataProviderSchemeMock.Setup(o => o.Id).Returns("ID_DATAPROVIDERSCHEME");
            dataProviderSchemeMock.Setup(o => o.Version).Returns("1.2");
            IDataProviderScheme dataProviderScheme = dataProviderSchemeMock.Object;
            s.AddDataProviderScheme(dataProviderScheme);
            CollectionAssert.IsNotEmpty(s.DataProviderSchemes);
            s.RemoveDataProviderScheme(dataProviderScheme);
            CollectionAssert.IsEmpty(s.DataProviderSchemes);
            s.AddIdentifiable(dataProviderScheme);
            CollectionAssert.IsNotEmpty(s.DataProviderSchemes);
            s2.Merge(s);
            CollectionAssert.IsNotEmpty(s2.DataProviderSchemes);

            var dataStructureObjectMock = new Mock<IDataStructureObject>();
            dataStructureObjectMock.Setup(o => o.StructureType)
                                   .Returns(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.Dsd));

            dataStructureObjectMock.Setup(o => o.AgencyId).Returns("TEST_AGENCY");
            dataStructureObjectMock.Setup(o => o.Id).Returns("ID_DATASTRUCTUREOBJECT");
            dataStructureObjectMock.Setup(o => o.Version).Returns("1.2");
            IDataStructureObject dataStructureObject = dataStructureObjectMock.Object;
            s.AddDataStructure(dataStructureObject);
            CollectionAssert.IsNotEmpty(s.DataStructures);
            s.RemoveDataStructure(dataStructureObject);
            CollectionAssert.IsEmpty(s.DataStructures);
            s.AddIdentifiable(dataStructureObject);
            CollectionAssert.IsNotEmpty(s.DataStructures);
            s2.Merge(s);
            CollectionAssert.IsNotEmpty(s2.DataStructures);

            var dataflowObjectMock = new Mock<IDataflowObject>();
            dataflowObjectMock.Setup(o => o.StructureType)
                              .Returns(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.Dataflow));

            dataflowObjectMock.Setup(o => o.AgencyId).Returns("TEST_AGENCY");
            dataflowObjectMock.Setup(o => o.Id).Returns("ID_DATAFLOWOBJECT");
            dataflowObjectMock.Setup(o => o.Version).Returns("1.2");
            IDataflowObject dataflowObject = dataflowObjectMock.Object;
            s.AddDataflow(dataflowObject);
            CollectionAssert.IsNotEmpty(s.Dataflows);
            s.RemoveDataflow(dataflowObject);
            CollectionAssert.IsEmpty(s.Dataflows);
            s.AddIdentifiable(dataflowObject);
            CollectionAssert.IsNotEmpty(s.Dataflows);
            s2.Merge(s);
            CollectionAssert.IsNotEmpty(s2.Dataflows);

            var hierarchicalCodelistObjectMock = new Mock<IHierarchicalCodelistObject>();
            hierarchicalCodelistObjectMock.Setup(o => o.StructureType)
                                          .Returns(
                                              SdmxStructureType.GetFromEnum(SdmxStructureEnumType.HierarchicalCodelist));

            hierarchicalCodelistObjectMock.Setup(o => o.AgencyId).Returns("TEST_AGENCY");
            hierarchicalCodelistObjectMock.Setup(o => o.Id).Returns("ID_HIERARCHICALCODELISTOBJECT");
            hierarchicalCodelistObjectMock.Setup(o => o.Version).Returns("1.2");
            IHierarchicalCodelistObject hierarchicalCodelistObject = hierarchicalCodelistObjectMock.Object;
            s.AddHierarchicalCodelist(hierarchicalCodelistObject);
            CollectionAssert.IsNotEmpty(s.HierarchicalCodelists);
            s.RemoveHierarchicalCodelist(hierarchicalCodelistObject);
            CollectionAssert.IsEmpty(s.HierarchicalCodelists);
            s.AddIdentifiable(hierarchicalCodelistObject);
            CollectionAssert.IsNotEmpty(s.HierarchicalCodelists);
            s2.Merge(s);
            CollectionAssert.IsNotEmpty(s2.HierarchicalCodelists);

            var metadataFlowMock = new Mock<IMetadataFlow>();
            metadataFlowMock.Setup(o => o.StructureType)
                            .Returns(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.MetadataFlow));

            metadataFlowMock.Setup(o => o.AgencyId).Returns("TEST_AGENCY");
            metadataFlowMock.Setup(o => o.Id).Returns("ID_METADATAFLOW");
            metadataFlowMock.Setup(o => o.Version).Returns("1.2");
            IMetadataFlow metadataFlow = metadataFlowMock.Object;
            s.AddMetadataFlow(metadataFlow);
            CollectionAssert.IsNotEmpty(s.Metadataflows);
            s.RemoveMetadataFlow(metadataFlow);
            CollectionAssert.IsEmpty(s.Metadataflows);
            s.AddIdentifiable(metadataFlow);
            CollectionAssert.IsNotEmpty(s.Metadataflows);
            s2.Merge(s);
            CollectionAssert.IsNotEmpty(s2.Metadataflows);

            var metadataStructureDefinitionObjectMock = new Mock<IMetadataStructureDefinitionObject>();
            metadataStructureDefinitionObjectMock.Setup(o => o.StructureType)
                                                 .Returns(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.Msd));

            metadataStructureDefinitionObjectMock.Setup(o => o.AgencyId).Returns("TEST_AGENCY");
            metadataStructureDefinitionObjectMock.Setup(o => o.Id).Returns("ID_METADATASTRUCTUREDEFINITIONOBJECT");
            metadataStructureDefinitionObjectMock.Setup(o => o.Version).Returns("1.2");
            IMetadataStructureDefinitionObject metadataStructureDefinitionObject =
                metadataStructureDefinitionObjectMock.Object;
            s.AddMetadataStructure(metadataStructureDefinitionObject);
            CollectionAssert.IsNotEmpty(s.MetadataStructures);
            s.RemoveMetadataStructure(metadataStructureDefinitionObject);
            CollectionAssert.IsEmpty(s.MetadataStructures);
            s.AddIdentifiable(metadataStructureDefinitionObject);
            CollectionAssert.IsNotEmpty(s.MetadataStructures);
            s2.Merge(s);
            CollectionAssert.IsNotEmpty(s2.MetadataStructures);

            var organisationUnitSchemeObjectMock = new Mock<IOrganisationUnitSchemeObject>();
            organisationUnitSchemeObjectMock.Setup(o => o.StructureType)
                                            .Returns(
                                                SdmxStructureType.GetFromEnum(
                                                    SdmxStructureEnumType.OrganisationUnitScheme));

            organisationUnitSchemeObjectMock.Setup(o => o.AgencyId).Returns("TEST_AGENCY");
            organisationUnitSchemeObjectMock.Setup(o => o.Id).Returns("ID_ORGANISATIONUNITSCHEMEOBJECT");
            organisationUnitSchemeObjectMock.Setup(o => o.Version).Returns("1.2");
            IOrganisationUnitSchemeObject organisationUnitSchemeObject = organisationUnitSchemeObjectMock.Object;
            s.AddOrganisationUnitScheme(organisationUnitSchemeObject);
            CollectionAssert.IsNotEmpty(s.OrganisationUnitSchemes);
            s.RemoveOrganisationUnitScheme(organisationUnitSchemeObject);
            CollectionAssert.IsEmpty(s.OrganisationUnitSchemes);
            s.AddIdentifiable(organisationUnitSchemeObject);
            CollectionAssert.IsNotEmpty(s.OrganisationUnitSchemes);
            s2.Merge(s);
            CollectionAssert.IsNotEmpty(s2.OrganisationUnitSchemes);

            var processObjectMock = new Mock<IProcessObject>();
            processObjectMock.Setup(o => o.StructureType)
                             .Returns(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.Process));

            processObjectMock.Setup(o => o.AgencyId).Returns("TEST_AGENCY");
            processObjectMock.Setup(o => o.Id).Returns("ID_PROCESSOBJECT");
            processObjectMock.Setup(o => o.Version).Returns("1.2");
            IProcessObject processObject = processObjectMock.Object;
            s.AddProcess(processObject);
            CollectionAssert.IsNotEmpty(s.Processes);
            s.RemoveProcess(processObject);
            CollectionAssert.IsEmpty(s.Processes);
            s.AddIdentifiable(processObject);
            CollectionAssert.IsNotEmpty(s.Processes);
            s2.Merge(s);
            CollectionAssert.IsNotEmpty(s2.Processes);

            var provisionAgreementObjectMock = new Mock<IProvisionAgreementObject>();
            provisionAgreementObjectMock.Setup(o => o.StructureType)
                                        .Returns(
                                            SdmxStructureType.GetFromEnum(SdmxStructureEnumType.ProvisionAgreement));

            provisionAgreementObjectMock.Setup(o => o.AgencyId).Returns("TEST_AGENCY");
            provisionAgreementObjectMock.Setup(o => o.Id).Returns("ID_PROVISIONAGREEMENTOBJECT");
            provisionAgreementObjectMock.Setup(o => o.Version).Returns("1.2");
            IProvisionAgreementObject provisionAgreementObject = provisionAgreementObjectMock.Object;
            s.AddProvisionAgreement(provisionAgreementObject);
            CollectionAssert.IsNotEmpty(s.ProvisionAgreements);
            s.RemoveProvisionAgreement(provisionAgreementObject);
            CollectionAssert.IsEmpty(s.ProvisionAgreements);
            s.AddIdentifiable(provisionAgreementObject);
            CollectionAssert.IsNotEmpty(s.ProvisionAgreements);
            s2.Merge(s);
            CollectionAssert.IsNotEmpty(s2.ProvisionAgreements);

            var registrationObjectMock = new Mock<IRegistrationObject>();
            registrationObjectMock.Setup(o => o.StructureType)
                                  .Returns(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.Registration));

            registrationObjectMock.Setup(o => o.AgencyId).Returns("TEST_AGENCY");
            registrationObjectMock.Setup(o => o.Id).Returns("ID_REGISTRATIONOBJECT");
            registrationObjectMock.Setup(o => o.Version).Returns("1.2");
            IRegistrationObject registrationObject = registrationObjectMock.Object;
            s.AddRegistration(registrationObject);
            CollectionAssert.IsNotEmpty(s.Registrations);
            s.RemoveRegistration(registrationObject);
            CollectionAssert.IsEmpty(s.Registrations);
            s.AddIdentifiable(registrationObject);
            CollectionAssert.IsNotEmpty(s.Registrations);
            Assert.IsFalse(s2.HasRegistrations());
            s2.Merge(s);
            CollectionAssert.IsNotEmpty(s2.Registrations);
            Assert.IsTrue(s2.HasRegistrations());

            var reportingTaxonomyObjectMock = new Mock<IReportingTaxonomyObject>();
            reportingTaxonomyObjectMock.Setup(o => o.StructureType)
                                       .Returns(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.ReportingTaxonomy));

            reportingTaxonomyObjectMock.Setup(o => o.AgencyId).Returns("TEST_AGENCY");
            reportingTaxonomyObjectMock.Setup(o => o.Id).Returns("ID_REPORTINGTAXONOMYOBJECT");
            reportingTaxonomyObjectMock.Setup(o => o.Version).Returns("1.2");
            IReportingTaxonomyObject reportingTaxonomyObject = reportingTaxonomyObjectMock.Object;
            s.AddReportingTaxonomy(reportingTaxonomyObject);
            CollectionAssert.IsNotEmpty(s.ReportingTaxonomys);
            s.RemoveReportingTaxonomy(reportingTaxonomyObject);
            CollectionAssert.IsEmpty(s.ReportingTaxonomys);
            s.AddIdentifiable(reportingTaxonomyObject);
            CollectionAssert.IsNotEmpty(s.ReportingTaxonomys);
            s2.Merge(s);
            CollectionAssert.IsNotEmpty(s2.ReportingTaxonomys);

            var structureSetObjectMock = new Mock<IStructureSetObject>();
            structureSetObjectMock.Setup(o => o.StructureType)
                                  .Returns(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.StructureSet));

            structureSetObjectMock.Setup(o => o.AgencyId).Returns("TEST_AGENCY");
            structureSetObjectMock.Setup(o => o.Id).Returns("ID_STRUCTURESETOBJECT");
            structureSetObjectMock.Setup(o => o.Version).Returns("1.2");
            IStructureSetObject structureSetObject = structureSetObjectMock.Object;
            s.AddStructureSet(structureSetObject);
            CollectionAssert.IsNotEmpty(s.StructureSets);
            s.RemoveStructureSet(structureSetObject);
            CollectionAssert.IsEmpty(s.StructureSets);
            s.AddIdentifiable(structureSetObject);
            CollectionAssert.IsNotEmpty(s.StructureSets);
            s2.Merge(s);
            CollectionAssert.IsNotEmpty(s2.StructureSets);

            var subscriptionObjectMock = new Mock<ISubscriptionObject>();
            subscriptionObjectMock.Setup(o => o.StructureType)
                                  .Returns(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.Subscription));

            subscriptionObjectMock.Setup(o => o.AgencyId).Returns("TEST_AGENCY");
            subscriptionObjectMock.Setup(o => o.Id).Returns("ID_SUBSCRIPTIONOBJECT");
            subscriptionObjectMock.Setup(o => o.Version).Returns("1.2");
            ISubscriptionObject subscriptionObject = subscriptionObjectMock.Object;
            s.AddSubscription(subscriptionObject);
            CollectionAssert.IsNotEmpty(s.Subscriptions);
            s.RemoveSubscription(subscriptionObject);
            CollectionAssert.IsEmpty(s.Subscriptions);
            s.AddIdentifiable(subscriptionObject);
            CollectionAssert.IsNotEmpty(s.Subscriptions);
            Assert.IsFalse(s2.HasSubscriptions());
            s2.Merge(s);
            CollectionAssert.IsNotEmpty(s2.Subscriptions);
            Assert.IsTrue(s2.HasSubscriptions());

            var wildCard = new MaintainableRefObjectImpl("TEST_AGENCY", null, "1.2");
            var nothing = new MaintainableRefObjectImpl("NOTHING", null, "1.0");

            CollectionAssert.IsNotEmpty(s2.GetAgenciesSchemes(wildCard));
            CollectionAssert.IsEmpty(s2.GetAgenciesSchemes(nothing));
            CollectionAssert.IsNotEmpty(
                s2.GetAgenciesSchemes(
                    new MaintainableRefObjectImpl(agencyScheme.AgencyId, agencyScheme.Id, agencyScheme.Version)));
            CollectionAssert.IsNotEmpty(s2.GetAgenciesSchemes(wildCard));
            CollectionAssert.IsEmpty(s2.GetAgenciesSchemes(nothing));

            CollectionAssert.IsNotEmpty(s2.GetAttachmentConstraints("TEST_AGENCY"));
            CollectionAssert.IsEmpty(s2.GetAttachmentConstraints("NOTHING"));
            CollectionAssert.IsNotEmpty(
                s2.GetAttachmentConstraints(
                    new MaintainableRefObjectImpl(
                        attachmentConstraintObject.AgencyId, 
                        attachmentConstraintObject.Id, 
                        attachmentConstraintObject.Version)));
            CollectionAssert.IsNotEmpty(s2.GetAttachmentConstraints(wildCard));
            CollectionAssert.IsEmpty(s2.GetAttachmentConstraints(nothing));

            CollectionAssert.IsNotEmpty(s2.GetCategorisations("TEST_AGENCY"));
            CollectionAssert.IsEmpty(s2.GetCategorisations("NOTHING"));
            CollectionAssert.IsNotEmpty(
                s2.GetCategorisations(
                    new MaintainableRefObjectImpl(
                        categorisationObject.AgencyId, categorisationObject.Id, categorisationObject.Version)));
            CollectionAssert.IsNotEmpty(s2.GetCategorisations(wildCard));
            CollectionAssert.IsEmpty(s2.GetCategorisations(nothing));

            CollectionAssert.IsNotEmpty(s2.GetCategorySchemes("TEST_AGENCY"));
            CollectionAssert.IsEmpty(s2.GetCategorySchemes("NOTHING"));
            CollectionAssert.IsNotEmpty(
                s2.GetCategorySchemes(
                    new MaintainableRefObjectImpl(
                        categorySchemeObject.AgencyId, categorySchemeObject.Id, categorySchemeObject.Version)));
            CollectionAssert.IsNotEmpty(s2.GetCategorySchemes(wildCard));
            CollectionAssert.IsEmpty(s2.GetCategorySchemes(nothing));

            CollectionAssert.IsNotEmpty(s2.GetCodelists("TEST_AGENCY"));
            CollectionAssert.IsEmpty(s2.GetCodelists("NOTHING"));
            CollectionAssert.IsNotEmpty(
                s2.GetCodelists(
                    new MaintainableRefObjectImpl(codelistObject.AgencyId, codelistObject.Id, codelistObject.Version)));
            CollectionAssert.IsNotEmpty(s2.GetCodelists(wildCard));
            CollectionAssert.IsEmpty(s2.GetCodelists(nothing));

            CollectionAssert.IsNotEmpty(s2.GetConceptSchemes("TEST_AGENCY"));
            CollectionAssert.IsEmpty(s2.GetConceptSchemes("NOTHING"));
            CollectionAssert.IsNotEmpty(
                s2.GetConceptSchemes(
                    new MaintainableRefObjectImpl(
                        conceptSchemeObject.AgencyId, conceptSchemeObject.Id, conceptSchemeObject.Version)));
            CollectionAssert.IsNotEmpty(s2.GetConceptSchemes(wildCard));
            CollectionAssert.IsEmpty(s2.GetConceptSchemes(nothing));

            CollectionAssert.IsNotEmpty(s2.GetContentConstraintObjects("TEST_AGENCY"));
            CollectionAssert.IsEmpty(s2.GetContentConstraintObjects("NOTHING"));
            CollectionAssert.IsNotEmpty(
                s2.GetContentConstraintObjects(
                    new MaintainableRefObjectImpl(
                        contentConstraintObject.AgencyId, contentConstraintObject.Id, contentConstraintObject.Version)));
            CollectionAssert.IsNotEmpty(s2.GetContentConstraintObjects(wildCard));
            CollectionAssert.IsEmpty(s2.GetContentConstraintObjects(nothing));

            CollectionAssert.IsNotEmpty(s2.GetDataConsumerSchemes(wildCard));
            CollectionAssert.IsEmpty(s2.GetDataConsumerSchemes(nothing));
            CollectionAssert.IsNotEmpty(
                s2.GetDataConsumerSchemes(
                    new MaintainableRefObjectImpl(
                        dataConsumerScheme.AgencyId, dataConsumerScheme.Id, dataConsumerScheme.Version)));
            CollectionAssert.IsNotEmpty(s2.GetDataConsumerSchemes(wildCard));
            CollectionAssert.IsEmpty(s2.GetDataConsumerSchemes(nothing));

            CollectionAssert.IsNotEmpty(s2.GetDataProviderSchemes(wildCard));
            CollectionAssert.IsEmpty(s2.GetDataProviderSchemes(nothing));
            CollectionAssert.IsNotEmpty(
                s2.GetDataProviderSchemes(
                    new MaintainableRefObjectImpl(
                        dataProviderScheme.AgencyId, dataProviderScheme.Id, dataProviderScheme.Version)));
            CollectionAssert.IsNotEmpty(s2.GetDataProviderSchemes(wildCard));
            CollectionAssert.IsEmpty(s2.GetDataProviderSchemes(nothing));

            CollectionAssert.IsNotEmpty(s2.GetDataStructures("TEST_AGENCY"));
            CollectionAssert.IsEmpty(s2.GetDataStructures("NOTHING"));
            CollectionAssert.IsNotEmpty(
                s2.GetDataStructures(
                    new MaintainableRefObjectImpl(
                        dataStructureObject.AgencyId, dataStructureObject.Id, dataStructureObject.Version)));
            CollectionAssert.IsNotEmpty(s2.GetDataStructures(wildCard));
            CollectionAssert.IsEmpty(s2.GetDataStructures(nothing));

            CollectionAssert.IsNotEmpty(s2.GetDataflows("TEST_AGENCY"));
            CollectionAssert.IsEmpty(s2.GetDataflows("NOTHING"));
            CollectionAssert.IsNotEmpty(
                s2.GetDataflows(
                    new MaintainableRefObjectImpl(dataflowObject.AgencyId, dataflowObject.Id, dataflowObject.Version)));
            CollectionAssert.IsNotEmpty(s2.GetDataflows(wildCard));
            CollectionAssert.IsEmpty(s2.GetDataflows(nothing));

            CollectionAssert.IsNotEmpty(s2.GetHierarchicalCodelists("TEST_AGENCY"));
            CollectionAssert.IsEmpty(s2.GetHierarchicalCodelists("NOTHING"));
            CollectionAssert.IsNotEmpty(
                s2.GetHierarchicalCodelists(
                    new MaintainableRefObjectImpl(
                        hierarchicalCodelistObject.AgencyId, 
                        hierarchicalCodelistObject.Id, 
                        hierarchicalCodelistObject.Version)));
            CollectionAssert.IsNotEmpty(s2.GetHierarchicalCodelists(wildCard));
            CollectionAssert.IsEmpty(s2.GetHierarchicalCodelists(nothing));

            CollectionAssert.IsNotEmpty(s2.GetMetadataStructures("TEST_AGENCY"));
            CollectionAssert.IsEmpty(s2.GetMetadataStructures("NOTHING"));
            CollectionAssert.IsNotEmpty(
                s2.GetMetadataStructures(
                    new MaintainableRefObjectImpl(
                        metadataStructureDefinitionObject.AgencyId, 
                        metadataStructureDefinitionObject.Id, 
                        metadataStructureDefinitionObject.Version)));
            CollectionAssert.IsNotEmpty(s2.GetMetadataStructures(wildCard));
            CollectionAssert.IsEmpty(s2.GetMetadataStructures(nothing));

            CollectionAssert.IsNotEmpty(s2.GetMetadataflows("TEST_AGENCY"));
            CollectionAssert.IsEmpty(s2.GetMetadataflows("NOTHING"));
            CollectionAssert.IsNotEmpty(
                s2.GetMetadataflows(
                    new MaintainableRefObjectImpl(metadataFlow.AgencyId, metadataFlow.Id, metadataFlow.Version)));
            CollectionAssert.IsNotEmpty(s2.GetMetadataflows(wildCard));
            CollectionAssert.IsEmpty(s2.GetMetadataflows(nothing));

            CollectionAssert.IsNotEmpty(s2.GetOrganisationUnitSchemes("TEST_AGENCY"));
            CollectionAssert.IsEmpty(s2.GetOrganisationUnitSchemes("NOTHING"));
            CollectionAssert.IsNotEmpty(
                s2.GetOrganisationUnitSchemes(
                    new MaintainableRefObjectImpl(
                        organisationUnitSchemeObject.AgencyId, 
                        organisationUnitSchemeObject.Id, 
                        organisationUnitSchemeObject.Version)));
            CollectionAssert.IsNotEmpty(s2.GetOrganisationUnitSchemes(wildCard));
            CollectionAssert.IsEmpty(s2.GetOrganisationUnitSchemes(nothing));

            CollectionAssert.IsNotEmpty(s2.GetProcesses("TEST_AGENCY"));
            CollectionAssert.IsEmpty(s2.GetProcesses("NOTHING"));
            CollectionAssert.IsNotEmpty(
                s2.GetProcesses(
                    new MaintainableRefObjectImpl(processObject.AgencyId, processObject.Id, processObject.Version)));
            CollectionAssert.IsNotEmpty(s2.GetProcesses(wildCard));
            CollectionAssert.IsEmpty(s2.GetProcesses(nothing));

            CollectionAssert.IsNotEmpty(s2.GetProvisionAgreements("TEST_AGENCY"));
            CollectionAssert.IsEmpty(s2.GetProvisionAgreements("NOTHING"));
            CollectionAssert.IsNotEmpty(
                s2.GetProvisionAgreements(
                    new MaintainableRefObjectImpl(
                        provisionAgreementObject.AgencyId, provisionAgreementObject.Id, provisionAgreementObject.Version)));
            CollectionAssert.IsNotEmpty(s2.GetProvisionAgreements(wildCard));
            CollectionAssert.IsEmpty(s2.GetProvisionAgreements(nothing));

            CollectionAssert.IsNotEmpty(s2.GetRegistrations("TEST_AGENCY"));
            CollectionAssert.IsEmpty(s2.GetRegistrations("NOTHING"));
            CollectionAssert.IsNotEmpty(
                s2.GetRegistrations(
                    new MaintainableRefObjectImpl(
                        registrationObject.AgencyId, registrationObject.Id, registrationObject.Version)));
            CollectionAssert.IsNotEmpty(s2.GetRegistrations(wildCard));
            CollectionAssert.IsEmpty(s2.GetRegistrations(nothing));

            CollectionAssert.IsNotEmpty(s2.GetReportingTaxonomys("TEST_AGENCY"));
            CollectionAssert.IsEmpty(s2.GetReportingTaxonomys("NOTHING"));
            CollectionAssert.IsNotEmpty(
                s2.GetReportingTaxonomys(
                    new MaintainableRefObjectImpl(
                        reportingTaxonomyObject.AgencyId, reportingTaxonomyObject.Id, reportingTaxonomyObject.Version)));
            CollectionAssert.IsNotEmpty(s2.GetReportingTaxonomys(wildCard));
            CollectionAssert.IsEmpty(s2.GetReportingTaxonomys(nothing));

            CollectionAssert.IsNotEmpty(s2.GetStructureSets("TEST_AGENCY"));
            CollectionAssert.IsEmpty(s2.GetStructureSets("NOTHING"));
            CollectionAssert.IsNotEmpty(
                s2.GetStructureSets(
                    new MaintainableRefObjectImpl(
                        structureSetObject.AgencyId, structureSetObject.Id, structureSetObject.Version)));
            CollectionAssert.IsNotEmpty(s2.GetStructureSets(wildCard));
            CollectionAssert.IsEmpty(s2.GetStructureSets(nothing));

            CollectionAssert.IsNotEmpty(s2.GetSubscriptions("TEST_AGENCY"));
            CollectionAssert.IsEmpty(s2.GetSubscriptions("NOTHING"));
            CollectionAssert.IsNotEmpty(
                s2.GetSubscriptions(
                    new MaintainableRefObjectImpl(
                        subscriptionObject.AgencyId, subscriptionObject.Id, subscriptionObject.Version)));
            CollectionAssert.IsNotEmpty(s2.GetSubscriptions(wildCard));
            CollectionAssert.IsEmpty(s2.GetSubscriptions(nothing));

            Assert.IsTrue(s2.HasStructures());
            foreach (SdmxStructureType structureType in SdmxStructureType.Values)
            {
                if (structureType.IsMaintainable)
                {
                    CollectionAssert.IsNotEmpty(s2.GetMaintainables(structureType.EnumType));
                    CollectionAssert.IsEmpty(s3.GetMaintainables(structureType.EnumType));
                }
            }

            var mutableObjects = s2.MutableObjects;
            Assert.IsNotNull(mutableObjects);
            
            var s5 = new SdmxObjectsImpl(new HeaderImpl("PAOK", "OLE"), s2.Dataflows);
            CollectionAssert.IsNotEmpty(s5.Dataflows);
            CollectionAssert.IsNotEmpty(s5.GetAllMaintainables(SdmxStructureEnumType.HierarchicalCodelist));
            CollectionAssert.IsEmpty(s5.GetAllMaintainables(SdmxStructureEnumType.Dataflow));
        }
        protected void btnDuplicate_Click(object sender, EventArgs e)
        {
            string Error = ValidateDSDData();

            if (Error != String.Empty)
            {
                OpenDuplicatePopUp();
                Utils.ShowDialog(Error, 300, Resources.Messages.err_duplicate_artefact);
                return;
            }

            if ( ucMaintanableArtefact.Id.ToString().Equals( txtDSDID.Text.Trim() )
                &&  ucMaintanableArtefact.AgencyId.ToString().Equals( cmbAgencies.SelectedValue.ToString().Trim() )
                && ucMaintanableArtefact.Version.ToString().Equals( txtVersion.Text.Trim() ) )
            {
                OpenDuplicatePopUp();
                Utils.ShowDialog( Resources.Messages.equal_global_identificators );
                return;
            }

            ucMaintanableArtefact.Id = txtDSDID.Text;
            ucMaintanableArtefact.AgencyId = cmbAgencies.SelectedValue;
            ucMaintanableArtefact.Version = txtVersion.Text;
            ucMaintanableArtefact.FinalStructure = TertiaryBool.ParseBoolean(false);

            ISdmxObjects sdmxObjects = new SdmxObjectsImpl();
            ISdmxObjects tmpSdmxObject = null;
            WSModel tmpWsModel = new WSModel();
            bool itemAdded = false;
            switch (ucStructureType)
            {
                case SdmxStructureEnumType.AgencyScheme:
                    sdmxObjects.AddAgencyScheme((Org.Sdmxsource.Sdmx.Api.Model.Objects.Base.IAgencyScheme)ucMaintanableArtefact.ImmutableInstance);
                    break;
                case SdmxStructureEnumType.Categorisation:
                    sdmxObjects.AddCategorisation((Org.Sdmxsource.Sdmx.Api.Model.Objects.CategoryScheme.ICategorisationObject)ucMaintanableArtefact.ImmutableInstance);
                    break;
                case SdmxStructureEnumType.CategoryScheme:
                    sdmxObjects.AddCategoryScheme((Org.Sdmxsource.Sdmx.Api.Model.Objects.CategoryScheme.ICategorySchemeObject)ucMaintanableArtefact.ImmutableInstance);
                    break;
                case SdmxStructureEnumType.CodeList:
                    try
                    {
                        tmpSdmxObject = tmpWsModel.GetCodeList(new ArtefactIdentity( txtDSDID.Text.Trim(), cmbAgencies.SelectedValue.ToString().Trim(),txtVersion.Text.Trim() ) , true ,false );
                    }
                    catch (Exception ex)
                    {
                        if ( ex.Message.ToLower().Equals( "no results found" ) )
                        {
                            sdmxObjects.AddCodelist((Org.Sdmxsource.Sdmx.Api.Model.Objects.Codelist.ICodelistObject)ucMaintanableArtefact.ImmutableInstance);
                            itemAdded = true;
                        }
                    }
                    if ( !itemAdded )
                    {
                        Utils.ShowDialog( "Oggetto già presente nel database" );
                        return;
                    }
                    break;
                case SdmxStructureEnumType.ConceptScheme:
                    try
                    {
                        tmpSdmxObject = tmpWsModel.GetConceptScheme(new ArtefactIdentity( txtDSDID.Text.Trim(), cmbAgencies.SelectedValue.ToString().Trim(),txtVersion.Text.Trim() ) , true ,false );
                    }
                    catch (Exception ex)
                    {
                        if ( ex.Message.ToLower().Equals( "no results found" ) )
                        {
                            sdmxObjects.AddConceptScheme((Org.Sdmxsource.Sdmx.Api.Model.Objects.ConceptScheme.IConceptSchemeObject)ucMaintanableArtefact.ImmutableInstance);
                            itemAdded = true;
                        }
                    }
                    if ( !itemAdded )
                    {
                        Utils.ShowDialog( "Oggetto già presente nel database" );
                        return;
                    }
                    break;
                case SdmxStructureEnumType.ContentConstraint:
                    try
                    {
                        tmpSdmxObject = tmpWsModel.GetContentConstraint(new ArtefactIdentity( txtDSDID.Text.Trim(), cmbAgencies.SelectedValue.ToString().Trim(),txtVersion.Text.Trim() ) , true ,false );
                    }
                    catch (Exception ex)
                    {
                        if ( ex.Message.ToLower().Equals( "no results found" ) )
                        {
                             sdmxObjects.AddContentConstraintObject((Org.Sdmxsource.Sdmx.Api.Model.Objects.Registry.IContentConstraintObject)ucMaintanableArtefact.ImmutableInstance);
                             itemAdded = true;
                        }
                    }
                    if ( !itemAdded )
                    {
                        Utils.ShowDialog( "Oggetto già presente nel database" );
                        return;
                    }
                    break;
                case SdmxStructureEnumType.DataConsumerScheme:
                    try
                    {
                        tmpSdmxObject = tmpWsModel.GetDataConsumerScheme(new ArtefactIdentity( txtDSDID.Text.Trim(), cmbAgencies.SelectedValue.ToString().Trim(),txtVersion.Text.Trim() ) , true ,false );
                    }
                    catch (Exception ex)
                    {
                        if ( ex.Message.ToLower().Equals( "no results found" ) )
                        {
                             sdmxObjects.AddDataConsumerScheme((Org.Sdmxsource.Sdmx.Api.Model.Objects.Base.IDataConsumerScheme)ucMaintanableArtefact.ImmutableInstance);
                             itemAdded = true;
                        }
                    }
                    if ( !itemAdded )
                    {
                        Utils.ShowDialog( "Oggetto già presente nel database" );
                        return;
                    }
                    break;
                case SdmxStructureEnumType.DataProviderScheme:
                    try
                    {
                        tmpSdmxObject = tmpWsModel.GetDataProviderScheme(new ArtefactIdentity( txtDSDID.Text.Trim(), cmbAgencies.SelectedValue.ToString().Trim(),txtVersion.Text.Trim() ) , true ,false );
                    }
                    catch (Exception ex)
                    {
                        if ( ex.Message.ToLower().Equals( "no results found" ) )
                        {
                             sdmxObjects.AddDataProviderScheme((Org.Sdmxsource.Sdmx.Api.Model.Objects.Base.IDataProviderScheme)ucMaintanableArtefact.ImmutableInstance);
                            itemAdded = true;
                        }
                    }
                    if ( !itemAdded )
                    {
                        Utils.ShowDialog( "Oggetto già presente nel database" );
                        return;
                    }
                    break;
                case SdmxStructureEnumType.Dataflow:
                    try
                    {
                        tmpSdmxObject = tmpWsModel.GetDataFlow(new ArtefactIdentity( txtDSDID.Text.Trim(), cmbAgencies.SelectedValue.ToString().Trim(),txtVersion.Text.Trim() ) , true ,false );
                    }
                    catch (Exception ex)
                    {
                        if ( ex.Message.ToLower().Equals( "no results found" ) )
                        {
                            sdmxObjects.AddDataflow((IDataflowObject)ucMaintanableArtefact.ImmutableInstance);
                             itemAdded = true;
                        }
                    }
                    if ( !itemAdded )
                    {
                        Utils.ShowDialog( "Oggetto già presente nel database" );
                        return;
                    }
                    break;
                case SdmxStructureEnumType.Dsd:
                    try
                    {
                        tmpSdmxObject = tmpWsModel.GetDataStructure(new ArtefactIdentity( txtDSDID.Text.Trim(), cmbAgencies.SelectedValue.ToString().Trim(),txtVersion.Text.Trim() ) , true ,false );
                    }
                    catch (Exception ex)
                    {
                        if ( ex.Message.ToLower().Equals( "no results found" ) )
                        {
                            sdmxObjects.AddDataStructure((IDataStructureObject)ucMaintanableArtefact.ImmutableInstance);
                            itemAdded = true;
                        }
                    }
                    if ( !itemAdded )
                    {
                        Utils.ShowDialog( "Oggetto già presente nel database" );
                        return;
                    }
                    break;
                case SdmxStructureEnumType.HierarchicalCodelist:

                    sdmxObjects.AddHierarchicalCodelist((Org.Sdmxsource.Sdmx.Api.Model.Objects.Codelist.IHierarchicalCodelistObject)ucMaintanableArtefact.ImmutableInstance);
                    break;
                case SdmxStructureEnumType.OrganisationUnitScheme:
                    try
                    {
                        tmpSdmxObject = tmpWsModel.GetOrganisationUnitScheme(new ArtefactIdentity( txtDSDID.Text.Trim(), cmbAgencies.SelectedValue.ToString().Trim(),txtVersion.Text.Trim() ) , true ,false );
                    }
                    catch (Exception ex)
                    {
                        if ( ex.Message.ToLower().Equals( "no results found" ) )
                        {
                           sdmxObjects.AddOrganisationUnitScheme((Org.Sdmxsource.Sdmx.Api.Model.Objects.Base.IOrganisationUnitSchemeObject)ucMaintanableArtefact.ImmutableInstance);
                         itemAdded = true;
                        }
                    }
                    if ( !itemAdded )
                    {
                        Utils.ShowDialog( "Oggetto già presente nel database" );
                        return;
                    }
                    break;
                case SdmxStructureEnumType.StructureSet:
                    try
                    {
                        tmpSdmxObject = tmpWsModel.GetStructureSet(new ArtefactIdentity( txtDSDID.Text.Trim(), cmbAgencies.SelectedValue.ToString().Trim(),txtVersion.Text.Trim() ) , true ,false );
                    }
                    catch (Exception ex)
                    {
                        if ( ex.Message.ToLower().Equals( "no results found" ) )
                        {
                            sdmxObjects.AddStructureSet((Org.Sdmxsource.Sdmx.Api.Model.Objects.Mapping.IStructureSetObject)ucMaintanableArtefact.ImmutableInstance);
                            itemAdded = true;
                        }
                    }
                    if ( !itemAdded )
                    {
                        Utils.ShowDialog( "Oggetto già presente nel database" );
                        return;
                    }
                    break;
            }

            WSModel wsModel = new WSModel();
            XmlDocument xRet = wsModel.SubmitStructure(sdmxObjects);

            string err = Utils.GetXMLResponseError(xRet);

            if (err != "")
            {
                Utils.ShowDialog(err);
                return;
            }

            ucMaintanableArtefact.Id = lblArtID.Text;
            ucMaintanableArtefact.AgencyId = lblArtAgency.Text;
            ucMaintanableArtefact.Version = lblArtVersion.Text;

            Utils.ShowDialog(Resources.Messages.succ_operation);
            Utils.ResetBeforeUnload();
            //Utils.AppendScript("location.href='./KeyFamily.aspx';");
        }
Beispiel #5
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="query"></param>
        /// <param name="operation"></param>
        private ISdmxObjects WSExecute(ArtefactIdentity artIdentity, WSConstants.wsOperation operation, bool stub, bool withLike)
        {
            XmlDocument xDomOutput = new XmlDocument();

            WSUtils wsUtils = new WSUtils();

            ISdmxObjects SdmxObject, FilteredSdmxObject;

            FilteredSdmxObject = new SdmxObjectsImpl();

            try
            {
                // File di appoggio per la creazione del xDom
                string OutputFilePath = HttpContext.Current.Server.MapPath("OutputFiles" + "\\" + HttpContext.Current.Session.SessionID + ".xml");

                WsConfigurationSettings wsSettings = null;

                if (operation == WSConstants.wsOperation.GetDataStructureWithRef)
                {
                    wsSettings = wsUtils.GetSettings(WSConstants.wsOperation.GetDataStructure.ToString());
                }
                else
                {
                    wsSettings = wsUtils.GetSettings(FindException(operation));
                }

                XmlDocument xDom = new XmlDocument();

                // Carico il template
                xDom.Load(getTemplate(operation));

                // Imposto ID,Agency e Version
                if (!withLike && artIdentity != null)
                    SetKey(ref xDom, artIdentity);
                else
                    RemoveFilter(xDom);

                if (stub)
                    SetStub(ref xDom);

                FlyCallWS.Streaming.CallWS objWS = new FlyCallWS.Streaming.CallWS(OutputFilePath, WSConstants.MaxOutputFileLength);

                xDomOutput.InnerXml = objWS.SendSOAPQuery(xDom, wsSettings);

                File.Delete(OutputFilePath);

                SdmxObject = LoadSDMXObject(xDomOutput);

                if (withLike && !IsNullOrEmptyArtefactIdentity(artIdentity))
                    switch (operation)
                    {
                        case WSConstants.wsOperation.GetAgencyScheme:
                            var filteredAgency = SdmxObject.AgenciesSchemes.Where(i => i.Id.ToUpper().Contains(artIdentity.ID.ToUpper()) && i.AgencyId.ToUpper().Contains(artIdentity.Agency.ToUpper()) && i.Version.ToUpper().Contains(artIdentity.Version.ToUpper()));
                            foreach (Org.Sdmxsource.Sdmx.Api.Model.Objects.Base.IAgencyScheme ag in filteredAgency)
                            {
                                if ((artIdentity.IsFinal == null || !(bool)artIdentity.IsFinal) || (bool)artIdentity.IsFinal && ag.IsFinal.IsTrue)
                                    FilteredSdmxObject.AddAgencyScheme(ag);
                            }
                            break;
                        case WSConstants.wsOperation.GetCategorisation:
                            var filteredCat = SdmxObject.Categorisations.Where(i => i.Id.ToUpper().Contains(artIdentity.ID.ToUpper()) && i.AgencyId.ToUpper().Contains(artIdentity.Agency.ToUpper()) && i.Version.ToUpper().Contains(artIdentity.Version.ToUpper()));
                            foreach (Org.Sdmxsource.Sdmx.Api.Model.Objects.CategoryScheme.ICategorisationObject cat in filteredCat)
                            {
                                if ((artIdentity.IsFinal == null || !(bool)artIdentity.IsFinal) || (bool)artIdentity.IsFinal && cat.IsFinal.IsTrue)
                                    FilteredSdmxObject.AddCategorisation(cat);
                            }
                            break;
                        case WSConstants.wsOperation.GetCategoryScheme:
                            var filteredCS = SdmxObject.CategorySchemes.Where(i => i.Id.ToUpper().Contains(artIdentity.ID.ToUpper()) && i.AgencyId.ToUpper().Contains(artIdentity.Agency.ToUpper()) && i.Version.ToUpper().Contains(artIdentity.Version.ToUpper()));
                            foreach (Org.Sdmxsource.Sdmx.Api.Model.Objects.CategoryScheme.ICategorySchemeObject cat in filteredCS)
                            {
                                if ((artIdentity.IsFinal == null || !(bool)artIdentity.IsFinal) || (bool)artIdentity.IsFinal && cat.IsFinal.IsTrue)
                                    FilteredSdmxObject.AddCategoryScheme(cat);
                            }
                            break;
                        case WSConstants.wsOperation.GetCodelist:
                            var filteredCL = SdmxObject.Codelists.Where(i => i.Id.ToUpper().Contains(artIdentity.ID.ToUpper()) && i.AgencyId.ToUpper().Contains(artIdentity.Agency.ToUpper()) && i.Version.ToUpper().Contains(artIdentity.Version.ToUpper()));
                            foreach (Org.Sdmxsource.Sdmx.Api.Model.Objects.Codelist.ICodelistObject cl in filteredCL)
                            {
                                if ((artIdentity.IsFinal == null || !(bool)artIdentity.IsFinal) || (bool)artIdentity.IsFinal && cl.IsFinal.IsTrue)
                                    FilteredSdmxObject.AddCodelist(cl);
                            }
                            break;
                        case WSConstants.wsOperation.GetConceptScheme:
                            var filteredCoS = SdmxObject.ConceptSchemes.Where(i => i.Id.ToUpper().Contains(artIdentity.ID.ToUpper()) && i.AgencyId.ToUpper().Contains(artIdentity.Agency.ToUpper()) && i.Version.ToUpper().Contains(artIdentity.Version.ToUpper()));
                            foreach (Org.Sdmxsource.Sdmx.Api.Model.Objects.ConceptScheme.IConceptSchemeObject x in filteredCoS)
                            {
                                if ((artIdentity.IsFinal == null || !(bool)artIdentity.IsFinal) || (bool)artIdentity.IsFinal && x.IsFinal.IsTrue)
                                    FilteredSdmxObject.AddConceptScheme(x);
                            }
                            break;
                        case WSConstants.wsOperation.GetDataflow:
                            var filteredDF = SdmxObject.Dataflows.Where(i => i.Id.ToUpper().Contains(artIdentity.ID.ToUpper()) && i.AgencyId.ToUpper().Contains(artIdentity.Agency.ToUpper()) && i.Version.ToUpper().Contains(artIdentity.Version.ToUpper()));
                            foreach (Org.Sdmxsource.Sdmx.Api.Model.Objects.DataStructure.IDataflowObject x in filteredDF)
                            {
                                if ((artIdentity.IsFinal == null || !(bool)artIdentity.IsFinal) || (bool)artIdentity.IsFinal && x.IsFinal.IsTrue)
                                    FilteredSdmxObject.AddDataflow(x);
                            }
                            break;
                        case WSConstants.wsOperation.GetStructureSet:
                            var filteredSS = SdmxObject.StructureSets.Where(i => i.Id.ToUpper().Contains(artIdentity.ID.ToUpper()) && i.AgencyId.ToUpper().Contains(artIdentity.Agency.ToUpper()) && i.Version.ToUpper().Contains(artIdentity.Version.ToUpper()));
                            foreach (Org.Sdmxsource.Sdmx.Api.Model.Objects.Mapping.IStructureSetObject x in filteredSS)
                            {
                                if ((artIdentity.IsFinal == null || !(bool)artIdentity.IsFinal) || (bool)artIdentity.IsFinal && x.IsFinal.IsTrue)
                                    FilteredSdmxObject.AddStructureSet(x);
                            }
                            break;
                        case WSConstants.wsOperation.GetContentConstraint:
                            var filteredCC = SdmxObject.ContentConstraintObjects.Where(i => i.Id.ToUpper().Contains(artIdentity.ID.ToUpper()) && i.AgencyId.ToUpper().Contains(artIdentity.Agency.ToUpper()) && i.Version.ToUpper().Contains(artIdentity.Version.ToUpper()));
                            foreach (Org.Sdmxsource.Sdmx.Api.Model.Objects.Registry.IContentConstraintObject x in filteredCC)
                            {
                                if ((artIdentity.IsFinal == null || !(bool)artIdentity.IsFinal) || (bool)artIdentity.IsFinal && x.IsFinal.IsTrue)
                                    FilteredSdmxObject.AddContentConstraintObject(x);
                            }
                            break;
                        case WSConstants.wsOperation.GetOrganisationUnitScheme:
                            var filteredOU = SdmxObject.OrganisationUnitSchemes.Where(i => i.Id.ToUpper().Contains(artIdentity.ID.ToUpper()) && i.AgencyId.ToUpper().Contains(artIdentity.Agency.ToUpper()) && i.Version.ToUpper().Contains(artIdentity.Version.ToUpper()));
                            foreach (Org.Sdmxsource.Sdmx.Api.Model.Objects.Base.IOrganisationUnitSchemeObject x in filteredOU)
                            {
                                if ((artIdentity.IsFinal == null || !(bool)artIdentity.IsFinal) || (bool)artIdentity.IsFinal && x.IsFinal.IsTrue)
                                    FilteredSdmxObject.AddOrganisationUnitScheme(x);
                            }
                            break;
                        case WSConstants.wsOperation.GetDataConsumerScheme:
                            var filteredDC = SdmxObject.DataConsumerSchemes.Where(i => i.Id.ToUpper().Contains(artIdentity.ID.ToUpper()) && i.AgencyId.ToUpper().Contains(artIdentity.Agency.ToUpper()) && i.Version.ToUpper().Contains(artIdentity.Version.ToUpper()));
                            foreach (Org.Sdmxsource.Sdmx.Api.Model.Objects.Base.IDataConsumerScheme x in filteredDC)
                            {
                                if ((artIdentity.IsFinal == null || !(bool)artIdentity.IsFinal) || (bool)artIdentity.IsFinal && x.IsFinal.IsTrue)
                                    FilteredSdmxObject.AddDataConsumerScheme(x);
                            }
                            break;
                        case WSConstants.wsOperation.GetDataProviderScheme:
                            var filteredDP = SdmxObject.DataProviderSchemes.Where(i => i.Id.ToUpper().Contains(artIdentity.ID.ToUpper()) && i.AgencyId.ToUpper().Contains(artIdentity.Agency.ToUpper()) && i.Version.ToUpper().Contains(artIdentity.Version.ToUpper()));
                            foreach (Org.Sdmxsource.Sdmx.Api.Model.Objects.Base.IDataProviderScheme x in filteredDP)
                            {
                                if ((artIdentity.IsFinal == null || !(bool)artIdentity.IsFinal) || (bool)artIdentity.IsFinal && x.IsFinal.IsTrue)
                                    FilteredSdmxObject.AddDataProviderScheme(x);
                            }
                            break;
                        case WSConstants.wsOperation.GetDataStructureWithRef:
                        case WSConstants.wsOperation.GetDataStructure:
                            var filteredDSD = SdmxObject.DataStructures.Where(i => i.Id.ToUpper().Contains(artIdentity.ID.ToUpper()) && i.AgencyId.ToUpper().Contains(artIdentity.Agency.ToUpper()) && i.Version.ToUpper().Contains(artIdentity.Version.ToUpper()));
                            foreach (Org.Sdmxsource.Sdmx.Api.Model.Objects.DataStructure.IDataStructureObject x in filteredDSD)
                            {
                                if ((artIdentity.IsFinal == null || !(bool)artIdentity.IsFinal) || (bool)artIdentity.IsFinal && x.IsFinal.IsTrue)
                                    FilteredSdmxObject.AddDataStructure(x);
                            }
                            break;
                        case WSConstants.wsOperation.GetHierarchicalCodelist:
                            var filteredHcl = SdmxObject.HierarchicalCodelists.Where(i => i.Id.ToUpper().Contains(artIdentity.ID.ToUpper()) && i.AgencyId.ToUpper().Contains(artIdentity.Agency.ToUpper()) && i.Version.ToUpper().Contains(artIdentity.Version.ToUpper()));
                            foreach (Org.Sdmxsource.Sdmx.Api.Model.Objects.Codelist.IHierarchicalCodelistObject x in filteredHcl)
                            {
                                if ((artIdentity.IsFinal == null || !(bool)artIdentity.IsFinal) || (bool)artIdentity.IsFinal && x.IsFinal.IsTrue)
                                    FilteredSdmxObject.AddHierarchicalCodelist(x);
                            }
                            break;
                        case WSConstants.wsOperation.GetStructures:
                            break;
                        default:
                            FilteredSdmxObject = SdmxObject;
                            break;
                    }
                else
                    FilteredSdmxObject = SdmxObject;

                return FilteredSdmxObject;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }