예제 #1
0
        /// <summary>
        /// The write structure to file.
        /// </summary>
        /// <param name="outputFormat">
        /// The output format.
        /// </param>
        /// <param name="outputStream">
        /// The output stream.
        /// </param>
        public void writeStructureToFile(IStructureFormat outputFormat, Stream outputStream)
        {
            ISdmxObjects sdmxObjects = new SdmxObjectsImpl();

            sdmxObjects.AddAgencyScheme(this.structuresCreator.BuildAgencyScheme());
            sdmxObjects.AddCodelist(this.structuresCreator.BuildCountryCodelist());
            sdmxObjects.AddCodelist(this.structuresCreator.BuildIndicatorCodelist());
            sdmxObjects.AddConceptScheme(this.structuresCreator.BuildConceptScheme());

            IDataStructureObject dsd = this.structuresCreator.BuildDataStructure();
            sdmxObjects.AddDataStructure(dsd);
            sdmxObjects.AddDataflow(this.structuresCreator.BuildDataflow("DF_WDI", "World Development Indicators", dsd));

            this.swm.WriteStructures(sdmxObjects, outputFormat, outputStream);
        }
        public static void DeleteCubeView(int idSet)
        {
            BuilderProcedure bp = new BuilderProcedure();
            SDMXIdentifier sdmxDSDKey = DataAccess.GetIdentifierFromIDSet(idSet);

            try
            {
                if (sdmxDSDKey != null)
                {
                    ISdmxObjects sdmxObjectDel = new SdmxObjectsImpl();

                    List<SDMXIdentifier> lCatsIdentifiers = DataSDMX.Get_CategorisationIdentifierFromIdFlow(DataAccess.GetDataflowIDFromIDSet(idSet));

                    ICategorisationObject cat = null;

                    foreach (SDMXIdentifier ident in lCatsIdentifiers)
                    {
                        cat = DataSDMX.GetCategorisation(ident, true);
                        if (cat != null)
                            sdmxObjectDel.AddCategorisation(cat);
                    }

                    IDataflowObject df = DataSDMX.GetDataflow(sdmxDSDKey, true);
                    IDataStructureObject dsd = DataSDMX.GetDSD(sdmxDSDKey, true);

                    if (df != null)
                        sdmxObjectDel.AddDataflow(df);

                    if (dsd != null)
                        sdmxObjectDel.AddDataStructure(dsd);

                    DataSDMX.DeleteStructure(sdmxObjectDel);
                }

                bp.Delete_DATASET(idSet);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="TestWsRetrieverFactory" /> class.
        /// </summary>
        public TestWsRetrieverFactory()
        {
            ISdmxObjects sdmxObjects = new SdmxObjectsImpl();
            using (var stream = GetResource("ESTAT+STS+2.0.xml"))
            {
                Merge(stream, sdmxObjects);
            }

            using (var stream = GetResource("ESTAT+DEMOGRAPHY+2.1.xml"))
            {
                Merge(stream, sdmxObjects);
            }

            var sts = sdmxObjects.GetDataStructures(new MaintainableRefObjectImpl(null, "STS", null)).Select(o => o.AsReference).FirstOrDefault();
            var demo = sdmxObjects.GetDataStructures(new MaintainableRefObjectImpl(null, "DEMOGRAPHY", null)).Select(o => o.AsReference).FirstOrDefault();
            sdmxObjects.AddDataflow(BuildDataflow(Dataflows.NoResults, sts));
            sdmxObjects.AddDataflow(BuildDataflow(Dataflows.ResponseExceedsLimit, sts));
            sdmxObjects.AddDataflow(BuildDataflow(Dataflows.ResponseTooLarge, sts));
            sdmxObjects.AddDataflow(BuildDataflow(Dataflows.Semantic, sts));
            sdmxObjects.AddDataflow(BuildDataflow(Dataflows.TimeSeries, sts));
            sdmxObjects.AddDataflow(BuildDataflow(Dataflows.CrossV20Only, demo));

            InMemoryRetrievalManager retrievalManager = new InMemoryRetrievalManager(sdmxObjects);
            retrievalManager.CrossReferenceRetrievalManager = new CrossReferencedRetrievalManager(retrievalManager);
            this._sdmxObjectRetrievalManager = retrievalManager;
            this._mutableStructureSearchManager = new SampleStructureSearchManager(this._sdmxObjectRetrievalManager);
            this._sampleAdvancedMutableStructureSearchManager = new SampleAdvancedMutableStructureSearchManager(this._mutableStructureSearchManager);
            this._sampleAuthAdvancedStructureSearchManager = new SampleAuthAdvancedStructureSearchManager(this._sampleAdvancedMutableStructureSearchManager);
        }
        public void TestBuildComplexDataQuery()
        {
            IStructureParsingManager manager = new StructureParsingManager();
            IDataQueryParseManager queryParseManager = new DataQueryParseManager(SdmxSchemaEnumType.VersionTwoPointOne);
            IComplexDataQueryBuilderManager dataQueryBuilderManager = new ComplexDataQueryBuilderManager(new ComplexDataQueryFactoryV21());
            
            IDataflowObject dataFlow;
            IDataStructureObject dsd;
            using (var readable = new FileReadableDataLocation("tests/V21/Structure/test-sdmxv2.1-ESTAT+SSTSCONS_PROD_M+2.0.xml"))
            {
                var structureWorkspace = manager.ParseStructures(readable);
                dataFlow = structureWorkspace.GetStructureObjects(false).Dataflows.First();
            }

            using (var readable = new FileReadableDataLocation("tests/V21/Structure/test-sdmxv2.1-ESTAT+STS+2.0.xml"))
            {
                var structureWorkspace = manager.ParseStructures(readable);
                dsd = structureWorkspace.GetStructureObjects(false).DataStructures.First();
            }

            ISet<IComplexDataQuerySelection> sections = new HashSet<IComplexDataQuerySelection>();
            var freqCriteria = new ComplexDataQuerySelectionImpl("FREQ", new IComplexComponentValue[] { new ComplexComponentValueImpl("M", OrderedOperator.GetFromEnum(OrderedOperatorEnumType.Equal), SdmxStructureEnumType.Dimension), new ComplexComponentValueImpl("A", OrderedOperator.GetFromEnum(OrderedOperatorEnumType.NotEqual), SdmxStructureEnumType.Dimension), new ComplexComponentValueImpl("B", OrderedOperator.GetFromEnum(OrderedOperatorEnumType.Equal), SdmxStructureEnumType.Dimension) });
            sections.Add(freqCriteria);
            var adjustmentCriteria = new ComplexDataQuerySelectionImpl("ADJUSTMENT", new IComplexComponentValue[] { new ComplexComponentValueImpl("01", OrderedOperator.GetFromEnum(OrderedOperatorEnumType.NotEqual), SdmxStructureEnumType.Dimension),  new ComplexComponentValueImpl("S2", OrderedOperator.GetFromEnum(OrderedOperatorEnumType.NotEqual), SdmxStructureEnumType.Dimension) });
            sections.Add(adjustmentCriteria);
            var titleCriteria = new ComplexDataQuerySelectionImpl(
                "TITLE", 
                new IComplexComponentValue[] { new ComplexComponentValueImpl("PAOKARA", TextSearch.GetFromEnum(TextSearchEnumType.Contains), SdmxStructureEnumType.DataAttribute),  new ComplexComponentValueImpl("ARIS", TextSearch.GetFromEnum(TextSearchEnumType.DoesNotContain), SdmxStructureEnumType.DataAttribute) });
            sections.Add(titleCriteria);
            OrderedOperator equalOperator = OrderedOperator.GetFromEnum(OrderedOperatorEnumType.Equal);
            var dateFrom = new SdmxDateCore("2000-01");
            var dateFromOperator = OrderedOperator.GetFromEnum(OrderedOperatorEnumType.GreaterThanOrEqual);
            var primaryMeasureValue = new ComplexComponentValueImpl("200.20", OrderedOperator.GetFromEnum(OrderedOperatorEnumType.GreaterThan), SdmxStructureEnumType.PrimaryMeasure);
            ICollection<IComplexDataQuerySelectionGroup> collection = new[] { new ComplexDataQuerySelectionGroupImpl(sections, dateFrom, dateFromOperator, null, equalOperator, new HashSet<IComplexComponentValue> { primaryMeasureValue }) };

            var complexDataQueryImpl = new ComplexDataQueryImpl(
                null, 
                null, 
                null, 
                dsd, 
                dataFlow, 
                null, 
                null, 
                0, 
                null, 
                false, 
                null, 
                DimensionAtObservation.GetFromEnum(DimensionAtObservationEnumType.Time).Value, 
                false, 
                DataQueryDetail.GetFromEnum(DataQueryDetailEnumType.Full), 
                collection);

            var buildComplexDataQuery = dataQueryBuilderManager.BuildComplexDataQuery(
                complexDataQueryImpl, new StructSpecificDataFormatV21());

            var fileName = string.Format("test-TestBuildComplexDataQuery.xml");
            buildComplexDataQuery.Save(fileName);

            ISdmxObjects objects = new SdmxObjectsImpl();
            objects.AddDataStructure(dsd);
            objects.AddDataflow(dataFlow);
            ISdmxObjectRetrievalManager beanRetrievalManager = new InMemoryRetrievalManager(objects);

            IComplexDataQuery query;
            using (var readable = new FileReadableDataLocation(fileName))
            {
                XMLParser.ValidateXml(readable, SdmxSchemaEnumType.VersionTwoPointOne);

                query = queryParseManager.BuildComplexDataQuery(readable, beanRetrievalManager).First();
            }

            Assert.AreEqual(1, query.SelectionGroups.Count);
            var selectionGroup = query.SelectionGroups.First();
            Assert.AreEqual(dateFrom, selectionGroup.DateFrom);
            Assert.AreEqual(dateFromOperator, selectionGroup.DateFromOperator);
            Assert.IsNull(selectionGroup.DateTo);
            Assert.AreEqual(1, selectionGroup.PrimaryMeasureValue.Count);
            var primaryValue = selectionGroup.PrimaryMeasureValue.First();
            Assert.AreEqual(primaryMeasureValue.Value, primaryValue.Value);
            Assert.AreEqual(primaryMeasureValue.OrderedOperator, primaryValue.OrderedOperator);
            Assert.AreEqual(3, selectionGroup.Selections.Count);

            var gotFreqCriteria = selectionGroup.GetSelectionsForConcept(freqCriteria.ComponentId);
            Assert.AreEqual(gotFreqCriteria, freqCriteria, "FREQ diff");
            
            var gotAdjustmentCriteria = selectionGroup.GetSelectionsForConcept(adjustmentCriteria.ComponentId);
            Assert.AreEqual(gotAdjustmentCriteria, adjustmentCriteria, "ADJ diff");
            Assert.IsTrue(gotAdjustmentCriteria.Values.All(value => value.OrderedOperator.EnumType == OrderedOperatorEnumType.NotEqual));

            var gotTitleCriteria = selectionGroup.GetSelectionsForConcept(titleCriteria.ComponentId);
            Assert.AreEqual(gotTitleCriteria, titleCriteria, "TITLE diff");
        }
예제 #5
0
        /// <summary>
        /// Create a SdmxObjects from all parameter configured
        /// </summary>
        /// <returns>SdmxObject for write message</returns>
        public ISdmxObjects CreateDSD()
        {
            try
            {
                StringBuilder sdmxObjectDescription = new StringBuilder();
                sdmxObjectDescription.AppendLine();
                ISdmxObjects sdmxObject = new SdmxObjectsImpl();
                sdmxObject.Header = FlyConfiguration.HeaderSettings.GetHeader();
                //sdmxObject.AddRegistration(


                if (_CategorySchemeObject != null)
                {
                    foreach (ICategorySchemeObject CSObj in _CategorySchemeObject)
                    {
                        sdmxObject.AddCategoryScheme(CSObj);
                        sdmxObjectDescription.AppendLine(string.Format("CategoryScheme: {0} category", CSObj.Items == null ? 0 : CSObj.Items.Count));
                    }
                }
                if (_CategorisationObject != null)
                {
                    foreach (var categorisation in _CategorisationObject)
                    {
                        sdmxObject.AddCategorisation(categorisation);
                    }
                    sdmxObjectDescription.AppendLine(string.Format("Categorisation: {0} categorisation", _CategorisationObject.Count));
                }


                if (_AgencyScheme != null)
                {
                    sdmxObject.AddAgencyScheme(_AgencyScheme);
                    sdmxObjectDescription.AppendLine(string.Format("AgencyScheme"));
                }

                if (_Codelists != null)
                {
                    try
                    {
                        int totalcode = 0;
                        _Codelists.ForEach(cl =>
                        {
                            sdmxObject.AddCodelist(cl.ImmutableInstance);
                            totalcode += cl.Items.Count;
                        });
                        sdmxObjectDescription.AppendLine(string.Format("Codelists: {0} codelists, {1} code_objects", _Codelists.Count, totalcode));
                    }
                    catch (SdmxException) { throw; }
                    catch (Exception ex)
                    {
                        throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.CreateImmutable, ex);
                    }
                }

                if (_Conceptscheme != null)
                {
                    foreach (var conceptscheme in _Conceptscheme)
                    {
                        sdmxObject.AddConceptScheme(conceptscheme);
                        sdmxObjectDescription.AppendLine(string.Format("Conceptscheme: {0} concepts -> {1}", (conceptscheme.Items == null ? 0 : conceptscheme.Items.Count), conceptscheme.Id));
                    }
                }

                if (_KeyFamily != null)
                {
                    foreach (DataStructureObjectImpl keyFamily in _KeyFamily)
                    {
                        sdmxObject.AddDataStructure(keyFamily.Immutated);
                        sdmxObjectDescription.AppendLine(string.Format("Structure: {0} dimensions, {1} attributes  -> {2}",
                                                                       keyFamily.Immutated.GetDimensions() == null ? 0 : keyFamily.Immutated.GetDimensions().Count,
                                                                       keyFamily.Attributes == null ? 0 : keyFamily.Attributes.Count, keyFamily.Id));
                    }
                }

                if (_Dataflows != null)
                {
                    _Dataflows.ForEach(df => sdmxObject.AddDataflow(df));
                    sdmxObjectDescription.AppendLine(string.Format("Dataflows: {0} dataflows", _Dataflows.Count));
                }

                FlyLog.WriteLog(this, FlyLog.LogTypeEnum.All, @"Writing sdmxObject complete succesfully. the Sdmx Contains: {0}", sdmxObjectDescription.ToString().Trim());


                return(sdmxObject);
            }
            catch (SdmxException) { throw; }
            catch (Exception ex)
            {
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.CreateDSDObject, ex);
            }
        }
        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';");
        }
