From a67e838008471bde4b3595291e9c4682d95c75d9 Mon Sep 17 00:00:00 2001 From: James Friel Date: Fri, 25 Apr 2025 09:52:08 +0100 Subject: [PATCH 1/6] add internal switch --- .../CommandExecution/AtomicCommandFactory.cs | 15 +- .../ExecuteCommandChangeExtractability.cs | 16 +- .../ExecuteCommandMakeCatalogueInternal.cs | 82 ++++++++++ .../ExecuteCommandMakeCatalogueNotInternal.cs | 82 ++++++++++ ...cuteCommandMakeCatalogueProjectSpecific.cs | 3 - ...MakeProjectSpecificCatalogueNormalAgain.cs | 6 - .../CommandExecution/BasicActivateItems.cs | 24 +-- .../DataExport/Data/ExtractableDataSet.cs | 2 +- .../Providers/DataExportChildProvider.cs | 5 +- .../Repositories/DataExportRepository.cs | 9 +- .../CatalogueCollectionFilterUI.Designer.cs | 117 ++++++-------- .../CatalogueCollectionFilterUI.cs | 18 +-- .../CatalogueCollectionFilterUI.resx | 54 +++---- .../Filtering/CatalogueCollectionFilter.cs | 2 +- .../MainFormUITabs/CatalogueUI.Designer.cs | 145 ++++++++---------- Rdmp.UI/MainFormUITabs/CatalogueUI.cs | 1 - .../CatalogueToDatasetLinkagePieChartUI.cs | 5 - Rdmp.UI/PieCharts/GoodBadCataloguePieChart.cs | 4 - Rdmp.UI/SimpleDialogs/NewfindUI.cs | 2 - Rdmp.UI/SimpleDialogs/SelectDialog.cs | 2 - 20 files changed, 349 insertions(+), 245 deletions(-) create mode 100644 Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandMakeCatalogueInternal.cs create mode 100644 Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandMakeCatalogueNotInternal.cs diff --git a/Rdmp.Core/CommandExecution/AtomicCommandFactory.cs b/Rdmp.Core/CommandExecution/AtomicCommandFactory.cs index 38d67ded93..3f73627fc7 100644 --- a/Rdmp.Core/CommandExecution/AtomicCommandFactory.cs +++ b/Rdmp.Core/CommandExecution/AtomicCommandFactory.cs @@ -129,11 +129,16 @@ public IEnumerable CreateCommands(object o) }; if (!isApiCall) { - yield return new ExecuteCommandChangeExtractability(_activator, c) - { - Weight = -99.0010f, - SuggestedCategory = Extraction - }; + yield return c.IsInternalDataset ? + new ExecuteCommandMakeCatalogueNotInternal(_activator, c) + { + Weight = -99.0008f, + SuggestedCategory = Extraction + } : new ExecuteCommandMakeCatalogueInternal(_activator, c) + { + Weight = -99.0008f, + SuggestedCategory = Extraction + }; yield return c.IsProjectSpecific(_activator.RepositoryLocator.DataExportRepository) ? new ExecuteCommandMakeProjectSpecificCatalogueNormalAgain(_activator, c) diff --git a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandChangeExtractability.cs b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandChangeExtractability.cs index f27befd4a3..2506ff1a59 100644 --- a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandChangeExtractability.cs +++ b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandChangeExtractability.cs @@ -65,7 +65,18 @@ public override void Execute() } else { - new ExtractableDataSet(BasicActivator.RepositoryLocator.DataExportRepository, _catalogue); + var extractabilityRecord = + ((DataExportChildProvider)BasicActivator.CoreChildProvider).ExtractableDataSets.SingleOrDefault(ds => + ds.Catalogue_ID == _catalogue.ID); + if (extractabilityRecord != null) + { + extractabilityRecord.DisableExtraction = false; + extractabilityRecord.SaveToDatabase(); + } + else + { + new ExtractableDataSet(BasicActivator.RepositoryLocator.DataExportRepository, _catalogue); + } Publish(_catalogue); } } @@ -80,7 +91,8 @@ public override void Execute() } else { - extractabilityRecord.DeleteInDatabase(); + extractabilityRecord.DisableExtraction = true; + extractabilityRecord.SaveToDatabase(); Publish(_catalogue); } } diff --git a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandMakeCatalogueInternal.cs b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandMakeCatalogueInternal.cs new file mode 100644 index 0000000000..8eaef78643 --- /dev/null +++ b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandMakeCatalogueInternal.cs @@ -0,0 +1,82 @@ +// Copyright (c) The University of Dundee 2018-2019 +// This file is part of the Research Data Management Platform (RDMP). +// RDMP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +// RDMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +// You should have received a copy of the GNU General Public License along with RDMP. If not, see . + +using System; +using System.Linq; +using Rdmp.Core.Curation.Data; +using Rdmp.Core.DataExport.Data; +using Rdmp.Core.Icons.IconProvision; +using Rdmp.Core.Repositories.Construction; +using Rdmp.Core.ReusableLibraryCode.Icons.IconProvision; +using SixLabors.ImageSharp; +using SixLabors.ImageSharp.PixelFormats; + +namespace Rdmp.Core.CommandExecution.AtomicCommands; + +public class ExecuteCommandMakeCatalogueInternal : BasicCommandExecution, IAtomicCommandWithTarget +{ + private ICatalogue _catalogue; + + [UseWithObjectConstructor] + public ExecuteCommandMakeCatalogueInternal(IBasicActivateItems itemActivator, ICatalogue catalogue) : this(itemActivator) + { + SetCatalogue(catalogue); + } + + public ExecuteCommandMakeCatalogueInternal(IBasicActivateItems itemActivator) : base(itemActivator) + { + UseTripleDotSuffix = true; + } + + public override string GetCommandHelp() => + "Mark the Catalogue as Internal to restrict its extractability"; + + public override void Execute() + { + if (_catalogue == null) + SetCatalogue(SelectOne(BasicActivator.RepositoryLocator.CatalogueRepository)); + + if (_catalogue == null) + return; + + _catalogue.IsInternalDataset = true; + _catalogue.SaveToDatabase(); + Publish(_catalogue); + } + + public override Image GetImage(IIconProvider iconProvider) => + Image.Load(CatalogueIcons.Catalogue);//todo make this use the internal icon + + public IAtomicCommandWithTarget SetTarget(DatabaseEntity target) + { + switch (target) + { + case Catalogue catalogue: + SetCatalogue(catalogue); + break; + default: + break; + } + + return this; + } + + private void SetCatalogue(ICatalogue catalogue) + { + ResetImpossibleness(); + + _catalogue = catalogue; + + if (catalogue == null) + { + SetImpossible("Catalogue cannot be null"); + return; + } + + if (_catalogue.IsInternalDataset) + SetImpossible("Catalogue is already marked as Internal"); + } +} \ No newline at end of file diff --git a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandMakeCatalogueNotInternal.cs b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandMakeCatalogueNotInternal.cs new file mode 100644 index 0000000000..18f5dc8cc9 --- /dev/null +++ b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandMakeCatalogueNotInternal.cs @@ -0,0 +1,82 @@ +// Copyright (c) The University of Dundee 2018-2019 +// This file is part of the Research Data Management Platform (RDMP). +// RDMP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +// RDMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +// You should have received a copy of the GNU General Public License along with RDMP. If not, see . + +using System; +using System.Linq; +using Rdmp.Core.Curation.Data; +using Rdmp.Core.DataExport.Data; +using Rdmp.Core.Icons.IconProvision; +using Rdmp.Core.Repositories.Construction; +using Rdmp.Core.ReusableLibraryCode.Icons.IconProvision; +using SixLabors.ImageSharp; +using SixLabors.ImageSharp.PixelFormats; + +namespace Rdmp.Core.CommandExecution.AtomicCommands; + +public class ExecuteCommandMakeCatalogueNotInternal : BasicCommandExecution, IAtomicCommandWithTarget +{ + private ICatalogue _catalogue; + + [UseWithObjectConstructor] + public ExecuteCommandMakeCatalogueNotInternal(IBasicActivateItems itemActivator, ICatalogue catalogue) : this(itemActivator) + { + SetCatalogue(catalogue); + } + + public ExecuteCommandMakeCatalogueNotInternal(IBasicActivateItems itemActivator) : base(itemActivator) + { + UseTripleDotSuffix = true; + } + + public override string GetCommandHelp() => + "Mark the Catalogue as not Internal"; + + public override void Execute() + { + if (_catalogue == null) + SetCatalogue(SelectOne(BasicActivator.RepositoryLocator.CatalogueRepository)); + + if (_catalogue == null) + return; + + _catalogue.IsInternalDataset = false; + _catalogue.SaveToDatabase(); + Publish(_catalogue); + } + + public override Image GetImage(IIconProvider iconProvider) => + Image.Load(CatalogueIcons.Catalogue); + + public IAtomicCommandWithTarget SetTarget(DatabaseEntity target) + { + switch (target) + { + case Catalogue catalogue: + SetCatalogue(catalogue); + break; + default: + break; + } + + return this; + } + + private void SetCatalogue(ICatalogue catalogue) + { + ResetImpossibleness(); + + _catalogue = catalogue; + + if (catalogue == null) + { + SetImpossible("Catalogue cannot be null"); + return; + } + + if (!_catalogue.IsInternalDataset) + SetImpossible("Catalogue is not marked as Internal"); + } +} \ No newline at end of file diff --git a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandMakeCatalogueProjectSpecific.cs b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandMakeCatalogueProjectSpecific.cs index c9e0554b96..88ca2d3e3f 100644 --- a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandMakeCatalogueProjectSpecific.cs +++ b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandMakeCatalogueProjectSpecific.cs @@ -105,9 +105,6 @@ private void SetCatalogue(ICatalogue catalogue) if (status.IsProjectSpecific) SetImpossible("Catalogue is already Project Specific"); - if (!status.IsExtractable) - SetImpossible("Catalogue must first be made Extractable"); - var ei = _catalogue.GetAllExtractionInformation(ExtractionCategory.Any); if (!ei.Any()) SetImpossible("Catalogue has no extractable columns"); diff --git a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandMakeProjectSpecificCatalogueNormalAgain.cs b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandMakeProjectSpecificCatalogueNormalAgain.cs index 8a724eef0c..5ec2fbad02 100644 --- a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandMakeProjectSpecificCatalogueNormalAgain.cs +++ b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandMakeProjectSpecificCatalogueNormalAgain.cs @@ -34,12 +34,6 @@ public ExecuteCommandMakeProjectSpecificCatalogueNormalAgain(IBasicActivateItems _extractableDataSet = dataExportRepository.GetAllObjectsWithParent(catalogue) .SingleOrDefault(); - if (_extractableDataSet == null) - { - SetImpossible("Catalogue is not extractable"); - return; - } - if (_extractableDataSet.Project_ID == null) { SetImpossible("Catalogue is not a project specific Catalogue"); diff --git a/Rdmp.Core/CommandExecution/BasicActivateItems.cs b/Rdmp.Core/CommandExecution/BasicActivateItems.cs index 736008d112..94d1d75609 100644 --- a/Rdmp.Core/CommandExecution/BasicActivateItems.cs +++ b/Rdmp.Core/CommandExecution/BasicActivateItems.cs @@ -380,21 +380,21 @@ protected virtual bool InteractiveDelete(IDeleteable deletable) { case Catalogue c: { - if (c.GetExtractabilityStatus(RepositoryLocator.DataExportRepository).IsExtractable) + var extractableDataSets = RepositoryLocator.DataExportRepository.GetAllObjectsWhere("Catalogue_ID", c.ID); + if (extractableDataSets.Any()) { - if (YesNo( - "Catalogue must first be made non extractable before it can be deleted, mark non extractable?", - "Make Non Extractable")) + foreach (var ds in extractableDataSets) { - var cmd = new ExecuteCommandChangeExtractability(this, c); - cmd.Execute(); - } - else - { - return false; + var selectedDatasets = RepositoryLocator.DataExportRepository.GetAllObjectsWhere("ExtractableDataSet_ID", ds.ID); + if (selectedDatasets.Any()) + { + this.Show("Catalogue Is Used in a number of projects. Remove this catalogue from all projects to allow deletion"); + return false; + } } + //not used anywhere, we can dlete it + foreach (var ds in extractableDataSets) ds.DeleteInDatabase(); } - break; } case ExtractionFilter f: @@ -674,7 +674,7 @@ public virtual CohortHoldoutLookupRequest GetCohortHoldoutLookupRequest(External if (!TypeText("Name", "Enter name for cohort", 255, null, out var name, false)) throw new Exception("User chose not to enter a name for the cohort and none was provided"); - return new CohortHoldoutLookupRequest(cic, "empty", 1,false,"",""); + return new CohortHoldoutLookupRequest(cic, "empty", 1, false, "", ""); } /// diff --git a/Rdmp.Core/DataExport/Data/ExtractableDataSet.cs b/Rdmp.Core/DataExport/Data/ExtractableDataSet.cs index d3700bd137..2a5cfb2a77 100644 --- a/Rdmp.Core/DataExport/Data/ExtractableDataSet.cs +++ b/Rdmp.Core/DataExport/Data/ExtractableDataSet.cs @@ -153,7 +153,7 @@ public override void DeleteInDatabase() /// Returns an object indicating whether the dataset is project specific or not /// /// - public CatalogueExtractabilityStatus GetCatalogueExtractabilityStatus() => new(true, Project_ID != null); + public CatalogueExtractabilityStatus GetCatalogueExtractabilityStatus() => new(!DisableExtraction, Project_ID != null); private Lazy _catalogue; diff --git a/Rdmp.Core/Providers/DataExportChildProvider.cs b/Rdmp.Core/Providers/DataExportChildProvider.cs index df0266f273..23bce36793 100644 --- a/Rdmp.Core/Providers/DataExportChildProvider.cs +++ b/Rdmp.Core/Providers/DataExportChildProvider.cs @@ -184,10 +184,7 @@ public DataExportChildProvider(IRDMPPlatformRepositoryServiceLocator repositoryL var cataToEds = new Dictionary(ExtractableDataSets.ToDictionary(k => k.Catalogue_ID)); //inject extractability into Catalogues - foreach (var catalogue in AllCatalogues) - catalogue.InjectKnown(cataToEds.TryGetValue(catalogue.ID, out var result) - ? result.GetCatalogueExtractabilityStatus() - : new CatalogueExtractabilityStatus(false, false)); + foreach (var catalogue in AllCatalogues) catalogue.GetExtractabilityStatus(repositoryLocator.DataExportRepository); ReportProgress("Catalogue extractability injection"); diff --git a/Rdmp.Core/Repositories/DataExportRepository.cs b/Rdmp.Core/Repositories/DataExportRepository.cs index 6cb60d593b..5dcfcf422f 100644 --- a/Rdmp.Core/Repositories/DataExportRepository.cs +++ b/Rdmp.Core/Repositories/DataExportRepository.cs @@ -98,7 +98,14 @@ protected override IMapsDirectlyToDatabaseTable ConstructEntity(Type t, DbDataRe public CatalogueExtractabilityStatus GetExtractabilityStatus(ICatalogue c) { var eds = GetAllObjectsWithParent(c).SingleOrDefault(); - return eds == null ? new CatalogueExtractabilityStatus(false, false) : eds.GetCatalogueExtractabilityStatus(); + if (eds is null) + { + //if there is not EDS for this catalogue, it must have bee non extractable + eds = new ExtractableDataSet(this, c, false); + eds.SaveToDatabase(); + //todo need to publish this eds + } + return eds.GetCatalogueExtractabilityStatus(); } public ISelectedDataSets[] GetSelectedDatasetsWithNoExtractionIdentifiers() => diff --git a/Rdmp.UI/Collections/CatalogueCollectionFilterUI.Designer.cs b/Rdmp.UI/Collections/CatalogueCollectionFilterUI.Designer.cs index 0abec794e8..58cbf15e95 100644 --- a/Rdmp.UI/Collections/CatalogueCollectionFilterUI.Designer.cs +++ b/Rdmp.UI/Collections/CatalogueCollectionFilterUI.Designer.cs @@ -28,101 +28,72 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.cbShowColdStorage = new System.Windows.Forms.CheckBox(); - this.cbShowDeprecated = new System.Windows.Forms.CheckBox(); - this.cbShowInternal = new System.Windows.Forms.CheckBox(); - this.cbProjectSpecific = new System.Windows.Forms.CheckBox(); - this.cbShowNonExtractable = new System.Windows.Forms.CheckBox(); - this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); - this.flowLayoutPanel1.SuspendLayout(); - this.SuspendLayout(); - // - // cbShowColdStorage - // - this.cbShowColdStorage.AutoSize = true; - this.cbShowColdStorage.Location = new System.Drawing.Point(3, 3); - this.cbShowColdStorage.Name = "cbShowColdStorage"; - this.cbShowColdStorage.Size = new System.Drawing.Size(87, 17); - this.cbShowColdStorage.TabIndex = 5; - this.cbShowColdStorage.Text = "Cold Storage"; - this.cbShowColdStorage.UseVisualStyleBackColor = true; - this.cbShowColdStorage.CheckedChanged += new System.EventHandler(this.OnCheckboxChanged); + cbShowDeprecated = new System.Windows.Forms.CheckBox(); + cbShowInternal = new System.Windows.Forms.CheckBox(); + cbProjectSpecific = new System.Windows.Forms.CheckBox(); + flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + flowLayoutPanel1.SuspendLayout(); + SuspendLayout(); // // cbShowDeprecated // - this.cbShowDeprecated.AutoSize = true; - this.cbShowDeprecated.Location = new System.Drawing.Point(163, 3); - this.cbShowDeprecated.Name = "cbShowDeprecated"; - this.cbShowDeprecated.Size = new System.Drawing.Size(82, 17); - this.cbShowDeprecated.TabIndex = 6; - this.cbShowDeprecated.Text = "Deprecated"; - this.cbShowDeprecated.UseVisualStyleBackColor = true; - this.cbShowDeprecated.CheckedChanged += new System.EventHandler(this.OnCheckboxChanged); + cbShowDeprecated.AutoSize = true; + cbShowDeprecated.Location = new System.Drawing.Point(75, 3); + cbShowDeprecated.Name = "cbShowDeprecated"; + cbShowDeprecated.Size = new System.Drawing.Size(86, 19); + cbShowDeprecated.TabIndex = 6; + cbShowDeprecated.Text = "Deprecated"; + cbShowDeprecated.UseVisualStyleBackColor = true; + cbShowDeprecated.CheckedChanged += OnCheckboxChanged; // // cbShowInternal // - this.cbShowInternal.AutoSize = true; - this.cbShowInternal.Location = new System.Drawing.Point(96, 3); - this.cbShowInternal.Name = "cbShowInternal"; - this.cbShowInternal.Size = new System.Drawing.Size(61, 17); - this.cbShowInternal.TabIndex = 7; - this.cbShowInternal.Text = "Internal"; - this.cbShowInternal.UseVisualStyleBackColor = true; - this.cbShowInternal.CheckedChanged += new System.EventHandler(this.OnCheckboxChanged); + cbShowInternal.AutoSize = true; + cbShowInternal.Location = new System.Drawing.Point(3, 3); + cbShowInternal.Name = "cbShowInternal"; + cbShowInternal.Size = new System.Drawing.Size(66, 19); + cbShowInternal.TabIndex = 7; + cbShowInternal.Text = "Internal"; + cbShowInternal.UseVisualStyleBackColor = true; + cbShowInternal.CheckedChanged += OnCheckboxChanged; // // cbProjectSpecific // - this.cbProjectSpecific.AutoSize = true; - this.cbProjectSpecific.Location = new System.Drawing.Point(3, 26); - this.cbProjectSpecific.Name = "cbProjectSpecific"; - this.cbProjectSpecific.Size = new System.Drawing.Size(100, 17); - this.cbProjectSpecific.TabIndex = 8; - this.cbProjectSpecific.Text = "Project Specific"; - this.cbProjectSpecific.UseVisualStyleBackColor = true; - this.cbProjectSpecific.CheckedChanged += new System.EventHandler(this.OnCheckboxChanged); - // - // cbShowNonExtractable - // - this.cbShowNonExtractable.AutoSize = true; - this.cbShowNonExtractable.Location = new System.Drawing.Point(109, 26); - this.cbShowNonExtractable.Name = "cbShowNonExtractable"; - this.cbShowNonExtractable.Size = new System.Drawing.Size(102, 17); - this.cbShowNonExtractable.TabIndex = 9; - this.cbShowNonExtractable.Text = "Non Extractable"; - this.cbShowNonExtractable.UseVisualStyleBackColor = true; - this.cbShowNonExtractable.CheckedChanged += new System.EventHandler(this.OnCheckboxChanged); + cbProjectSpecific.AutoSize = true; + cbProjectSpecific.Location = new System.Drawing.Point(3, 28); + cbProjectSpecific.Name = "cbProjectSpecific"; + cbProjectSpecific.Size = new System.Drawing.Size(107, 19); + cbProjectSpecific.TabIndex = 8; + cbProjectSpecific.Text = "Project Specific"; + cbProjectSpecific.UseVisualStyleBackColor = true; + cbProjectSpecific.CheckedChanged += OnCheckboxChanged; // // flowLayoutPanel1 // - this.flowLayoutPanel1.Controls.Add(this.cbShowColdStorage); - this.flowLayoutPanel1.Controls.Add(this.cbShowInternal); - this.flowLayoutPanel1.Controls.Add(this.cbShowDeprecated); - this.flowLayoutPanel1.Controls.Add(this.cbProjectSpecific); - this.flowLayoutPanel1.Controls.Add(this.cbShowNonExtractable); - this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0); - this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(256, 69); - this.flowLayoutPanel1.TabIndex = 10; + flowLayoutPanel1.Controls.Add(cbShowInternal); + flowLayoutPanel1.Controls.Add(cbShowDeprecated); + flowLayoutPanel1.Controls.Add(cbProjectSpecific); + flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + flowLayoutPanel1.Location = new System.Drawing.Point(0, 0); + flowLayoutPanel1.Name = "flowLayoutPanel1"; + flowLayoutPanel1.Size = new System.Drawing.Size(256, 69); + flowLayoutPanel1.TabIndex = 10; // // CatalogueCollectionFilterUI // - this.Controls.Add(this.flowLayoutPanel1); - this.Name = "CatalogueCollectionFilterUI"; - this.Size = new System.Drawing.Size(256, 69); - this.flowLayoutPanel1.ResumeLayout(false); - this.flowLayoutPanel1.PerformLayout(); - this.ResumeLayout(false); + Controls.Add(flowLayoutPanel1); + Name = "CatalogueCollectionFilterUI"; + Size = new System.Drawing.Size(256, 69); + flowLayoutPanel1.ResumeLayout(false); + flowLayoutPanel1.PerformLayout(); + ResumeLayout(false); } #endregion - - private System.Windows.Forms.CheckBox cbShowColdStorage; private System.Windows.Forms.CheckBox cbShowDeprecated; private System.Windows.Forms.CheckBox cbShowInternal; private System.Windows.Forms.CheckBox cbProjectSpecific; - private System.Windows.Forms.CheckBox cbShowNonExtractable; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; } } diff --git a/Rdmp.UI/Collections/CatalogueCollectionFilterUI.cs b/Rdmp.UI/Collections/CatalogueCollectionFilterUI.cs index 5464cf7c63..15592d0eb3 100644 --- a/Rdmp.UI/Collections/CatalogueCollectionFilterUI.cs +++ b/Rdmp.UI/Collections/CatalogueCollectionFilterUI.cs @@ -21,9 +21,7 @@ public CatalogueCollectionFilterUI() cbShowInternal.Checked = UserSettings.ShowInternalCatalogues; cbShowDeprecated.Checked = UserSettings.ShowDeprecatedCatalogues; - cbShowColdStorage.Checked = UserSettings.ShowColdStorageCatalogues; cbProjectSpecific.Checked = UserSettings.ShowProjectSpecificCatalogues; - cbShowNonExtractable.Checked = UserSettings.ShowNonExtractableCatalogues; _loading = false; } @@ -37,9 +35,7 @@ private void OnCheckboxChanged(object sender, EventArgs e) UserSettings.ShowInternalCatalogues = cbShowInternal.Checked; UserSettings.ShowDeprecatedCatalogues = cbShowDeprecated.Checked; - UserSettings.ShowColdStorageCatalogues = cbShowColdStorage.Checked; UserSettings.ShowProjectSpecificCatalogues = cbProjectSpecific.Checked; - UserSettings.ShowNonExtractableCatalogues = cbShowNonExtractable.Checked; FiltersChanged?.Invoke(this, EventArgs.Empty); } @@ -49,15 +45,9 @@ public void EnsureVisible(Catalogue c) if (c.IsColdStorageDataset || c.IsDeprecated || c.IsInternalDataset) { //trouble is our flags might be hiding it so make sure it is visible - cbShowColdStorage.Checked = cbShowColdStorage.Checked || c.IsColdStorageDataset; cbShowDeprecated.Checked = cbShowDeprecated.Checked || c.IsDeprecated; cbShowInternal.Checked = cbShowInternal.Checked || c.IsInternalDataset; - } - - var isExtractable = c.GetExtractabilityStatus(null); - - cbShowNonExtractable.Checked = cbShowNonExtractable.Checked || isExtractable == null || - isExtractable.IsExtractable == false; + } } /// @@ -72,13 +62,7 @@ public void CheckForChanges() if (cbShowDeprecated.Checked != UserSettings.ShowDeprecatedCatalogues) cbShowDeprecated.Checked = UserSettings.ShowDeprecatedCatalogues; - if (cbShowColdStorage.Checked != UserSettings.ShowColdStorageCatalogues) - cbShowColdStorage.Checked = UserSettings.ShowColdStorageCatalogues; - if (cbProjectSpecific.Checked != UserSettings.ShowProjectSpecificCatalogues) cbProjectSpecific.Checked = UserSettings.ShowProjectSpecificCatalogues; - - if (cbShowNonExtractable.Checked != UserSettings.ShowNonExtractableCatalogues) - cbShowNonExtractable.Checked = UserSettings.ShowNonExtractableCatalogues; } } \ No newline at end of file diff --git a/Rdmp.UI/Collections/CatalogueCollectionFilterUI.resx b/Rdmp.UI/Collections/CatalogueCollectionFilterUI.resx index 1af7de150c..8b2ff64a11 100644 --- a/Rdmp.UI/Collections/CatalogueCollectionFilterUI.resx +++ b/Rdmp.UI/Collections/CatalogueCollectionFilterUI.resx @@ -1,17 +1,17 @@  - diff --git a/Rdmp.UI/Collections/Providers/Filtering/CatalogueCollectionFilter.cs b/Rdmp.UI/Collections/Providers/Filtering/CatalogueCollectionFilter.cs index d1e6804a7d..5cba8e6112 100644 --- a/Rdmp.UI/Collections/Providers/Filtering/CatalogueCollectionFilter.cs +++ b/Rdmp.UI/Collections/Providers/Filtering/CatalogueCollectionFilter.cs @@ -31,7 +31,7 @@ public CatalogueCollectionFilter(ICoreChildProvider childProvider) _isDeprecated = UserSettings.ShowDeprecatedCatalogues; _isColdStorage = UserSettings.ShowColdStorageCatalogues; _isProjectSpecific = UserSettings.ShowProjectSpecificCatalogues; - _isNonExtractable = UserSettings.ShowNonExtractableCatalogues; + _isNonExtractable = true; } public bool Filter(object modelObject) => SearchablesMatchScorer.Filter(modelObject, diff --git a/Rdmp.UI/MainFormUITabs/CatalogueUI.Designer.cs b/Rdmp.UI/MainFormUITabs/CatalogueUI.Designer.cs index 9ce5b6b790..6a3523545c 100644 --- a/Rdmp.UI/MainFormUITabs/CatalogueUI.Designer.cs +++ b/Rdmp.UI/MainFormUITabs/CatalogueUI.Designer.cs @@ -33,100 +33,99 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { splitContainer1 = new SplitContainer(); - cbColdStorage = new CheckBox(); cbInternal = new CheckBox(); cbDeprecated = new CheckBox(); - editableFolder = new SimpleControls.EditableLabelUI(); - editableCatalogueName = new SimpleControls.EditableLabelUI(); + editableFolder = new Rdmp.UI.SimpleControls.EditableLabelUI(); + editableCatalogueName = new Rdmp.UI.SimpleControls.EditableLabelUI(); ticketingControl1 = new TicketingControlUI(); tabControl1 = new TabControl(); tabPage1 = new TabPage(); groupBox23 = new GroupBox(); - aiAcronym = new SimpleControls.AdditionalInfomationUI(); + aiAcronym = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); tbAcronym = new TextBox(); groupBox16 = new GroupBox(); - aiDescription = new SimpleControls.AdditionalInfomationUI(); + aiDescription = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); tbDescription = new TextBox(); groupBox15 = new GroupBox(); - aiShortDescription = new SimpleControls.AdditionalInfomationUI(); + aiShortDescription = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); tbAbstract = new TextBox(); tabPage2 = new TabPage(); tableLayoutPanel2 = new TableLayoutPanel(); groupBox18 = new GroupBox(); - aiDatasetType = new SimpleControls.AdditionalInfomationUI(); - ddDatasetType = new SimpleControls.MultiSelectChips.DropdownOptionsChipDisplay(); + aiDatasetType = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); + ddDatasetType = new Rdmp.UI.SimpleControls.MultiSelectChips.DropdownOptionsChipDisplay(); groupBox22 = new GroupBox(); - aiKeywords = new SimpleControls.AdditionalInfomationUI(); - ffcKeywords = new SimpleControls.MultiSelectChips.FreeFormTextChipDisplay(); + aiKeywords = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); + ffcKeywords = new Rdmp.UI.SimpleControls.MultiSelectChips.FreeFormTextChipDisplay(); groupBox19 = new GroupBox(); - aiDatasetSubtype = new SimpleControls.AdditionalInfomationUI(); - ddDatasetSubtype = new SimpleControls.MultiSelectChips.DropdownOptionsChipDisplay(); + aiDatasetSubtype = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); + ddDatasetSubtype = new Rdmp.UI.SimpleControls.MultiSelectChips.DropdownOptionsChipDisplay(); groupBox21 = new GroupBox(); - ddDataSourceSetting = new SimpleControls.MultiSelectChips.DropdownOptionsChipDisplay(); - aiDataSourceSetting = new SimpleControls.AdditionalInfomationUI(); + ddDataSourceSetting = new Rdmp.UI.SimpleControls.MultiSelectChips.DropdownOptionsChipDisplay(); + aiDataSourceSetting = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); groupBox20 = new GroupBox(); - ddDataSource = new SimpleControls.MultiSelectChips.DropdownOptionsChipDisplay(); - aiDataSource = new SimpleControls.AdditionalInfomationUI(); - groupBox24 = new GroupBox(); - aiPurposeOfDataset = new SimpleControls.AdditionalInfomationUI(); - cbPurpose = new ComboBox(); + ddDataSource = new Rdmp.UI.SimpleControls.MultiSelectChips.DropdownOptionsChipDisplay(); + aiDataSource = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); groupBox17 = new GroupBox(); - aiResourceType = new SimpleControls.AdditionalInfomationUI(); + aiResourceType = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); cb_resourceType = new ComboBox(); + groupBox24 = new GroupBox(); + aiPurposeOfDataset = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); + cbPurpose = new ComboBox(); tabPage3 = new TabPage(); groupBox14 = new GroupBox(); - aiEndDate = new SimpleControls.AdditionalInfomationUI(); + aiEndDate = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); dtpEndDate = new DateTimePicker(); btnEndDateClear = new Button(); groupBox13 = new GroupBox(); - aiStartDate = new SimpleControls.AdditionalInfomationUI(); + aiStartDate = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); dtpStart = new DateTimePicker(); btnStartDateClear = new Button(); groupBox12 = new GroupBox(); - aiGranularity = new SimpleControls.AdditionalInfomationUI(); + aiGranularity = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); cb_granularity = new ComboBox(); groupBox11 = new GroupBox(); - aiGeographicalCoverage = new SimpleControls.AdditionalInfomationUI(); + aiGeographicalCoverage = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); tbGeoCoverage = new TextBox(); tabPage4 = new TabPage(); groupBox10 = new GroupBox(); - aiJuristiction = new SimpleControls.AdditionalInfomationUI(); + aiJuristiction = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); tbJuristiction = new TextBox(); groupBox9 = new GroupBox(); - aiDataProcessor = new SimpleControls.AdditionalInfomationUI(); + aiDataProcessor = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); tbDataProcessor = new TextBox(); groupBox8 = new GroupBox(); - aiDataController = new SimpleControls.AdditionalInfomationUI(); + aiDataController = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); tbDataController = new TextBox(); groupBox7 = new GroupBox(); - aiAccessContact = new SimpleControls.AdditionalInfomationUI(); + aiAccessContact = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); tbAccessContact = new TextBox(); tabPage5 = new TabPage(); groupBox3 = new GroupBox(); - aiDOI = new SimpleControls.AdditionalInfomationUI(); + aiDOI = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); tbDOI = new TextBox(); tableLayoutPanel1 = new TableLayoutPanel(); groupBox2 = new GroupBox(); - aiControlledGroup = new SimpleControls.AdditionalInfomationUI(); - fftControlledVocab = new SimpleControls.MultiSelectChips.FreeFormTextChipDisplay(); + aiControlledGroup = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); + fftControlledVocab = new Rdmp.UI.SimpleControls.MultiSelectChips.FreeFormTextChipDisplay(); groupBox1 = new GroupBox(); - aiPeople = new SimpleControls.AdditionalInfomationUI(); - ffcPeople = new SimpleControls.MultiSelectChips.FreeFormTextChipDisplay(); + aiPeople = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); + ffcPeople = new Rdmp.UI.SimpleControls.MultiSelectChips.FreeFormTextChipDisplay(); tabPage6 = new TabPage(); - aiUpdateFrequency = new SimpleControls.AdditionalInfomationUI(); + aiUpdateFrequency = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); groupBox6 = new GroupBox(); - aiUpdateLag = new SimpleControls.AdditionalInfomationUI(); + aiUpdateLag = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); cbUpdateLag = new ComboBox(); groupBox5 = new GroupBox(); - aiInitialReleaseDate = new SimpleControls.AdditionalInfomationUI(); + aiInitialReleaseDate = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); dtpReleaseDate = new DateTimePicker(); btnReleaseDateClear = new Button(); groupBox4 = new GroupBox(); cb_updateFrequency = new ComboBox(); tabPage7 = new TabPage(); groupBox25 = new GroupBox(); - aiAssociatedMedia = new SimpleControls.AdditionalInfomationUI(); - ffAssociatedMedia = new SimpleControls.MultiSelectChips.FreeFormTextChipDisplay(); + aiAssociatedMedia = new Rdmp.UI.SimpleControls.AdditionalInfomationUI(); + ffAssociatedMedia = new Rdmp.UI.SimpleControls.MultiSelectChips.FreeFormTextChipDisplay(); ((System.ComponentModel.ISupportInitialize)splitContainer1).BeginInit(); splitContainer1.Panel1.SuspendLayout(); splitContainer1.Panel2.SuspendLayout(); @@ -143,8 +142,8 @@ private void InitializeComponent() groupBox19.SuspendLayout(); groupBox21.SuspendLayout(); groupBox20.SuspendLayout(); - groupBox24.SuspendLayout(); groupBox17.SuspendLayout(); + groupBox24.SuspendLayout(); tabPage3.SuspendLayout(); groupBox14.SuspendLayout(); groupBox13.SuspendLayout(); @@ -177,7 +176,6 @@ private void InitializeComponent() // // splitContainer1.Panel1 // - splitContainer1.Panel1.Controls.Add(cbColdStorage); splitContainer1.Panel1.Controls.Add(cbInternal); splitContainer1.Panel1.Controls.Add(cbDeprecated); splitContainer1.Panel1.Controls.Add(editableFolder); @@ -191,16 +189,6 @@ private void InitializeComponent() splitContainer1.SplitterDistance = 158; splitContainer1.TabIndex = 0; // - // cbColdStorage - // - cbColdStorage.AutoSize = true; - cbColdStorage.Location = new System.Drawing.Point(695, 75); - cbColdStorage.Name = "cbColdStorage"; - cbColdStorage.Size = new System.Drawing.Size(94, 19); - cbColdStorage.TabIndex = 5; - cbColdStorage.Text = "Cold Storage"; - cbColdStorage.UseVisualStyleBackColor = true; - // // cbInternal // cbInternal.AutoSize = true; @@ -541,33 +529,6 @@ private void InitializeComponent() aiDataSource.Size = new System.Drawing.Size(20, 20); aiDataSource.TabIndex = 24; // - // groupBox24 - // - groupBox24.AutoSize = true; - groupBox24.Controls.Add(aiPurposeOfDataset); - groupBox24.Controls.Add(cbPurpose); - groupBox24.Location = new System.Drawing.Point(207, 6); - groupBox24.Name = "groupBox24"; - groupBox24.Size = new System.Drawing.Size(194, 67); - groupBox24.TabIndex = 20; - groupBox24.TabStop = false; - groupBox24.Text = "Purpose of Dataset"; - // - // aiPurposeOfDataset - // - aiPurposeOfDataset.Location = new System.Drawing.Point(114, 0); - aiPurposeOfDataset.Name = "aiPurposeOfDataset"; - aiPurposeOfDataset.Size = new System.Drawing.Size(20, 20); - aiPurposeOfDataset.TabIndex = 27; - // - // cbPurpose - // - cbPurpose.FormattingEnabled = true; - cbPurpose.Location = new System.Drawing.Point(6, 22); - cbPurpose.Name = "cbPurpose"; - cbPurpose.Size = new System.Drawing.Size(182, 23); - cbPurpose.TabIndex = 1; - // // groupBox17 // groupBox17.AutoSize = true; @@ -595,6 +556,33 @@ private void InitializeComponent() cb_resourceType.Size = new System.Drawing.Size(182, 23); cb_resourceType.TabIndex = 0; // + // groupBox24 + // + groupBox24.AutoSize = true; + groupBox24.Controls.Add(aiPurposeOfDataset); + groupBox24.Controls.Add(cbPurpose); + groupBox24.Location = new System.Drawing.Point(207, 6); + groupBox24.Name = "groupBox24"; + groupBox24.Size = new System.Drawing.Size(194, 67); + groupBox24.TabIndex = 20; + groupBox24.TabStop = false; + groupBox24.Text = "Purpose of Dataset"; + // + // aiPurposeOfDataset + // + aiPurposeOfDataset.Location = new System.Drawing.Point(114, 0); + aiPurposeOfDataset.Name = "aiPurposeOfDataset"; + aiPurposeOfDataset.Size = new System.Drawing.Size(20, 20); + aiPurposeOfDataset.TabIndex = 27; + // + // cbPurpose + // + cbPurpose.FormattingEnabled = true; + cbPurpose.Location = new System.Drawing.Point(6, 22); + cbPurpose.Name = "cbPurpose"; + cbPurpose.Size = new System.Drawing.Size(182, 23); + cbPurpose.TabIndex = 1; + // // tabPage3 // tabPage3.AutoScroll = true; @@ -1135,8 +1123,8 @@ private void InitializeComponent() groupBox21.PerformLayout(); groupBox20.ResumeLayout(false); groupBox20.PerformLayout(); - groupBox24.ResumeLayout(false); groupBox17.ResumeLayout(false); + groupBox24.ResumeLayout(false); tabPage3.ResumeLayout(false); groupBox14.ResumeLayout(false); groupBox13.ResumeLayout(false); @@ -1177,7 +1165,6 @@ private void InitializeComponent() private TicketingControlUI ticketingControl1; private SimpleControls.EditableLabelUI editableFolder; private SimpleControls.EditableLabelUI editableCatalogueName; - private CheckBox cbColdStorage; private CheckBox cbInternal; private CheckBox cbDeprecated; private TabControl tabControl1; diff --git a/Rdmp.UI/MainFormUITabs/CatalogueUI.cs b/Rdmp.UI/MainFormUITabs/CatalogueUI.cs index 16b3bf53d5..6a79f879bd 100644 --- a/Rdmp.UI/MainFormUITabs/CatalogueUI.cs +++ b/Rdmp.UI/MainFormUITabs/CatalogueUI.cs @@ -123,7 +123,6 @@ public override void SetDatabaseObject(IActivateItems activator, Catalogue datab protected override void SetBindings(BinderWithErrorProviderFactory rules, Catalogue databaseObject) { base.SetBindings(rules, databaseObject); - Bind(cbColdStorage, "Checked", "IsColdStorageDataset", c => c.IsColdStorageDataset); Bind(cbDeprecated, "Checked", "IsDeprecated", c => c.IsDeprecated); Bind(cbInternal, "Checked", "IsInternalDataset", c => c.IsInternalDataset); Bind(editableCatalogueName, "TextValue", "Name", c => c.Name); diff --git a/Rdmp.UI/PieCharts/CatalogueToDatasetLinkagePieChartUI.cs b/Rdmp.UI/PieCharts/CatalogueToDatasetLinkagePieChartUI.cs index e08d7786ae..ca637c3cb1 100644 --- a/Rdmp.UI/PieCharts/CatalogueToDatasetLinkagePieChartUI.cs +++ b/Rdmp.UI/PieCharts/CatalogueToDatasetLinkagePieChartUI.cs @@ -67,14 +67,9 @@ private void SetupFlags() { if (!_firstTime) return; - - AddFlag("Non Extractable Catalogues", c => c.IncludeNonExtractableCatalogues, - (c, r) => c.IncludeNonExtractableCatalogues = r); AddFlag("Deprecated Catalogues", c => c.IncludeDeprecatedCatalogues, (c, r) => c.IncludeDeprecatedCatalogues = r); AddFlag("Internal Catalogues", c => c.IncludeInternalCatalogues, (c, r) => c.IncludeInternalCatalogues = r); - AddFlag("Cold Storage Catalogues", c => c.IncludeColdStorageCatalogues, - (c, r) => c.IncludeColdStorageCatalogues = r); AddFlag("Project Specific Catalogues", c => c.IncludeProjectSpecificCatalogues, (c, r) => c.IncludeProjectSpecificCatalogues = r); diff --git a/Rdmp.UI/PieCharts/GoodBadCataloguePieChart.cs b/Rdmp.UI/PieCharts/GoodBadCataloguePieChart.cs index 0b126d190f..eac0108981 100644 --- a/Rdmp.UI/PieCharts/GoodBadCataloguePieChart.cs +++ b/Rdmp.UI/PieCharts/GoodBadCataloguePieChart.cs @@ -73,13 +73,9 @@ private void SetupFlags() AddFlag("Deprecated Catalogues", c => c.IncludeDeprecatedCatalogues, (c, r) => c.IncludeDeprecatedCatalogues = r); AddFlag("Internal Catalogues", c => c.IncludeInternalCatalogues, (c, r) => c.IncludeInternalCatalogues = r); - AddFlag("Cold Storage Catalogues", c => c.IncludeColdStorageCatalogues, - (c, r) => c.IncludeColdStorageCatalogues = r); AddFlag("Project Specific Catalogues", c => c.IncludeProjectSpecificCatalogues, (c, r) => c.IncludeProjectSpecificCatalogues = r); - AddFlag("Non Extractable CatalogueItems", c => c.IncludeNonExtractableCatalogueItems, - (c, r) => c.IncludeNonExtractableCatalogueItems = r); AddFlag("Internal Catalogue Items", c => c.IncludeInternalCatalogueItems, (c, r) => c.IncludeInternalCatalogueItems = r); AddFlag("Deprecated Catalogue Items", c => c.IncludeDeprecatedCatalogueItems, diff --git a/Rdmp.UI/SimpleDialogs/NewfindUI.cs b/Rdmp.UI/SimpleDialogs/NewfindUI.cs index 8b49fba779..2763bdda99 100644 --- a/Rdmp.UI/SimpleDialogs/NewfindUI.cs +++ b/Rdmp.UI/SimpleDialogs/NewfindUI.cs @@ -369,8 +369,6 @@ private void BuildToolStripForDatabaseObjects(RDMPCollection focusedCollection) v => UserSettings.ShowInternalCatalogues = v, "I", "Include Internal"); AddUserSettingCheckbox(() => UserSettings.ShowDeprecatedCatalogues, v => UserSettings.ShowDeprecatedCatalogues = v, "D", "Include Deprecated"); - AddUserSettingCheckbox(() => UserSettings.ShowColdStorageCatalogues, - v => UserSettings.ShowColdStorageCatalogues = v, "C", "Include Cold Storage"); AddUserSettingCheckbox(() => UserSettings.ShowProjectSpecificCatalogues, v => UserSettings.ShowProjectSpecificCatalogues = v, "P", "Include Project Specific"); AddUserSettingCheckbox(() => UserSettings.ShowNonExtractableCatalogues, diff --git a/Rdmp.UI/SimpleDialogs/SelectDialog.cs b/Rdmp.UI/SimpleDialogs/SelectDialog.cs index 6d1fb0c3b2..e614983139 100644 --- a/Rdmp.UI/SimpleDialogs/SelectDialog.cs +++ b/Rdmp.UI/SimpleDialogs/SelectDialog.cs @@ -433,8 +433,6 @@ private void BuildToolStripForDatabaseObjects(RDMPCollection focusedCollection) v => UserSettings.ShowInternalCatalogues = v, "I", "Include Internal"); AddUserSettingCheckbox(() => UserSettings.ShowDeprecatedCatalogues, v => UserSettings.ShowDeprecatedCatalogues = v, "D", "Include Deprecated"); - AddUserSettingCheckbox(() => UserSettings.ShowColdStorageCatalogues, - v => UserSettings.ShowColdStorageCatalogues = v, "C", "Include Cold Storage"); AddUserSettingCheckbox(() => UserSettings.ShowProjectSpecificCatalogues, v => UserSettings.ShowProjectSpecificCatalogues = v, "P", "Include Project Specific"); AddUserSettingCheckbox(() => UserSettings.ShowNonExtractableCatalogues, From 5b4dcbabda71b3ed995a542db02c8d453cd586e8 Mon Sep 17 00:00:00 2001 From: James Friel Date: Fri, 25 Apr 2025 11:00:45 +0100 Subject: [PATCH 2/6] update tests --- ...atabaseMSSqlDestinationReExtractionTest.cs | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Rdmp.Core.Tests/DataExport/DataExtraction/ExecuteFullExtractionToDatabaseMSSqlDestinationReExtractionTest.cs b/Rdmp.Core.Tests/DataExport/DataExtraction/ExecuteFullExtractionToDatabaseMSSqlDestinationReExtractionTest.cs index f1d4a30ac1..e2b5da2356 100644 --- a/Rdmp.Core.Tests/DataExport/DataExtraction/ExecuteFullExtractionToDatabaseMSSqlDestinationReExtractionTest.cs +++ b/Rdmp.Core.Tests/DataExport/DataExtraction/ExecuteFullExtractionToDatabaseMSSqlDestinationReExtractionTest.cs @@ -183,7 +183,9 @@ public void ReExtractToADatabaseWithNoNewData() Name = "ext1", Cohort_ID = extractableCohort.ID }; - ec.AddDatasetToConfiguration(new ExtractableDataSet(DataExportRepository, catalogue)); + var existingExtractableDataSet = DataExportRepository.GetAllObjectsWhere("Catalogue_ID", catalogue.ID).FirstOrDefault(); + + ec.AddDatasetToConfiguration( existingExtractableDataSet ?? new ExtractableDataSet(DataExportRepository, catalogue)); ec.SaveToDatabase(); @@ -409,7 +411,9 @@ public void ReExtractToADatabaseWithNewDataAndNoPKs() Name = "ext1", Cohort_ID = extractableCohort.ID }; - ec.AddDatasetToConfiguration(new ExtractableDataSet(DataExportRepository, catalogue)); + var existingExtractableDataSet = DataExportRepository.GetAllObjectsWhere("Catalogue_ID", catalogue.ID).FirstOrDefault(); + + ec.AddDatasetToConfiguration( existingExtractableDataSet ?? new ExtractableDataSet(DataExportRepository, catalogue)); ec.SaveToDatabase(); @@ -671,7 +675,9 @@ public void ReExtractToADatabaseWithNewDataAndSinglePK() Name = "ext1", Cohort_ID = extractableCohort.ID }; - ec.AddDatasetToConfiguration(new ExtractableDataSet(DataExportRepository, catalogue)); + var existingExtractableDataSet = DataExportRepository.GetAllObjectsWhere("Catalogue_ID", catalogue.ID).FirstOrDefault(); + + ec.AddDatasetToConfiguration(existingExtractableDataSet ?? new ExtractableDataSet(DataExportRepository, catalogue)); ec.SaveToDatabase(); @@ -937,7 +943,9 @@ public void ReExtractToADatabaseWithNewDataAndExtractionIdentifierIsPK() Name = "ext1", Cohort_ID = extractableCohort.ID }; - ec.AddDatasetToConfiguration(new ExtractableDataSet(DataExportRepository, catalogue)); + var existingExtractableDataSet = DataExportRepository.GetAllObjectsWhere("Catalogue_ID", catalogue.ID).FirstOrDefault(); + + ec.AddDatasetToConfiguration(existingExtractableDataSet??new ExtractableDataSet(DataExportRepository, catalogue)); ec.SaveToDatabase(); @@ -1196,7 +1204,9 @@ public void ExtractToDatabaseUseTriggers() Name = "ext1", Cohort_ID = extractableCohort.ID }; - ec.AddDatasetToConfiguration(new ExtractableDataSet(DataExportRepository, catalogue)); + var existingExtractableDataSet = DataExportRepository.GetAllObjectsWhere("Catalogue_ID", catalogue.ID).FirstOrDefault(); + + ec.AddDatasetToConfiguration(existingExtractableDataSet??new ExtractableDataSet(DataExportRepository, catalogue)); ec.SaveToDatabase(); From 93b15a378e5d612e0313a23fe6f0e6618736f654 Mon Sep 17 00:00:00 2001 From: James Friel Date: Fri, 25 Apr 2025 13:24:54 +0100 Subject: [PATCH 3/6] fix tests --- ...etweenCatalogueAndDataExportObscureDependencyFinder.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Rdmp.Core/DataExport/BetweenCatalogueAndDataExportObscureDependencyFinder.cs b/Rdmp.Core/DataExport/BetweenCatalogueAndDataExportObscureDependencyFinder.cs index 38d1566671..5ed8aa0f30 100644 --- a/Rdmp.Core/DataExport/BetweenCatalogueAndDataExportObscureDependencyFinder.cs +++ b/Rdmp.Core/DataExport/BetweenCatalogueAndDataExportObscureDependencyFinder.cs @@ -46,10 +46,10 @@ public void ThrowIfDeleteDisallowed(IMapsDirectlyToDatabaseTable oTableWrapperOb var dependencies = _serviceLocator.DataExportRepository .GetAllObjectsWhere("Catalogue_ID", cata.ID).ToArray(); - //we have any dependent catalogues? - if (dependencies.Any()) - throw new Exception( - $"Cannot delete Catalogue {cata} because there are ExtractableDataSets which depend on them (IDs={string.Join(",", dependencies.Select(ds => ds.ID.ToString()))})"); + foreach (var dependency in dependencies) + { + dependency.DeleteInDatabase(); + } } } From afba546434322756ce019172be40e49538ff01bc Mon Sep 17 00:00:00 2001 From: James Friel Date: Fri, 25 Apr 2025 14:42:01 +0100 Subject: [PATCH 4/6] fix up tests --- ...talogueAndDataExportObscureDependencyFinderTests.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Rdmp.Core.Tests/Curation/Integration/ObscureDependencyTests/BetweenCatalogueAndDataExportObscureDependencyFinderTests.cs b/Rdmp.Core.Tests/Curation/Integration/ObscureDependencyTests/BetweenCatalogueAndDataExportObscureDependencyFinderTests.cs index 67c363fd04..72926c01a7 100644 --- a/Rdmp.Core.Tests/Curation/Integration/ObscureDependencyTests/BetweenCatalogueAndDataExportObscureDependencyFinderTests.cs +++ b/Rdmp.Core.Tests/Curation/Integration/ObscureDependencyTests/BetweenCatalogueAndDataExportObscureDependencyFinderTests.cs @@ -30,12 +30,10 @@ public void PreventDeletingCatalogueBecauseOfLinkedDatasetTest() var dataset = new ExtractableDataSet(DataExportRepository, cata); //and suddenly we cannot delete the catalogue - var ex = Assert.Throws(() => obscura.ThrowIfDeleteDisallowed(cata)); - Assert.That(ex.Message, Does.Contain("Cannot delete Catalogue MyCata because there are ExtractableDataSets which depend on them ")); + Assert.DoesNotThrow(() => obscura.ThrowIfDeleteDisallowed(cata)); //also if we try to force through a delete it should behave in identical manner - var ex2 = Assert.Throws(cata.DeleteInDatabase); - Assert.That(ex2.Message, Does.Contain("Cannot delete Catalogue MyCata because there are ExtractableDataSets which depend on them ")); + Assert.DoesNotThrow(cata.DeleteInDatabase); //now we delete the linked dataset dataset.DeleteInDatabase(); @@ -65,9 +63,7 @@ public void AllowDeletingWhenDataExportManagerIsNotSet() var cata = new Catalogue(CatalogueRepository, "MyCata"); var dataset = new ExtractableDataSet(DataExportRepository, cata); - //we cannot delete it because there is a dependency - var ex = Assert.Throws(() => obscura1.ThrowIfDeleteDisallowed(cata)); - Assert.That(ex.Message, Does.Contain("Cannot delete Catalogue MyCata because there are ExtractableDataSets which depend on them ")); + Assert.DoesNotThrow(() => obscura1.ThrowIfDeleteDisallowed(cata)); //the second finder simulates when the repository locator doesn't have a record of the data export repository so it is unable to check it so it will let you delete it just fine Assert.DoesNotThrow(() => obscura2.ThrowIfDeleteDisallowed(cata)); From a9abc6a78de0c0e6924ec218bffbd4f6b0be55e2 Mon Sep 17 00:00:00 2001 From: James Friel Date: Tue, 6 May 2025 12:55:27 +0100 Subject: [PATCH 5/6] tidy up and use correct images --- .../WindowManagement/ActivateItems.cs | 1 - .../ExecuteCommandChangeExtractability.cs | 100 ------------------ .../ExecuteCommandMakeCatalogueInternal.cs | 3 +- .../CommandExecution/BasicActivateItems.cs | 3 +- .../Repositories/DataExportRepository.cs | 2 +- 5 files changed, 3 insertions(+), 106 deletions(-) delete mode 100644 Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandChangeExtractability.cs diff --git a/Application/ResearchDataManagementPlatform/WindowManagement/ActivateItems.cs b/Application/ResearchDataManagementPlatform/WindowManagement/ActivateItems.cs index ca7cbcba82..28ce5b3a57 100644 --- a/Application/ResearchDataManagementPlatform/WindowManagement/ActivateItems.cs +++ b/Application/ResearchDataManagementPlatform/WindowManagement/ActivateItems.cs @@ -636,7 +636,6 @@ public override void Wait(string title, Task task, CancellationTokenSource cts) public override IEnumerable GetIgnoredCommands() { yield return typeof(ExecuteCommandRefreshObject); - yield return typeof(ExecuteCommandChangeExtractability); yield return typeof(ExecuteCommandOpenInExplorer); yield return typeof(ExecuteCommandDeletePlugin); yield return typeof(ExecuteCommandCreateNewFileBasedProcessTask); diff --git a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandChangeExtractability.cs b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandChangeExtractability.cs deleted file mode 100644 index 2506ff1a59..0000000000 --- a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandChangeExtractability.cs +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) The University of Dundee 2018-2019 -// This file is part of the Research Data Management Platform (RDMP). -// RDMP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. -// RDMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -// You should have received a copy of the GNU General Public License along with RDMP. If not, see . - -using System.Linq; -using Rdmp.Core.Curation.Data; -using Rdmp.Core.DataExport.Data; -using Rdmp.Core.Icons.IconProvision; -using Rdmp.Core.Providers; -using Rdmp.Core.ReusableLibraryCode.Icons.IconProvision; -using SixLabors.ImageSharp; -using SixLabors.ImageSharp.PixelFormats; - -namespace Rdmp.Core.CommandExecution.AtomicCommands; - -public sealed class ExecuteCommandChangeExtractability : BasicCommandExecution -{ - private readonly Catalogue _catalogue; - private readonly bool _markExtractable; - - public ExecuteCommandChangeExtractability(IBasicActivateItems activator, Catalogue catalogue, - bool? explicitExtractability = null) : base(activator) - { - _catalogue = catalogue; - var status = catalogue.GetExtractabilityStatus(BasicActivator.RepositoryLocator.DataExportRepository); - if (status == null) - { - SetImpossible( - "We don't know whether Catalogue is extractable or not (possibly no Data Export database is available)"); - return; - } - - if (status.IsProjectSpecific) - { - SetImpossible( - "Cannot change the extractability because it is configured as a 'Project Specific Catalogue'"); - return; - } - - // mark it extractable true/false as passed in constructor or just flip its state - _markExtractable = explicitExtractability ?? !status.IsExtractable; - } - - public override string GetCommandName() => _markExtractable ? "Mark Extractable" : "Mark Not Extractable"; - - public override string GetCommandHelp() => - !_markExtractable - ? "Prevent dataset from being released in Project extracts. This fails if it is already part of any ExtractionConfigurations" - : @"Enable dataset linkage\extraction in Project extracts. This requires that at least one column be marked IsExtractionIdentifier"; - - public override Image GetImage(IIconProvider iconProvider) => - iconProvider.GetImage(RDMPConcept.ExtractableDataSet, _markExtractable ? OverlayKind.Add : OverlayKind.Delete); - - public override void Execute() - { - base.Execute(); - - if (_markExtractable) - { - if (_catalogue.GetExtractabilityStatus(BasicActivator.RepositoryLocator.DataExportRepository).IsExtractable) - { - Show($"{_catalogue} is already extractable"); - } - else - { - var extractabilityRecord = - ((DataExportChildProvider)BasicActivator.CoreChildProvider).ExtractableDataSets.SingleOrDefault(ds => - ds.Catalogue_ID == _catalogue.ID); - if (extractabilityRecord != null) - { - extractabilityRecord.DisableExtraction = false; - extractabilityRecord.SaveToDatabase(); - } - else - { - new ExtractableDataSet(BasicActivator.RepositoryLocator.DataExportRepository, _catalogue); - } - Publish(_catalogue); - } - } - else - { - var extractabilityRecord = - ((DataExportChildProvider)BasicActivator.CoreChildProvider).ExtractableDataSets.SingleOrDefault(ds => - ds.Catalogue_ID == _catalogue.ID); - if (extractabilityRecord == null) - { - Show($"{_catalogue} is already non-extractable"); - } - else - { - extractabilityRecord.DisableExtraction = true; - extractabilityRecord.SaveToDatabase(); - Publish(_catalogue); - } - } - } -} \ No newline at end of file diff --git a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandMakeCatalogueInternal.cs b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandMakeCatalogueInternal.cs index 8eaef78643..6c0f8dc35b 100644 --- a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandMakeCatalogueInternal.cs +++ b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandMakeCatalogueInternal.cs @@ -47,8 +47,7 @@ public override void Execute() Publish(_catalogue); } - public override Image GetImage(IIconProvider iconProvider) => - Image.Load(CatalogueIcons.Catalogue);//todo make this use the internal icon + public override Image GetImage(IIconProvider iconProvider) => BasicActivator.CoreIconProvider.GetImage(_catalogue, OverlayKind.Extractable_Internal); public IAtomicCommandWithTarget SetTarget(DatabaseEntity target) { diff --git a/Rdmp.Core/CommandExecution/BasicActivateItems.cs b/Rdmp.Core/CommandExecution/BasicActivateItems.cs index 94d1d75609..b94a97bd5c 100644 --- a/Rdmp.Core/CommandExecution/BasicActivateItems.cs +++ b/Rdmp.Core/CommandExecution/BasicActivateItems.cs @@ -388,11 +388,10 @@ protected virtual bool InteractiveDelete(IDeleteable deletable) var selectedDatasets = RepositoryLocator.DataExportRepository.GetAllObjectsWhere("ExtractableDataSet_ID", ds.ID); if (selectedDatasets.Any()) { - this.Show("Catalogue Is Used in a number of projects. Remove this catalogue from all projects to allow deletion"); + this.Show("Catalogue is used in a number of projects. Remove this catalogue from all projects to allow deletion"); return false; } } - //not used anywhere, we can dlete it foreach (var ds in extractableDataSets) ds.DeleteInDatabase(); } break; diff --git a/Rdmp.Core/Repositories/DataExportRepository.cs b/Rdmp.Core/Repositories/DataExportRepository.cs index 5dcfcf422f..b02f57021f 100644 --- a/Rdmp.Core/Repositories/DataExportRepository.cs +++ b/Rdmp.Core/Repositories/DataExportRepository.cs @@ -100,7 +100,7 @@ public CatalogueExtractabilityStatus GetExtractabilityStatus(ICatalogue c) var eds = GetAllObjectsWithParent(c).SingleOrDefault(); if (eds is null) { - //if there is not EDS for this catalogue, it must have bee non extractable + //if there is not EDS for this catalogue, it must have been non extractable eds = new ExtractableDataSet(this, c, false); eds.SaveToDatabase(); //todo need to publish this eds From e5a79cb1344048d847781bb27e2481efdec0e88f Mon Sep 17 00:00:00 2001 From: James Friel Date: Tue, 6 May 2025 13:27:43 +0100 Subject: [PATCH 6/6] fix test --- Rdmp.Core.Tests/CommandExecution/TestCommandsAreSupported.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Rdmp.Core.Tests/CommandExecution/TestCommandsAreSupported.cs b/Rdmp.Core.Tests/CommandExecution/TestCommandsAreSupported.cs index d57a3c5c19..67ae4e50c1 100644 --- a/Rdmp.Core.Tests/CommandExecution/TestCommandsAreSupported.cs +++ b/Rdmp.Core.Tests/CommandExecution/TestCommandsAreSupported.cs @@ -67,7 +67,6 @@ public void Init() [TestCase(typeof(ExecuteCommandAssociateCatalogueWithLoadMetadata))] [TestCase(typeof(ExecuteCommandAssociateCohortIdentificationConfigurationWithProject))] [TestCase(typeof(ExecuteCommandBulkImportTableInfos))] - [TestCase(typeof(ExecuteCommandChangeExtractability))] [TestCase(typeof(ExecuteCommandChangeExtractionCategory))] [TestCase(typeof(ExecuteCommandChangeLoadStage))] [TestCase(typeof(ExecuteCommandCheck))]