예제 #7
0
        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));
        }
예제 #8
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;
            }
        }
        private ISdmxObjects GetSdmxObjectArtefact(string artefactType, ArtefactIdentity ai)
        {
            ISdmxObjects sdmxObject = new SdmxObjectsImpl();

            switch (artefactType.ToUpper())
            {
                case "DSD":
                    IDataStructureObject dsd;
                    dsd = _sdmxArtefacts.DataStructures.Where(ds => ds.AgencyId == ai.Agency && ds.Id == ai.ID && ds.Version == ai.Version).FirstOrDefault();
                    if (dsd != null)
                        sdmxObject.AddDataStructure(dsd);
                    break;
                case "CONCEPTSCHEME":
                    IConceptSchemeObject cs;
                    cs = _sdmxArtefacts.ConceptSchemes.Where(ds => ds.AgencyId == ai.Agency && ds.Id == ai.ID && ds.Version == ai.Version).FirstOrDefault();
                    if (cs != null)
                        sdmxObject.AddConceptScheme(cs);
                    break;
                case "CODELIST":
                    ICodelistObject cl;
                    cl = _sdmxArtefacts.Codelists.Where(ds => ds.AgencyId == ai.Agency && ds.Id == ai.ID && ds.Version == ai.Version).FirstOrDefault();
                    if (cl != null)
                        sdmxObject.AddCodelist(cl);
                    break;
                case "DATAFLOW":
                    IDataflowObject df;
                    df = _sdmxArtefacts.Dataflows.Where(ds => ds.AgencyId == ai.Agency && ds.Id == ai.ID && ds.Version == ai.Version).FirstOrDefault();
                    if (df != null)
                        sdmxObject.AddDataflow(df);
                    break;
            }

            return sdmxObject;
        }