From 70dad2943558cf3919e3ae317c36df16b30d63b1 Mon Sep 17 00:00:00 2001 From: James Friel Date: Mon, 9 Mar 2026 09:33:33 +0000 Subject: [PATCH 01/15] use new linker --- ...mmandAssociateCatalogueWithLoadMetadata.cs | 20 ++++++++++++------- Rdmp.Core/Curation/Data/Catalogue.cs | 10 ++++------ .../DataLoad/ILoadMetadataCatalogueLinkage.cs | 2 +- .../Curation/Data/DataLoad/LoadMetadata.cs | 20 +++++++++---------- .../DataLoad/LoadMetadataCatalogueLinkage.cs | 18 +++++++++++++---- Rdmp.Core/Curation/Data/ICatalogue.cs | 7 ++++--- .../MetadataLoggingConfigurationChecks.cs | 17 +++++++++------- Rdmp.Core/DataLoad/Engine/Job/DataLoadJob.cs | 4 ++-- .../CreateCatalogue.sql | 1 + ...93_AddLoadMetadataCatalogueLinkageName.sql | 20 +++++++++++++++++++ Rdmp.Core/Rdmp.Core.csproj | 1 + .../DataLoadUIs/CreateNewLoadMetadataUI.cs | 10 +++++----- Rdmp.UI/SimpleDialogs/ChooseLoggingTaskUI.cs | 10 +++++----- SharedAssemblyInfo.cs | 6 +++--- 14 files changed, 93 insertions(+), 53 deletions(-) create mode 100644 Rdmp.Core/Databases/CatalogueDatabase/up/093_AddLoadMetadataCatalogueLinkageName.sql diff --git a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandAssociateCatalogueWithLoadMetadata.cs b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandAssociateCatalogueWithLoadMetadata.cs index 8b35a984c2..6dd4ba7868 100644 --- a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandAssociateCatalogueWithLoadMetadata.cs +++ b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandAssociateCatalogueWithLoadMetadata.cs @@ -4,7 +4,6 @@ // 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.Curation.Data.DataLoad; using Rdmp.Core.Icons.IconProvision; @@ -12,6 +11,8 @@ using Rdmp.Core.ReusableLibraryCode.Icons.IconProvision; using SixLabors.ImageSharp; using SixLabors.ImageSharp.PixelFormats; +using System.Linq; +using System.Threading.Tasks; namespace Rdmp.Core.CommandExecution.AtomicCommands; @@ -66,14 +67,14 @@ public override void Execute() //if there are other catalogues if (_otherCatalogues.Any()) { - var tasks = _otherCatalogues.Select(c => c.LoggingDataTask).Distinct().ToArray(); + var tasks = _otherCatalogues.SelectMany(c => c.LoggingDataTasks).Distinct().ToArray(); //if the other catalogues have an agreed logging task if (tasks.Length == 1) { var task = tasks.Single(); //and that logging task is not blank!, and differs from this Catalogue - if (!string.IsNullOrWhiteSpace(task) && !task.Equals(cata.LoggingDataTask)) + if ( !cata.LoggingDataTasks.Select(ldt => ldt.Name).Contains(task.Name)) { var liveServers = _otherCatalogues.Where(c => c.LiveLoggingServer_ID != null) .Select(c => c.LiveLoggingServer_ID).Distinct().ToArray(); @@ -81,21 +82,26 @@ public override void Execute() //AND if there is agreement on what logging server to use! if (liveServers.Length <= 1) //if there is no current logging task for the Catalogue - if (string.IsNullOrWhiteSpace(cata.LoggingDataTask) + if (!cata.LoggingDataTasks.Any() //or if the user wants to switch to the new one || YesNo( - $"Do you want to set Catalogue '{cata.Name}' to use shared logging task '{task}' instead of its current Logging Task '{cata.LoggingDataTask}' (All Catalogues in a load must share the same task and logging servers)?", + //$"Do you want to set Catalogue '{cata.Name}' to use shared logging task '{task}' instead of its current Logging Task '{cata.LoggingDataTask}' (All Catalogues in a load must share the same task and logging servers)?", + $"Do you want to set Catalogue '{cata.Name}' to use shared logging task '{task}' instead of its current Logging Task 'TODO' (All Catalogues in a load must share the same task and logging servers)?", "Synchronise Logging Tasks")) { //switch Catalogue to use that logging task (including servers) - cata.LoggingDataTask = task; + //cata.LoggingDataTask = task; + var lmdcl = new LoadMetadataCatalogueLinkage(cata.CatalogueRepository, _loadMetadata, cata,task.Name); + lmdcl.SaveToDatabase(); cata.LiveLoggingServer_ID = liveServers.SingleOrDefault(); } } } else if (tasks.Length == 0) { - cata.LoggingDataTask = $"Loading {_loadMetadata.Name}"; + var lmdcl = new LoadMetadataCatalogueLinkage(cata.CatalogueRepository, _loadMetadata, cata); + lmdcl.SaveToDatabase(); + //cata.LoggingDataTask = $"Loading {_loadMetadata.Name}"; } } cata.SaveToDatabase(); diff --git a/Rdmp.Core/Curation/Data/Catalogue.cs b/Rdmp.Core/Curation/Data/Catalogue.cs index e144c636b6..897faaf761 100644 --- a/Rdmp.Core/Curation/Data/Catalogue.cs +++ b/Rdmp.Core/Curation/Data/Catalogue.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; using System.Data.Common; using System.IO; using System.Linq; @@ -80,7 +81,6 @@ public sealed class Catalogue : DatabaseEntity, IComparable, ICatalogue, IInject private string _sourceOfDataCollection; private string _ticket; private DateTime? _datasetStartDate; - private string _loggingDataTask; private string _validatorXml; private int? _timeCoverageExtractionInformationID; private int? _pivotCategoryExtractionInformationID; @@ -446,10 +446,10 @@ public string Ticket /// [DoNotExtractProperty] - public string LoggingDataTask + [NotMapped] + public List LoggingDataTasks { - get => _loggingDataTask; - set => SetField(ref _loggingDataTask, value); + get => Repository.GetAllObjectsWhere("CatalogueID", this.ID).Select(lmcl => (ILoadMetadataCatalogueLinkage)lmcl).ToList(); } /// @@ -977,8 +977,6 @@ internal Catalogue(ICatalogueRepository repository, DbDataReader r) //detailed info url with support for invalid urls Detail_Page_URL = ParseUrl(r, "Detail_Page_URL"); - LoggingDataTask = r["LoggingDataTask"] as string; - if (r["LiveLoggingServer_ID"] == DBNull.Value) LiveLoggingServer_ID = null; else diff --git a/Rdmp.Core/Curation/Data/DataLoad/ILoadMetadataCatalogueLinkage.cs b/Rdmp.Core/Curation/Data/DataLoad/ILoadMetadataCatalogueLinkage.cs index 9706648d0c..b46550619e 100644 --- a/Rdmp.Core/Curation/Data/DataLoad/ILoadMetadataCatalogueLinkage.cs +++ b/Rdmp.Core/Curation/Data/DataLoad/ILoadMetadataCatalogueLinkage.cs @@ -20,5 +20,5 @@ public interface ILoadMetadataCatalogueLinkage: IMapsDirectlyToDatabaseTable int LoadMetadataID{ get; } int CatalogueID { get; } - + string Name { get; } } diff --git a/Rdmp.Core/Curation/Data/DataLoad/LoadMetadata.cs b/Rdmp.Core/Curation/Data/DataLoad/LoadMetadata.cs index 479746a5ae..8992558211 100644 --- a/Rdmp.Core/Curation/Data/DataLoad/LoadMetadata.cs +++ b/Rdmp.Core/Curation/Data/DataLoad/LoadMetadata.cs @@ -390,7 +390,7 @@ private IDataAccessPoint[] GetLoggingServers() } /// - /// Returns the unique value of amongst all catalogues loaded by the + /// Returns the unique value of amongst all catalogues loaded by the /// /// public string GetDistinctLoggingTask() @@ -401,17 +401,17 @@ public string GetDistinctLoggingTask() throw new Exception($"There are no Catalogues associated with load metadata (ID={ID})"); var cataloguesWithoutLoggingTasks = - catalogueMetadatas.Where(c => string.IsNullOrWhiteSpace(c.LoggingDataTask)).ToArray(); + catalogueMetadatas.Where(c => c.LoggingDataTasks.Count ==0).ToArray(); if (cataloguesWithoutLoggingTasks.Any()) throw new Exception( $"The following Catalogues do not have a LoggingDataTask specified:{cataloguesWithoutLoggingTasks.Aggregate("", (s, n) => $"{s}{n}(ID={n.ID}),")}"); - var distinctLoggingTasks = catalogueMetadatas.Select(c => c.LoggingDataTask).Distinct().ToArray(); - return distinctLoggingTasks.Length >= 2 - ? throw new Exception( - $"There are {distinctLoggingTasks.Length} logging tasks in Catalogues belonging to this metadata (ID={ID})") - : distinctLoggingTasks[0]; + var distinctLoggingTasks = catalogueMetadatas.SelectMany(c => c.LoggingDataTasks); + return distinctLoggingTasks.Count() >= 2 ? + throw new Exception( + $"There are {distinctLoggingTasks.Count()} logging tasks in Catalogues belonging to this metadata (ID={ID})") + : distinctLoggingTasks.First().Name; } /// @@ -487,14 +487,14 @@ public void EnsureLoggingWorksFor(ICatalogue catalogue) } //if there's no logging task yet and there's a logging server - if (string.IsNullOrWhiteSpace(catalogue.LoggingDataTask)) + if (!catalogue.LoggingDataTasks.Any()) { var lm = new LogManager(loggingServer); var loggingTaskName = Name; lm.CreateNewLoggingTaskIfNotExists(loggingTaskName); - catalogue.LoggingDataTask = loggingTaskName; - catalogue.SaveToDatabase(); + var loadMetadataCatalogueLinkage = new LoadMetadataCatalogueLinkage(CatalogueRepository, this, catalogue); + loadMetadataCatalogueLinkage.SaveToDatabase(); } } diff --git a/Rdmp.Core/Curation/Data/DataLoad/LoadMetadataCatalogueLinkage.cs b/Rdmp.Core/Curation/Data/DataLoad/LoadMetadataCatalogueLinkage.cs index b550ac78e9..5f81ecab30 100644 --- a/Rdmp.Core/Curation/Data/DataLoad/LoadMetadataCatalogueLinkage.cs +++ b/Rdmp.Core/Curation/Data/DataLoad/LoadMetadataCatalogueLinkage.cs @@ -7,9 +7,9 @@ using Rdmp.Core.Curation.Data.ImportExport; using Rdmp.Core.Curation.Data.Serialization; using Rdmp.Core.Repositories; +using Rdmp.Core.ReusableLibraryCode.Annotations; using System.Collections.Generic; using System.Data.Common; -using System.Diagnostics.CodeAnalysis; namespace Rdmp.Core.Curation.Data.DataLoad; @@ -19,7 +19,7 @@ public class LoadMetadataCatalogueLinkage : DatabaseEntity, ILoadMetadataCatalog private int _LoadMetadataID; private int _CatalogueID; - + private string _name; [NotNull] public int LoadMetadataID @@ -35,6 +35,13 @@ public int CatalogueID set => SetField(ref _CatalogueID, value); } + [NotNull] + public string Name + { + get => _name; + set => SetField(ref _name, value); + } + public LoadMetadataCatalogueLinkage() { } /// @@ -43,12 +50,14 @@ public LoadMetadataCatalogueLinkage() { } /// /// /// - public LoadMetadataCatalogueLinkage(ICatalogueRepository repository, ILoadMetadata loadMetadata, ICatalogue catalogue) + /// + public LoadMetadataCatalogueLinkage(ICatalogueRepository repository, ILoadMetadata loadMetadata, ICatalogue catalogue,string name=null) { repository.InsertAndHydrate(this, new Dictionary { {"LoadMetadataID", loadMetadata.ID}, - {"CatalogueID", catalogue.ID } + {"CatalogueID", catalogue.ID }, + {"Name",name??$"Loading {loadMetadata.Name}({loadMetadata.ID})" } }); } @@ -57,6 +66,7 @@ internal LoadMetadataCatalogueLinkage(ICatalogueRepository repository, DbDataRea { LoadMetadataID = int.Parse(r["LoadMetadataID"].ToString()); CatalogueID = int.Parse(r["CatalogueID"].ToString()); + Name = r["Name"].ToString(); } internal LoadMetadataCatalogueLinkage(ShareManager shareManager, ShareDefinition shareDefinition) diff --git a/Rdmp.Core/Curation/Data/ICatalogue.cs b/Rdmp.Core/Curation/Data/ICatalogue.cs index 4e6632b3fe..e161574fb3 100644 --- a/Rdmp.Core/Curation/Data/ICatalogue.cs +++ b/Rdmp.Core/Curation/Data/ICatalogue.cs @@ -4,13 +4,12 @@ // 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.Collections.Generic; using FAnsi; using FAnsi.Discovery; using FAnsi.Discovery.QuerySyntax; using Rdmp.Core.CohortCreation.Execution; using Rdmp.Core.Curation.Data.Aggregation; +using Rdmp.Core.Curation.Data.DataLoad; using Rdmp.Core.Logging; using Rdmp.Core.MapsDirectlyToDatabaseTable; using Rdmp.Core.MapsDirectlyToDatabaseTable.Injection; @@ -19,6 +18,8 @@ using Rdmp.Core.ReusableLibraryCode; using Rdmp.Core.ReusableLibraryCode.Checks; using Rdmp.Core.ReusableLibraryCode.DataAccess; +using System; +using System.Collections.Generic; namespace Rdmp.Core.Curation.Data; @@ -44,7 +45,7 @@ public interface ICatalogue : IHasDependencies, IHasQuerySyntaxHelper, INamed, I /// Name of a task in the logging database which should be used for documenting the loading of this Catalogue. /// /// - string LoggingDataTask { get; set; } + List LoggingDataTasks { get;} /// /// The ID of the logging server that is to be used to log data loads of the dataset diff --git a/Rdmp.Core/DataLoad/Engine/Checks/Checkers/MetadataLoggingConfigurationChecks.cs b/Rdmp.Core/DataLoad/Engine/Checks/Checkers/MetadataLoggingConfigurationChecks.cs index 60df6325d0..ce2eba833f 100644 --- a/Rdmp.Core/DataLoad/Engine/Checks/Checkers/MetadataLoggingConfigurationChecks.cs +++ b/Rdmp.Core/DataLoad/Engine/Checks/Checkers/MetadataLoggingConfigurationChecks.cs @@ -30,7 +30,7 @@ public void Check(ICheckNotifier notifier) var catalogues = _loadMetadata.GetAllCatalogues().ToArray(); //if there are no logging tasks defined on any Catalogues - if (catalogues.Any() && catalogues.All(c => string.IsNullOrWhiteSpace(c.LoggingDataTask))) + if (catalogues.Any() && catalogues.All(c => c.LoggingDataTasks.Count() ==0 )) { string proposedName; @@ -63,8 +63,8 @@ public void Check(ICheckNotifier notifier) #region Fix missing LoggingDataTask - var missingTasks = catalogues.Where(c => string.IsNullOrWhiteSpace(c.LoggingDataTask)).ToArray(); - var potentialTasks = catalogues.Except(missingTasks).Select(c => c.LoggingDataTask).Distinct().ToArray(); + var missingTasks = catalogues.Where(c => c.LoggingDataTasks.Count() ==0).ToArray(); + var potentialTasks = catalogues.Except(missingTasks).SelectMany(c => c.LoggingDataTasks).Distinct().ToArray(); //If any Catalogues are missing tasks if (missingTasks.Any()) @@ -77,8 +77,9 @@ public void Check(ICheckNotifier notifier) if (fix) foreach (var cata in missingTasks) { - cata.LoggingDataTask = potentialTasks.Single(); - cata.SaveToDatabase(); + throw new Exception("Is this ever hit?"); + //cata.LoggingDataTask = potentialTasks.Single(); + //cata.SaveToDatabase(); } } @@ -207,8 +208,10 @@ private void CreateNewLoggingTaskFor(ICheckNotifier notifier, ICatalogue[] catal foreach (var catalogue in catalogues.Cast()) { catalogue.LiveLoggingServer_ID = loggingServer.ID; - catalogue.LoggingDataTask = proposedName; - catalogue.SaveToDatabase(); + var lmdcl = new LoadMetadataCatalogueLinkage(catarepo,_loadMetadata, catalogue, proposedName); + lmdcl.SaveToDatabase(); + //catalogue.LoggingDataTask = proposedName; + //catalogue.SaveToDatabase(); } } } \ No newline at end of file diff --git a/Rdmp.Core/DataLoad/Engine/Job/DataLoadJob.cs b/Rdmp.Core/DataLoad/Engine/Job/DataLoadJob.cs index 844ce8a17e..61a27026d2 100644 --- a/Rdmp.Core/DataLoad/Engine/Job/DataLoadJob.cs +++ b/Rdmp.Core/DataLoad/Engine/Job/DataLoadJob.cs @@ -76,12 +76,12 @@ public DataLoadJob(IRDMPPlatformRepositoryServiceLocator repositoryLocator, stri private string GetLoggingTask(IEnumerable cataloguesToLoad) { - var distinctLoggingTasks = cataloguesToLoad.Select(catalogue => catalogue.LoggingDataTask).Distinct().ToList(); + var distinctLoggingTasks = cataloguesToLoad.SelectMany(catalogue => catalogue.LoggingDataTasks).Distinct().ToList(); if (distinctLoggingTasks.Count > 1) throw new Exception( $"The catalogues to be loaded do not share the same logging task: {string.Join(", ", distinctLoggingTasks)}"); - _loggingTask = distinctLoggingTasks.First(); + _loggingTask = distinctLoggingTasks.First().Name; return string.IsNullOrWhiteSpace(_loggingTask) ? throw new Exception("There is no logging task specified for this load (the name is blank)") : _loggingTask; diff --git a/Rdmp.Core/Databases/CatalogueDatabase/runAfterCreateDatabase/CreateCatalogue.sql b/Rdmp.Core/Databases/CatalogueDatabase/runAfterCreateDatabase/CreateCatalogue.sql index 72065b0dbb..6ae07e3504 100644 --- a/Rdmp.Core/Databases/CatalogueDatabase/runAfterCreateDatabase/CreateCatalogue.sql +++ b/Rdmp.Core/Databases/CatalogueDatabase/runAfterCreateDatabase/CreateCatalogue.sql @@ -946,6 +946,7 @@ CREATE TABLE [dbo].LoadMetadataCatalogueLinkage( [ID] [int] IDENTITY(1,1) NOT NULL, [LoadMetadataID] [int] NOT NULL, [CatalogueID] [int] NOT NULL, + [Name] [nvarchar(max)] NOT NULL, FOREIGN KEY ([LoadMetadataID]) REFERENCES [dbo].[LoadMetadata](ID) ON DELETE CASCADE, FOREIGN KEY ([CatalogueID]) REFERENCES [dbo].[Catalogue](ID) ON DELETE CASCADE, CONSTRAINT [PK_LoadMetadataCatalogueLinkage] PRIMARY KEY CLUSTERED diff --git a/Rdmp.Core/Databases/CatalogueDatabase/up/093_AddLoadMetadataCatalogueLinkageName.sql b/Rdmp.Core/Databases/CatalogueDatabase/up/093_AddLoadMetadataCatalogueLinkageName.sql new file mode 100644 index 0000000000..f4c4cf138a --- /dev/null +++ b/Rdmp.Core/Databases/CatalogueDatabase/up/093_AddLoadMetadataCatalogueLinkageName.sql @@ -0,0 +1,20 @@ +--Version: 9.3.0 +--Description: Add name to load metadata catalogue linkage +if not exists (select 1 from sys.columns where name = 'Name' and OBJECT_NAME(object_id) = 'LoadMetadataCatalogueLinkage') +BEGIN +ALTER TABLE [dbo].[LoadMetadataCatalogueLinkage] +ADD +[Name] [nvarchar](max) NOT NULL DEFAULT 'Unknown Logging Task'; +END +GO + +if exists(select 1 from [dbo].[LoadMetadataCatalogueLinkage] where [Name]='Unknown Logging Task') +BEGIN + UPDATE [dbo].[LoadMetadataCatalogueLinkage] + SET [dbo].[LoadMetadataCatalogueLinkage].[Name] = [C].[LoggingDataTask] + FROM [dbo].[LoadMetadataCatalogueLinkage] [LMDCL] + INNER JOIN [dbo].[Catalogue] [C] + ON [C].[ID] = [LMDCL].[CatalogueID] + WHERE [C].[LoggingDataTask] IS NOT NULL AND [LMDCL].[Name] = 'Unknown Logging Task' +END +GO \ No newline at end of file diff --git a/Rdmp.Core/Rdmp.Core.csproj b/Rdmp.Core/Rdmp.Core.csproj index a4ea445462..8c54bffc50 100644 --- a/Rdmp.Core/Rdmp.Core.csproj +++ b/Rdmp.Core/Rdmp.Core.csproj @@ -256,6 +256,7 @@ + diff --git a/Rdmp.UI/DataLoadUIs/CreateNewLoadMetadataUI.cs b/Rdmp.UI/DataLoadUIs/CreateNewLoadMetadataUI.cs index 73d732c8b3..d64290e85d 100644 --- a/Rdmp.UI/DataLoadUIs/CreateNewLoadMetadataUI.cs +++ b/Rdmp.UI/DataLoadUIs/CreateNewLoadMetadataUI.cs @@ -45,11 +45,11 @@ private void tbLoadMetadataNameToCreate_TextChanged(object sender, EventArgs e) private void btnCreate_Click(object sender, EventArgs e) { - if (string.IsNullOrWhiteSpace(_catalogue.LoggingDataTask)) - { - MessageBox.Show("You must configure a logging task first"); - return; - } + //if (string.IsNullOrWhiteSpace(_catalogue.LoggingDataTask)) + //{ + // MessageBox.Show("You must configure a logging task first"); + // return; + //} LoadMetadataCreatedIfAny = new LoadMetadata(Activator.RepositoryLocator.CatalogueRepository, tbLoadMetadataNameToCreate.Text); diff --git a/Rdmp.UI/SimpleDialogs/ChooseLoggingTaskUI.cs b/Rdmp.UI/SimpleDialogs/ChooseLoggingTaskUI.cs index cad0b16577..42db43c657 100644 --- a/Rdmp.UI/SimpleDialogs/ChooseLoggingTaskUI.cs +++ b/Rdmp.UI/SimpleDialogs/ChooseLoggingTaskUI.cs @@ -87,8 +87,8 @@ private void RefreshUIFromDatabase() MessageBox.Show($"Problem getting the list of DataTasks from the new logging architecture:{ex.Message}"); } - if (!string.IsNullOrWhiteSpace(_catalogue.LoggingDataTask)) - cbxDataLoadTasks.Text = _catalogue.LoggingDataTask; + //if (!string.IsNullOrWhiteSpace(_catalogue.LoggingDataTask)) + // cbxDataLoadTasks.Text = _catalogue.LoggingDataTask; CheckNameExists(); } @@ -137,8 +137,8 @@ private void RefreshTasks() private void cbxDataLoadTasks_SelectedIndexChanged(object sender, EventArgs e) { - _catalogue.LoggingDataTask = (string)cbxDataLoadTasks.SelectedItem; - _catalogue.SaveToDatabase(); + //_catalogue.LoggingDataTask = (string)cbxDataLoadTasks.SelectedItem; + //_catalogue.SaveToDatabase(); } private void label1_Click(object sender, EventArgs e) @@ -164,7 +164,7 @@ private void cbxDataLoadTasks_TextChanged(object sender, EventArgs e) if (_catalogue == null) return; - _catalogue.LoggingDataTask = cbxDataLoadTasks.Text; + //_catalogue.LoggingDataTask = cbxDataLoadTasks.Text; _catalogue.SaveToDatabase(); } diff --git a/SharedAssemblyInfo.cs b/SharedAssemblyInfo.cs index 4501772401..8114b3dd2d 100644 --- a/SharedAssemblyInfo.cs +++ b/SharedAssemblyInfo.cs @@ -10,6 +10,6 @@ [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("9.2.0")] -[assembly: AssemblyFileVersion("9.2.0")] -[assembly: AssemblyInformationalVersion("9.2.0")] +[assembly: AssemblyVersion("9.3.0")] +[assembly: AssemblyFileVersion("9.3.0")] +[assembly: AssemblyInformationalVersion("9.3.0")] From 13961f5ea9c0035b08a4db3f01ef37ebdece4df1 Mon Sep 17 00:00:00 2001 From: James Friel Date: Mon, 9 Mar 2026 10:30:00 +0000 Subject: [PATCH 02/15] update ui --- .../ExecuteCommandCreateNewLoadMetadata.cs | 2 +- Rdmp.Core/Curation/Data/Catalogue.cs | 2 +- .../Curation/Data/DataLoad/LoadMetadata.cs | 37 ++++++++++++------- .../LoadEvents/LoadEventsTreeView.cs | 3 +- 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCreateNewLoadMetadata.cs b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCreateNewLoadMetadata.cs index 17af1ccdd1..9a7cb2a214 100644 --- a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCreateNewLoadMetadata.cs +++ b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCreateNewLoadMetadata.cs @@ -60,7 +60,7 @@ public override void Execute() lmd.EnsureLoggingWorksFor(_catalogue); - _catalogue.SaveToDatabase(); + //_catalogue.SaveToDatabase(); lmd.Folder = Folder; lmd.SaveToDatabase(); diff --git a/Rdmp.Core/Curation/Data/Catalogue.cs b/Rdmp.Core/Curation/Data/Catalogue.cs index 897faaf761..84148b0ff8 100644 --- a/Rdmp.Core/Curation/Data/Catalogue.cs +++ b/Rdmp.Core/Curation/Data/Catalogue.cs @@ -446,7 +446,7 @@ public string Ticket /// [DoNotExtractProperty] - [NotMapped] + [NoMappingToDatabase] public List LoggingDataTasks { get => Repository.GetAllObjectsWhere("CatalogueID", this.ID).Select(lmcl => (ILoadMetadataCatalogueLinkage)lmcl).ToList(); diff --git a/Rdmp.Core/Curation/Data/DataLoad/LoadMetadata.cs b/Rdmp.Core/Curation/Data/DataLoad/LoadMetadata.cs index 8992558211..c1fcd98745 100644 --- a/Rdmp.Core/Curation/Data/DataLoad/LoadMetadata.cs +++ b/Rdmp.Core/Curation/Data/DataLoad/LoadMetadata.cs @@ -395,23 +395,34 @@ private IDataAccessPoint[] GetLoggingServers() /// public string GetDistinctLoggingTask() { - var catalogueMetadatas = GetAllCatalogues().ToArray(); + var tasks = Repository.GetAllObjectsWhere("LoadMetadataID", ID); + var names = tasks.Select(t => t.Name).Distinct().ToArray(); + if (!tasks.Any()) + throw new Exception($"This LoadMetadata () is not associated with any logging tasks"); + if (names.Length == 1) + { + return names[0]; + } else + { + throw new Exception($"There are {names.Length} distinct logging tasks associated with this LoadMetadata (ID={ID}) - not allowed"); + } + //var catalogueMetadatas = GetAllCatalogues().ToArray(); - if (!catalogueMetadatas.Any()) - throw new Exception($"There are no Catalogues associated with load metadata (ID={ID})"); + //if (!catalogueMetadatas.Any()) + // throw new Exception($"There are no Catalogues associated with load metadata (ID={ID})"); - var cataloguesWithoutLoggingTasks = - catalogueMetadatas.Where(c => c.LoggingDataTasks.Count ==0).ToArray(); + //var cataloguesWithoutLoggingTasks = + // catalogueMetadatas.Where(c => c.LoggingDataTasks.Count == 0).ToArray(); - if (cataloguesWithoutLoggingTasks.Any()) - throw new Exception( - $"The following Catalogues do not have a LoggingDataTask specified:{cataloguesWithoutLoggingTasks.Aggregate("", (s, n) => $"{s}{n}(ID={n.ID}),")}"); + //if (cataloguesWithoutLoggingTasks.Any()) + // throw new Exception( + // $"The following Catalogues do not have a LoggingDataTask specified:{cataloguesWithoutLoggingTasks.Aggregate("", (s, n) => $"{s}{n}(ID={n.ID}),")}"); - var distinctLoggingTasks = catalogueMetadatas.SelectMany(c => c.LoggingDataTasks); - return distinctLoggingTasks.Count() >= 2 ? - throw new Exception( - $"There are {distinctLoggingTasks.Count()} logging tasks in Catalogues belonging to this metadata (ID={ID})") - : distinctLoggingTasks.First().Name; + //var distinctLoggingTasks = catalogueMetadatas.SelectMany(c => c.LoggingDataTasks); + //return distinctLoggingTasks.Count() >= 2 ? + // throw new Exception( + // $"There are {distinctLoggingTasks.Count()} logging tasks in Catalogues belonging to this metadata (ID={ID})") + // : distinctLoggingTasks.First().Name; } /// diff --git a/Rdmp.UI/CatalogueSummary/LoadEvents/LoadEventsTreeView.cs b/Rdmp.UI/CatalogueSummary/LoadEvents/LoadEventsTreeView.cs index a69c6496a2..cfa6caca3f 100644 --- a/Rdmp.UI/CatalogueSummary/LoadEvents/LoadEventsTreeView.cs +++ b/Rdmp.UI/CatalogueSummary/LoadEvents/LoadEventsTreeView.cs @@ -243,6 +243,7 @@ private void _populateLoadHistory_DoWork(object sender, DoWorkEventArgs e) ArchivalDataLoadInfo[] results; try { + var x = Collection.RootObject.GetDistinctLoggingTask(); _logManager = new LogManager(Collection.RootObject.GetDistinctLoggingDatabase()); var unfilteredResults = _logManager.GetArchivalDataLoadInfos( Collection.RootObject.GetDistinctLoggingTask(), _populateLoadHistoryCancel.Token, null, _toFetch); @@ -253,7 +254,7 @@ private void _populateLoadHistory_DoWork(object sender, DoWorkEventArgs e) results = Array.Empty(); } - _populateLoadHistoryResults = results; + _populateLoadHistoryResults =results; } catch (Exception exception) { From 6e4fc80ebb5e97cc37465b0bf702c444e5b5ac22 Mon Sep 17 00:00:00 2001 From: James Friel Date: Mon, 9 Mar 2026 10:45:57 +0000 Subject: [PATCH 03/15] stub test --- Tests.Common/RdmpMockFactory.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Tests.Common/RdmpMockFactory.cs b/Tests.Common/RdmpMockFactory.cs index f0a862c951..58d7528c6e 100644 --- a/Tests.Common/RdmpMockFactory.cs +++ b/Tests.Common/RdmpMockFactory.cs @@ -10,6 +10,7 @@ using Rdmp.Core.Curation.Data.DataLoad; using Rdmp.Core.Curation.Data.EntityNaming; using Rdmp.Core.ReusableLibraryCode.DataAccess; +using System.Collections.Generic; namespace Tests.Common; @@ -63,7 +64,8 @@ public static ILoadMetadata Mock_LoadMetadataLoadingTable(ITableInfo tableInfo) lmd.GetDistinctLoggingTask().Returns(TestLoggingTask); cata.GetTableInfoList(Arg.Any()).Returns(new[] { tableInfo }); - cata.LoggingDataTask.Returns(TestLoggingTask); + //cata.LoggingDataTasks.Returns(new List() { }); + //cata.LoggingDataTasks.Returns(new List() { new LoadMetadataCatalogueLinkage() { CatalogueID = cata.ID, LoadMetadataID = lmd.ID, Name = TestLoggingTask } }); return lmd; } From 2741526d7e7189cae45d137a91b5afdefce1c88a Mon Sep 17 00:00:00 2001 From: James Friel Date: Mon, 9 Mar 2026 11:18:58 +0000 Subject: [PATCH 04/15] update tests --- .../ExecuteCommandCloneLoadMetadataTests.cs | 5 +-- .../ExecuteCommandConfirmLogsTests.cs | 35 ++++--------------- ...teCommandCreateLoadMetadataVersionTests.cs | 5 +-- .../ExecuteCommandRestoreLoadMetadataTests.cs | 1 - .../Integration/LoadProgressUnitTests.cs | 10 +++--- ...MetadataLoggingConfigurationChecksTests.cs | 10 +++--- .../Integration/CachedFileRetrieverTests.cs | 2 +- .../Integration/DataLoadChainerTests.cs | 2 +- .../Integration/DataLoadEngineTestsBase.cs | 2 +- .../DataLoadProgressUpdateInfoTests.cs | 2 +- .../Engine/Integration/HICPipelineTests.cs | 5 +-- .../Engine/Integration/PayloadTest.cs | 2 +- 12 files changed, 25 insertions(+), 56 deletions(-) diff --git a/Rdmp.Core.Tests/CommandExecution/ExecuteCommandCloneLoadMetadataTests.cs b/Rdmp.Core.Tests/CommandExecution/ExecuteCommandCloneLoadMetadataTests.cs index 1097a59ffe..599e1c5e8f 100644 --- a/Rdmp.Core.Tests/CommandExecution/ExecuteCommandCloneLoadMetadataTests.cs +++ b/Rdmp.Core.Tests/CommandExecution/ExecuteCommandCloneLoadMetadataTests.cs @@ -15,10 +15,7 @@ public void TestCloneLoadMetadata() { var lmd1 = new LoadMetadata(CatalogueRepository, "MyLmd"); lmd1.Description = "Desc!"; - var cata = new Catalogue(CatalogueRepository, "myCata") - { - LoggingDataTask = "B" - }; + var cata = new Catalogue(CatalogueRepository, "myCata"); cata.SaveToDatabase(); lmd1.LinkToCatalogue(cata); var pt1 = new ProcessTask(CatalogueRepository, lmd1, LoadStage.Mounting) diff --git a/Rdmp.Core.Tests/CommandExecution/ExecuteCommandConfirmLogsTests.cs b/Rdmp.Core.Tests/CommandExecution/ExecuteCommandConfirmLogsTests.cs index fb44d35722..1f4fc4f22a 100644 --- a/Rdmp.Core.Tests/CommandExecution/ExecuteCommandConfirmLogsTests.cs +++ b/Rdmp.Core.Tests/CommandExecution/ExecuteCommandConfirmLogsTests.cs @@ -22,10 +22,7 @@ internal class ExecuteCommandConfirmLogsTests : DatabaseTests public void ConfirmLogs_NoEntries_Throws() { var lmd = new LoadMetadata(CatalogueRepository, "MyLmd"); - var cata = new Catalogue(CatalogueRepository, "myCata") - { - LoggingDataTask = "GGG" - }; + var cata = new Catalogue(CatalogueRepository, "myCata"); cata.SaveToDatabase(); lmd.LinkToCatalogue(cata); var lm = new LogManager(lmd.GetDistinctLoggingDatabase()); @@ -42,10 +39,7 @@ public void ConfirmLogs_NoEntries_Throws() public void ConfirmLogs_HappyEntries_Passes(bool withinTime) { var lmd = new LoadMetadata(CatalogueRepository, "MyLmd"); - var cata = new Catalogue(CatalogueRepository, "myCata") - { - LoggingDataTask = "FFF" - }; + var cata = new Catalogue(CatalogueRepository, "myCata"); cata.SaveToDatabase(); lmd.LinkToCatalogue(cata); var lm = new LogManager(lmd.GetDistinctLoggingDatabase()); @@ -66,10 +60,7 @@ public void ConfirmLogs_HappyEntries_Passes(bool withinTime) public void ConfirmLogs_SadEntry_BecauseNeverEnded_Throws() { var lmd = new LoadMetadata(CatalogueRepository, "MyLmd"); - var cata = new Catalogue(CatalogueRepository, "myCata") - { - LoggingDataTask = "FFF" - }; + var cata = new Catalogue(CatalogueRepository, "myCata"); cata.SaveToDatabase(); lmd.LinkToCatalogue(cata); var lm = new LogManager(lmd.GetDistinctLoggingDatabase()); @@ -88,10 +79,7 @@ public void ConfirmLogs_SadEntry_BecauseNeverEnded_Throws() public void ConfirmLogs_SadEntryWithEx_Throws() { var lmd = new LoadMetadata(CatalogueRepository, "MyLmd"); - var cata = new Catalogue(CatalogueRepository, "myCata") - { - LoggingDataTask = "FFF" - }; + var cata = new Catalogue(CatalogueRepository, "myCata"); cata.SaveToDatabase(); lmd.LinkToCatalogue(cata); var lm = new LogManager(lmd.GetDistinctLoggingDatabase()); @@ -110,10 +98,7 @@ public void ConfirmLogs_SadEntryWithEx_Throws() public void ConfirmLogs_NotWithinTime_Throws() { var lmd = new LoadMetadata(CatalogueRepository, "MyLmd"); - var cata = new Catalogue(CatalogueRepository, "myCata") - { - LoggingDataTask = "FFF" - }; + var cata = new Catalogue(CatalogueRepository, "myCata"); cata.SaveToDatabase(); lmd.LinkToCatalogue(cata); var lm = new LogManager(lmd.GetDistinctLoggingDatabase()); @@ -137,17 +122,11 @@ public void ConfirmLogs_NotWithinTime_Throws() public void ConfirmLogs_With2CacheProgress_Throws() { var lmd1 = new LoadMetadata(CatalogueRepository, "MyLmd"); - var cata = new Catalogue(CatalogueRepository, "myCata") - { - LoggingDataTask = "B" - }; + var cata = new Catalogue(CatalogueRepository, "myCata"); cata.SaveToDatabase(); lmd1.LinkToCatalogue(cata); var lmd2 = new LoadMetadata(CatalogueRepository, "MyLmd"); - var cata2 = new Catalogue(CatalogueRepository, "myCata") - { - LoggingDataTask = "A" - }; + var cata2 = new Catalogue(CatalogueRepository, "myCata"); cata2.SaveToDatabase(); var linkage2 = new LoadMetadataCatalogueLinkage(CatalogueRepository, lmd2, cata2); linkage2.SaveToDatabase(); diff --git a/Rdmp.Core.Tests/CommandExecution/ExecuteCommandCreateLoadMetadataVersionTests.cs b/Rdmp.Core.Tests/CommandExecution/ExecuteCommandCreateLoadMetadataVersionTests.cs index 7ce1e56ef9..e848b3e923 100644 --- a/Rdmp.Core.Tests/CommandExecution/ExecuteCommandCreateLoadMetadataVersionTests.cs +++ b/Rdmp.Core.Tests/CommandExecution/ExecuteCommandCreateLoadMetadataVersionTests.cs @@ -15,10 +15,7 @@ public void TestCreateLoadMetadataVersion() { var lmd1 = new LoadMetadata(CatalogueRepository, "MyLmd"); lmd1.Description = "Desc!"; - var cata = new Catalogue(CatalogueRepository, "myCata") - { - LoggingDataTask = "B" - }; + var cata = new Catalogue(CatalogueRepository, "myCata"); cata.SaveToDatabase(); lmd1.LinkToCatalogue(cata); var pt1 = new ProcessTask(CatalogueRepository, lmd1, LoadStage.Mounting) diff --git a/Rdmp.Core.Tests/CommandExecution/ExecuteCommandRestoreLoadMetadataTests.cs b/Rdmp.Core.Tests/CommandExecution/ExecuteCommandRestoreLoadMetadataTests.cs index fa5eb6ab6a..7ebccc28bf 100644 --- a/Rdmp.Core.Tests/CommandExecution/ExecuteCommandRestoreLoadMetadataTests.cs +++ b/Rdmp.Core.Tests/CommandExecution/ExecuteCommandRestoreLoadMetadataTests.cs @@ -19,7 +19,6 @@ public void TestRestoreLoadMetadataVersion() lmd1.Description = "Desc!"; var cata = new Catalogue(CatalogueRepository, "myCata") { - LoggingDataTask = "B" }; cata.SaveToDatabase(); lmd1.LinkToCatalogue(cata); diff --git a/Rdmp.Core.Tests/Curation/Integration/LoadProgressUnitTests.cs b/Rdmp.Core.Tests/Curation/Integration/LoadProgressUnitTests.cs index ca14b85ba3..86d031d1c3 100644 --- a/Rdmp.Core.Tests/Curation/Integration/LoadProgressUnitTests.cs +++ b/Rdmp.Core.Tests/Curation/Integration/LoadProgressUnitTests.cs @@ -70,11 +70,11 @@ public void LoadProgress_JobFactory_NoDates() var dir = LoadDirectory.CreateDirectoryStructure(new DirectoryInfo(TestContext.CurrentContext.WorkDirectory), "LoadProgress_JobFactory_NoDates", true, (LoadMetadata)lmd); - foreach (var cata in lmd.GetAllCatalogues()) - { - cata.LoggingDataTask = "ff"; - cata.SaveToDatabase(); - } + //foreach (var cata in lmd.GetAllCatalogues()) + //{ + // cata.LoggingDataTask = "ff"; + // cata.SaveToDatabase(); + //} lmd.SaveToDatabase(); diff --git a/Rdmp.Core.Tests/Curation/Integration/MetadataLoggingConfigurationChecksTests.cs b/Rdmp.Core.Tests/Curation/Integration/MetadataLoggingConfigurationChecksTests.cs index e598813681..f3c7468937 100644 --- a/Rdmp.Core.Tests/Curation/Integration/MetadataLoggingConfigurationChecksTests.cs +++ b/Rdmp.Core.Tests/Curation/Integration/MetadataLoggingConfigurationChecksTests.cs @@ -40,7 +40,7 @@ public void Test_MismatchedLoggingTask() var cata1 = lmd.GetAllCatalogues().Single(); var cata2 = WhenIHaveA(); lmd.LinkToCatalogue(cata2); - cata1.LoggingDataTask = "OMG YEAGH"; + //cata1.LoggingDataTask = "OMG YEAGH"; Assert.That(lmd.GetAllCatalogues().Count(), Is.EqualTo(2)); @@ -58,9 +58,9 @@ public void Test_MissingLoggingServer() var cata1 = lmd.GetAllCatalogues().Single(); var cata2 = WhenIHaveA(); lmd.LinkToCatalogue(cata2); - cata1.LoggingDataTask = "OMG YEAGH"; + //cata1.LoggingDataTask = "OMG YEAGH"; cata1.LiveLoggingServer_ID = 2; - cata2.LoggingDataTask = "OMG YEAGH"; + //cata2.LoggingDataTask = "OMG YEAGH"; cata2.LiveLoggingServer_ID = null; Assert.That(lmd.GetAllCatalogues().Count(), Is.EqualTo(2)); @@ -84,9 +84,9 @@ public void Test_MissingLoggingServer_UseDefault() eds.SaveToDatabase(); lmd.LinkToCatalogue(cata2); - cata1.LoggingDataTask = "OMG YEAGH"; + //cata1.LoggingDataTask = "OMG YEAGH"; cata1.LiveLoggingServer_ID = null; - cata2.LoggingDataTask = "OMG YEAGH"; + //cata2.LoggingDataTask = "OMG YEAGH"; cata2.LiveLoggingServer_ID = null; var defaults = RepositoryLocator.CatalogueRepository; diff --git a/Rdmp.Core.Tests/DataLoad/Engine/Integration/CachedFileRetrieverTests.cs b/Rdmp.Core.Tests/DataLoad/Engine/Integration/CachedFileRetrieverTests.cs index e2a9f9b7f7..9bf326d609 100644 --- a/Rdmp.Core.Tests/DataLoad/Engine/Integration/CachedFileRetrieverTests.cs +++ b/Rdmp.Core.Tests/DataLoad/Engine/Integration/CachedFileRetrieverTests.cs @@ -175,7 +175,7 @@ private ScheduledDataLoadJob CreateTestJob(ILoadDirectory directory) var catalogue = Substitute.For(); catalogue.GetTableInfoList(false).Returns(Array.Empty()); catalogue.GetLookupTableInfoList().Returns(Array.Empty()); - catalogue.LoggingDataTask.Returns("TestLogging"); + //catalogue.LoggingDataTask.Returns("TestLogging"); var logManager = Substitute.For(); var loadMetadata = Substitute.For(); diff --git a/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadChainerTests.cs b/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadChainerTests.cs index 31c174e057..874e2c713d 100644 --- a/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadChainerTests.cs +++ b/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadChainerTests.cs @@ -98,7 +98,7 @@ INSERT [DLCTest] ([AdmissionDate], [DischargeDate], [Condition1], [Condition2], var loggingServer = CatalogueRepository.GetDefaultFor(PermissableDefaults.LiveLoggingServer_ID); var logManager = new LogManager(loggingServer); logManager.CreateNewLoggingTaskIfNotExists(lmd.Name); - cata.LoggingDataTask = lmd.Name; + //cata.LoggingDataTask = lmd.Name; cata.SaveToDatabase(); lmd.LinkToCatalogue(cata2); var pc = new ProcessTask(CatalogueRepository, lmd, LoadStage.PostLoad); diff --git a/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadEngineTestsBase.cs b/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadEngineTestsBase.cs index bdada6dbc1..538a9bc31b 100644 --- a/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadEngineTestsBase.cs +++ b/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadEngineTestsBase.cs @@ -91,7 +91,7 @@ protected ITableInfo Import(DiscoveredTable tbl, LoadMetadata lmd, LogManager lo forwardEngineer.ExecuteForwardEngineering(out var cata, out var cataItems, out var eis); //make the catalogue use the load configuration - cata.LoggingDataTask = lmd.Name; + //cata.LoggingDataTask = lmd.Name; Assert.That(cata.LiveLoggingServer_ID, Is.Not.Null); //catalogue should have one of these because of system defaults cata.SaveToDatabase(); lmd.LinkToCatalogue(cata); diff --git a/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadProgressUpdateInfoTests.cs b/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadProgressUpdateInfoTests.cs index 8bfade42a4..2270dd604f 100644 --- a/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadProgressUpdateInfoTests.cs +++ b/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadProgressUpdateInfoTests.cs @@ -28,7 +28,7 @@ public class DataLoadProgressUpdateInfoTests : DatabaseTests public DataLoadProgressUpdateInfoTests() { var cata = Substitute.For(); - cata.LoggingDataTask.Returns("NothingTask"); + //cata.LoggingDataTask.Returns("NothingTask"); cata.GetTableInfoList(false).Returns(Array.Empty()); cata.GetLookupTableInfoList().Returns(Array.Empty()); diff --git a/Rdmp.Core.Tests/DataLoad/Engine/Integration/HICPipelineTests.cs b/Rdmp.Core.Tests/DataLoad/Engine/Integration/HICPipelineTests.cs index 8d3090f788..7a9aeca0a3 100644 --- a/Rdmp.Core.Tests/DataLoad/Engine/Integration/HICPipelineTests.cs +++ b/Rdmp.Core.Tests/DataLoad/Engine/Integration/HICPipelineTests.cs @@ -79,10 +79,7 @@ public void Create(CatalogueRepository repository, DiscoveredDatabase database, LoadMetadata.LocationOfCacheDirectory = Path.Combine(directory.RootPath.FullName, LoadMetadata.DefaultCachePath); LoadMetadata.SaveToDatabase(); - Catalogue = new Catalogue(repository, "HICLoadPipelineTests") - { - LoggingDataTask = "Test", - }; + Catalogue = new Catalogue(repository, "HICLoadPipelineTests"); Catalogue.SaveToDatabase(); LoadMetadata.LinkToCatalogue(Catalogue); var catalogueItem = new CatalogueItem(repository, Catalogue, "Test"); diff --git a/Rdmp.Core.Tests/DataLoad/Engine/Integration/PayloadTest.cs b/Rdmp.Core.Tests/DataLoad/Engine/Integration/PayloadTest.cs index f442288206..6bb6982c8e 100644 --- a/Rdmp.Core.Tests/DataLoad/Engine/Integration/PayloadTest.cs +++ b/Rdmp.Core.Tests/DataLoad/Engine/Integration/PayloadTest.cs @@ -45,7 +45,7 @@ public void TestPayloadInjection() MEF.AddTypeToCatalogForTesting(typeof(TestPayloadAttacher)); - b.catalogue.LoggingDataTask = "TestPayloadInjection"; + //b.catalogue.LoggingDataTask = "TestPayloadInjection"; b.catalogue.SaveToDatabase(); lmd.LinkToCatalogue(b.catalogue); var lm = new LogManager(CatalogueRepository.GetDefaultFor(PermissableDefaults.LiveLoggingServer_ID)); From 7212d14ced6773fade11bb4a93bb734501e8cb2b Mon Sep 17 00:00:00 2001 From: James Friel Date: Mon, 9 Mar 2026 11:30:36 +0000 Subject: [PATCH 05/15] fix sql --- .../runAfterCreateDatabase/CreateCatalogue.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rdmp.Core/Databases/CatalogueDatabase/runAfterCreateDatabase/CreateCatalogue.sql b/Rdmp.Core/Databases/CatalogueDatabase/runAfterCreateDatabase/CreateCatalogue.sql index 6ae07e3504..3accbe2d26 100644 --- a/Rdmp.Core/Databases/CatalogueDatabase/runAfterCreateDatabase/CreateCatalogue.sql +++ b/Rdmp.Core/Databases/CatalogueDatabase/runAfterCreateDatabase/CreateCatalogue.sql @@ -946,7 +946,7 @@ CREATE TABLE [dbo].LoadMetadataCatalogueLinkage( [ID] [int] IDENTITY(1,1) NOT NULL, [LoadMetadataID] [int] NOT NULL, [CatalogueID] [int] NOT NULL, - [Name] [nvarchar(max)] NOT NULL, + [Name] [nvarchar](max) NOT NULL, FOREIGN KEY ([LoadMetadataID]) REFERENCES [dbo].[LoadMetadata](ID) ON DELETE CASCADE, FOREIGN KEY ([CatalogueID]) REFERENCES [dbo].[Catalogue](ID) ON DELETE CASCADE, CONSTRAINT [PK_LoadMetadataCatalogueLinkage] PRIMARY KEY CLUSTERED From 0f63c6293d961f2a8ccf3b79237b88227fef3730 Mon Sep 17 00:00:00 2001 From: James Friel Date: Mon, 9 Mar 2026 11:38:56 +0000 Subject: [PATCH 06/15] reorder catalogue class --- Rdmp.Core/Curation/Data/Catalogue.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Rdmp.Core/Curation/Data/Catalogue.cs b/Rdmp.Core/Curation/Data/Catalogue.cs index 84148b0ff8..f9d538d4d0 100644 --- a/Rdmp.Core/Curation/Data/Catalogue.cs +++ b/Rdmp.Core/Curation/Data/Catalogue.cs @@ -444,13 +444,6 @@ public string Ticket set => SetField(ref _ticket, value); } - /// - [DoNotExtractProperty] - [NoMappingToDatabase] - public List LoggingDataTasks - { - get => Repository.GetAllObjectsWhere("CatalogueID", this.ID).Select(lmcl => (ILoadMetadataCatalogueLinkage)lmcl).ToList(); - } /// [DoNotExtractProperty] @@ -556,6 +549,15 @@ public DateTime? DatasetStartDate [NoMappingToDatabase] public CatalogueItem[] CatalogueItems => _knownCatalogueItems.Value; + + /// + [DoNotExtractProperty] + [NoMappingToDatabase] + public List LoggingDataTasks + { + get => Repository.GetAllObjectsWhere("CatalogueID", this.ID).Select(lmcl => (ILoadMetadataCatalogueLinkage)lmcl).ToList(); + } + /// public LoadMetadata[] LoadMetadatas() { From fd2e775855a8333190401ca259cf10c430496a01 Mon Sep 17 00:00:00 2001 From: James Friel Date: Mon, 9 Mar 2026 13:37:08 +0000 Subject: [PATCH 07/15] update tests --- .../ExecuteCommandConfirmLogsTests.cs | 8 ++++---- ...MetadataLoggingConfigurationChecksTests.cs | 18 ------------------ .../Curation/Data/DataLoad/LoadMetadata.cs | 4 ++-- .../MetadataLoggingConfigurationChecks.cs | 19 +------------------ 4 files changed, 7 insertions(+), 42 deletions(-) diff --git a/Rdmp.Core.Tests/CommandExecution/ExecuteCommandConfirmLogsTests.cs b/Rdmp.Core.Tests/CommandExecution/ExecuteCommandConfirmLogsTests.cs index 1f4fc4f22a..fb405cd3ea 100644 --- a/Rdmp.Core.Tests/CommandExecution/ExecuteCommandConfirmLogsTests.cs +++ b/Rdmp.Core.Tests/CommandExecution/ExecuteCommandConfirmLogsTests.cs @@ -41,7 +41,7 @@ public void ConfirmLogs_HappyEntries_Passes(bool withinTime) var lmd = new LoadMetadata(CatalogueRepository, "MyLmd"); var cata = new Catalogue(CatalogueRepository, "myCata"); cata.SaveToDatabase(); - lmd.LinkToCatalogue(cata); + lmd.LinkToCatalogue(cata,"FFF"); var lm = new LogManager(lmd.GetDistinctLoggingDatabase()); lm.CreateNewLoggingTaskIfNotExists("FFF"); var logEntry = lm.CreateDataLoadInfo("FFF", "pack o' cards", "going down gambling", null, true); @@ -62,7 +62,7 @@ public void ConfirmLogs_SadEntry_BecauseNeverEnded_Throws() var lmd = new LoadMetadata(CatalogueRepository, "MyLmd"); var cata = new Catalogue(CatalogueRepository, "myCata"); cata.SaveToDatabase(); - lmd.LinkToCatalogue(cata); + lmd.LinkToCatalogue(cata,"FFF"); var lm = new LogManager(lmd.GetDistinctLoggingDatabase()); lm.CreateNewLoggingTaskIfNotExists("FFF"); @@ -81,7 +81,7 @@ public void ConfirmLogs_SadEntryWithEx_Throws() var lmd = new LoadMetadata(CatalogueRepository, "MyLmd"); var cata = new Catalogue(CatalogueRepository, "myCata"); cata.SaveToDatabase(); - lmd.LinkToCatalogue(cata); + lmd.LinkToCatalogue(cata,"FFF"); var lm = new LogManager(lmd.GetDistinctLoggingDatabase()); lm.CreateNewLoggingTaskIfNotExists("FFF"); var logEntry = lm.CreateDataLoadInfo("FFF", "pack o' cards", "going down gambling", null, true); @@ -100,7 +100,7 @@ public void ConfirmLogs_NotWithinTime_Throws() var lmd = new LoadMetadata(CatalogueRepository, "MyLmd"); var cata = new Catalogue(CatalogueRepository, "myCata"); cata.SaveToDatabase(); - lmd.LinkToCatalogue(cata); + lmd.LinkToCatalogue(cata,"FFF"); var lm = new LogManager(lmd.GetDistinctLoggingDatabase()); lm.CreateNewLoggingTaskIfNotExists("FFF"); var logEntry = lm.CreateDataLoadInfo("FFF", "pack o' cards", "going down gambling", null, true); diff --git a/Rdmp.Core.Tests/Curation/Integration/MetadataLoggingConfigurationChecksTests.cs b/Rdmp.Core.Tests/Curation/Integration/MetadataLoggingConfigurationChecksTests.cs index f3c7468937..ac0af2d577 100644 --- a/Rdmp.Core.Tests/Curation/Integration/MetadataLoggingConfigurationChecksTests.cs +++ b/Rdmp.Core.Tests/Curation/Integration/MetadataLoggingConfigurationChecksTests.cs @@ -33,24 +33,6 @@ public void Test_NoLoggingTask() "Create a new Logging Task called 'MyLoad'?", toMem); } - [Test] - public void Test_MismatchedLoggingTask() - { - var lmd = WhenIHaveA(); - var cata1 = lmd.GetAllCatalogues().Single(); - var cata2 = WhenIHaveA(); - lmd.LinkToCatalogue(cata2); - //cata1.LoggingDataTask = "OMG YEAGH"; - - Assert.That(lmd.GetAllCatalogues().Count(), Is.EqualTo(2)); - - var checks = new MetadataLoggingConfigurationChecks(lmd); - var toMem = new ToMemoryCheckNotifier(); - checks.Check(toMem); - - AssertFailWithFix("Some catalogues have NULL LoggingDataTasks", "Set task to OMG YEAGH", toMem); - } - [Test] public void Test_MissingLoggingServer() { diff --git a/Rdmp.Core/Curation/Data/DataLoad/LoadMetadata.cs b/Rdmp.Core/Curation/Data/DataLoad/LoadMetadata.cs index c1fcd98745..f563d67ebd 100644 --- a/Rdmp.Core/Curation/Data/DataLoad/LoadMetadata.cs +++ b/Rdmp.Core/Curation/Data/DataLoad/LoadMetadata.cs @@ -308,9 +308,9 @@ internal LoadMetadata(ShareManager shareManager, ShareDefinition shareDefinition shareManager.UpsertAndHydrate(this, shareDefinition); } - public void LinkToCatalogue(ICatalogue catalogue) + public void LinkToCatalogue(ICatalogue catalogue,string linkageName=null) { - var linkage = new LoadMetadataCatalogueLinkage(CatalogueRepository, this, catalogue); + var linkage = new LoadMetadataCatalogueLinkage(CatalogueRepository, this, catalogue, linkageName); linkage.SaveToDatabase(); } diff --git a/Rdmp.Core/DataLoad/Engine/Checks/Checkers/MetadataLoggingConfigurationChecks.cs b/Rdmp.Core/DataLoad/Engine/Checks/Checkers/MetadataLoggingConfigurationChecks.cs index ce2eba833f..7c8d0d0711 100644 --- a/Rdmp.Core/DataLoad/Engine/Checks/Checkers/MetadataLoggingConfigurationChecks.cs +++ b/Rdmp.Core/DataLoad/Engine/Checks/Checkers/MetadataLoggingConfigurationChecks.cs @@ -66,23 +66,6 @@ public void Check(ICheckNotifier notifier) var missingTasks = catalogues.Where(c => c.LoggingDataTasks.Count() ==0).ToArray(); var potentialTasks = catalogues.Except(missingTasks).SelectMany(c => c.LoggingDataTasks).Distinct().ToArray(); - //If any Catalogues are missing tasks - if (missingTasks.Any()) - //but there is consensus for those that are not missing tasks - if (potentialTasks.Length == 1) - { - var fix = notifier.OnCheckPerformed(new CheckEventArgs("Some catalogues have NULL LoggingDataTasks", - CheckResult.Fail, null, $"Set task to {potentialTasks.Single()}")); - - if (fix) - foreach (var cata in missingTasks) - { - throw new Exception("Is this ever hit?"); - //cata.LoggingDataTask = potentialTasks.Single(); - //cata.SaveToDatabase(); - } - } - #endregion #region Fix missing LiveLoggingServer_ID @@ -172,7 +155,7 @@ public void Check(ICheckNotifier notifier) } catch (Exception e) { - notifier.OnCheckPerformed(new CheckEventArgs("Could reach default logging server", CheckResult.Fail, e)); + notifier.OnCheckPerformed(new CheckEventArgs("Could not reach default logging server", CheckResult.Fail, e)); } } From 2a5b53397a15fb7d66fb3f05a332b913a238a2e3 Mon Sep 17 00:00:00 2001 From: James Friel Date: Tue, 10 Mar 2026 11:46:50 +0000 Subject: [PATCH 08/15] fix logging task --- .../MetadataLoggingConfigurationChecksTests.cs | 15 --------------- .../Integration/CachedFileRetrieverTests.cs | 6 +++++- Rdmp.Core/DataLoad/Engine/Job/DataLoadJob.cs | 4 ++-- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/Rdmp.Core.Tests/Curation/Integration/MetadataLoggingConfigurationChecksTests.cs b/Rdmp.Core.Tests/Curation/Integration/MetadataLoggingConfigurationChecksTests.cs index ac0af2d577..d2e35172a6 100644 --- a/Rdmp.Core.Tests/Curation/Integration/MetadataLoggingConfigurationChecksTests.cs +++ b/Rdmp.Core.Tests/Curation/Integration/MetadataLoggingConfigurationChecksTests.cs @@ -17,21 +17,6 @@ namespace Rdmp.Core.Tests.Curation.Integration; public class MetadataLoggingConfigurationChecksTests : UnitTests { - [Test] - public void Test_NoLoggingTask() - { - var lmd = WhenIHaveA(); - var cata = WhenIHaveA(); - lmd.LinkToCatalogue(cata); - Assert.That(lmd.GetAllCatalogues().Count(), Is.EqualTo(2)); - - var checks = new MetadataLoggingConfigurationChecks(lmd); - var toMem = new ToMemoryCheckNotifier(); - checks.Check(toMem); - - AssertFailWithFix("Catalogues Mycata,Mycata do not have a logging task specified", - "Create a new Logging Task called 'MyLoad'?", toMem); - } [Test] public void Test_MissingLoggingServer() diff --git a/Rdmp.Core.Tests/DataLoad/Engine/Integration/CachedFileRetrieverTests.cs b/Rdmp.Core.Tests/DataLoad/Engine/Integration/CachedFileRetrieverTests.cs index 9bf326d609..3ac7bca87e 100644 --- a/Rdmp.Core.Tests/DataLoad/Engine/Integration/CachedFileRetrieverTests.cs +++ b/Rdmp.Core.Tests/DataLoad/Engine/Integration/CachedFileRetrieverTests.cs @@ -175,11 +175,15 @@ private ScheduledDataLoadJob CreateTestJob(ILoadDirectory directory) var catalogue = Substitute.For(); catalogue.GetTableInfoList(false).Returns(Array.Empty()); catalogue.GetLookupTableInfoList().Returns(Array.Empty()); - //catalogue.LoggingDataTask.Returns("TestLogging"); var logManager = Substitute.For(); var loadMetadata = Substitute.For(); loadMetadata.GetAllCatalogues().Returns(new[] { catalogue }); + var link = Substitute.For(); + link.CatalogueID.Returns(catalogue.ID); + link.LoadMetadataID.Returns(loadMetadata.ID); + link.Name.Returns("Test linkage"); + catalogue.LoggingDataTasks.Returns(new List() { link }); var j = new ScheduledDataLoadJob(RepositoryLocator, "Test job", logManager, loadMetadata, directory, ThrowImmediatelyDataLoadEventListener.Quiet, null) diff --git a/Rdmp.Core/DataLoad/Engine/Job/DataLoadJob.cs b/Rdmp.Core/DataLoad/Engine/Job/DataLoadJob.cs index 61a27026d2..751077e809 100644 --- a/Rdmp.Core/DataLoad/Engine/Job/DataLoadJob.cs +++ b/Rdmp.Core/DataLoad/Engine/Job/DataLoadJob.cs @@ -76,10 +76,10 @@ public DataLoadJob(IRDMPPlatformRepositoryServiceLocator repositoryLocator, stri private string GetLoggingTask(IEnumerable cataloguesToLoad) { - var distinctLoggingTasks = cataloguesToLoad.SelectMany(catalogue => catalogue.LoggingDataTasks).Distinct().ToList(); + var distinctLoggingTasks = cataloguesToLoad.SelectMany(catalogue => catalogue.LoggingDataTasks).DistinctBy(l => l.Name ).ToList(); if (distinctLoggingTasks.Count > 1) throw new Exception( - $"The catalogues to be loaded do not share the same logging task: {string.Join(", ", distinctLoggingTasks)}"); + $"The catalogues to be loaded do not share the same logging task: {string.Join(", ", distinctLoggingTasks.Select(l => l.Name))}"); _loggingTask = distinctLoggingTasks.First().Name; return string.IsNullOrWhiteSpace(_loggingTask) From 192b41e25d795166a4c2ad05b2b218066532ffdd Mon Sep 17 00:00:00 2001 From: James Friel Date: Tue, 10 Mar 2026 14:42:48 +0000 Subject: [PATCH 09/15] update tests --- CHANGELOG.md | 3 +++ .../DataLoad/Engine/Integration/DataLoadChainerTests.cs | 3 ++- .../Engine/Integration/DataLoadProgressUpdateInfoTests.cs | 8 ++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 253717b998..01ca1fb036 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [9.3.0] - Unreleased +- Update Load Metadata logging linkage to Catalogue + ## [9.2.0] - Unreleased - Add Internal Note to Catalogue - Fix issue where project associations were not copied when a CIC was cloned diff --git a/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadChainerTests.cs b/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadChainerTests.cs index 874e2c713d..1afe917821 100644 --- a/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadChainerTests.cs +++ b/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadChainerTests.cs @@ -100,7 +100,8 @@ INSERT [DLCTest] ([AdmissionDate], [DischargeDate], [Condition1], [Condition2], logManager.CreateNewLoggingTaskIfNotExists(lmd.Name); //cata.LoggingDataTask = lmd.Name; cata.SaveToDatabase(); - lmd.LinkToCatalogue(cata2); + lmd.LinkToCatalogue(cata, lmd.Name); + lmd.LinkToCatalogue(cata2, lmd.Name); var pc = new ProcessTask(CatalogueRepository, lmd, LoadStage.PostLoad); pc.ProcessTaskType = ProcessTaskType.DataProvider; pc.Path = "Rdmp.Core.DataLoad.Modules.DataProvider.DataLoadChainer"; diff --git a/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadProgressUpdateInfoTests.cs b/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadProgressUpdateInfoTests.cs index 2270dd604f..4643e37ce2 100644 --- a/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadProgressUpdateInfoTests.cs +++ b/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadProgressUpdateInfoTests.cs @@ -28,13 +28,17 @@ public class DataLoadProgressUpdateInfoTests : DatabaseTests public DataLoadProgressUpdateInfoTests() { var cata = Substitute.For(); - //cata.LoggingDataTask.Returns("NothingTask"); + cata.GetTableInfoList(false).Returns(Array.Empty()); cata.GetLookupTableInfoList().Returns(Array.Empty()); var lmd = Substitute.For(); lmd.GetAllCatalogues().Returns(new[] { cata }); - + var link = Substitute.For(); + link.CatalogueID.Returns(cata.ID); + link.LoadMetadataID.Returns(lmd.ID); + link.Name.Returns("fish"); + cata.LoggingDataTasks.Returns(new List() { link }); _job = new ScheduledDataLoadJob(null, "fish", Substitute.For(), lmd, null, new ThrowImmediatelyDataLoadJob(), null); } From 3c6a8808f94e14d300eb0efb9c9bf794c2187ad3 Mon Sep 17 00:00:00 2001 From: James Friel Date: Wed, 11 Mar 2026 09:20:18 +0000 Subject: [PATCH 10/15] update mock factory --- .../DataLoad/Engine/Integration/DataLoadChainerTests.cs | 7 +++---- .../DataLoad/Engine/Integration/PayloadTest.cs | 3 +-- Tests.Common/RdmpMockFactory.cs | 8 +++++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadChainerTests.cs b/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadChainerTests.cs index 1afe917821..994d2a4bda 100644 --- a/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadChainerTests.cs +++ b/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadChainerTests.cs @@ -98,10 +98,9 @@ INSERT [DLCTest] ([AdmissionDate], [DischargeDate], [Condition1], [Condition2], var loggingServer = CatalogueRepository.GetDefaultFor(PermissableDefaults.LiveLoggingServer_ID); var logManager = new LogManager(loggingServer); logManager.CreateNewLoggingTaskIfNotExists(lmd.Name); - //cata.LoggingDataTask = lmd.Name; cata.SaveToDatabase(); - lmd.LinkToCatalogue(cata, lmd.Name); - lmd.LinkToCatalogue(cata2, lmd.Name); + lmd.LinkToCatalogue(cata, "MyLoad"); + lmd.LinkToCatalogue(cata2, "MyLoad"); var pc = new ProcessTask(CatalogueRepository, lmd, LoadStage.PostLoad); pc.ProcessTaskType = ProcessTaskType.DataProvider; pc.Path = "Rdmp.Core.DataLoad.Modules.DataProvider.DataLoadChainer"; @@ -127,7 +126,7 @@ INSERT [DLCTest] ([AdmissionDate], [DischargeDate], [Condition1], [Condition2], lmd2.LocationOfExecutablesDirectory = Path.GetTempPath(); lmd2.LocationOfCacheDirectory = Path.GetTempPath(); lmd2.SaveToDatabase(); - lmd2.LinkToCatalogue(cata2); + lmd2.LinkToCatalogue(cata2, "MyLoad"); pc = new ProcessTask(CatalogueRepository, lmd2, LoadStage.GetFiles); pc.ProcessTaskType = ProcessTaskType.DataProvider; pc.Path = "Rdmp.Core.DataLoad.Modules.DataProvider.DoNothingDataProvider"; diff --git a/Rdmp.Core.Tests/DataLoad/Engine/Integration/PayloadTest.cs b/Rdmp.Core.Tests/DataLoad/Engine/Integration/PayloadTest.cs index 6bb6982c8e..a42e5c6f76 100644 --- a/Rdmp.Core.Tests/DataLoad/Engine/Integration/PayloadTest.cs +++ b/Rdmp.Core.Tests/DataLoad/Engine/Integration/PayloadTest.cs @@ -45,9 +45,8 @@ public void TestPayloadInjection() MEF.AddTypeToCatalogForTesting(typeof(TestPayloadAttacher)); - //b.catalogue.LoggingDataTask = "TestPayloadInjection"; b.catalogue.SaveToDatabase(); - lmd.LinkToCatalogue(b.catalogue); + lmd.LinkToCatalogue(b.catalogue, "TestPayloadInjection"); var lm = new LogManager(CatalogueRepository.GetDefaultFor(PermissableDefaults.LiveLoggingServer_ID)); lm.CreateNewLoggingTaskIfNotExists("TestPayloadInjection"); diff --git a/Tests.Common/RdmpMockFactory.cs b/Tests.Common/RdmpMockFactory.cs index 58d7528c6e..5c698d4053 100644 --- a/Tests.Common/RdmpMockFactory.cs +++ b/Tests.Common/RdmpMockFactory.cs @@ -62,10 +62,12 @@ public static ILoadMetadata Mock_LoadMetadataLoadingTable(ITableInfo tableInfo) lmd.GetDistinctLiveDatabaseServer().Returns(server); lmd.GetAllCatalogues().Returns(new[] { cata }); lmd.GetDistinctLoggingTask().Returns(TestLoggingTask); - + var link = Substitute.For(); + link.CatalogueID.Returns(cata.ID); + link.LoadMetadataID.Returns(lmd.ID); + link.Name = TestLoggingTask; + cata.LoggingDataTasks.Returns(new List() { link}); cata.GetTableInfoList(Arg.Any()).Returns(new[] { tableInfo }); - //cata.LoggingDataTasks.Returns(new List() { }); - //cata.LoggingDataTasks.Returns(new List() { new LoadMetadataCatalogueLinkage() { CatalogueID = cata.ID, LoadMetadataID = lmd.ID, Name = TestLoggingTask } }); return lmd; } From 5310867e35b123d77184cf2453e188e065021acf Mon Sep 17 00:00:00 2001 From: James Friel Date: Wed, 11 Mar 2026 10:37:35 +0000 Subject: [PATCH 11/15] fix redact test --- .../DataLoad/Engine/Integration/DataLoadEngineTestsBase.cs | 2 +- .../DataLoad/Modules/Mutilators/RegexRedactionMutilatorTests.cs | 2 ++ Tests.Common/UnitTests.cs | 1 - 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadEngineTestsBase.cs b/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadEngineTestsBase.cs index 538a9bc31b..161abb1fb8 100644 --- a/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadEngineTestsBase.cs +++ b/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadEngineTestsBase.cs @@ -80,7 +80,7 @@ protected static LoadDirectory SetupLoadDirectory(LoadMetadata lmd) protected ITableInfo Import(DiscoveredTable tbl, LoadMetadata lmd, LogManager logManager) { - logManager.CreateNewLoggingTaskIfNotExists(lmd.Name); + logManager.CreateNewLoggingTaskIfNotExists($"Loading {lmd.Name}({lmd.ID})"); //import TableInfos var importer = new TableInfoImporter(CatalogueRepository, tbl); diff --git a/Rdmp.Core.Tests/DataLoad/Modules/Mutilators/RegexRedactionMutilatorTests.cs b/Rdmp.Core.Tests/DataLoad/Modules/Mutilators/RegexRedactionMutilatorTests.cs index 4ffed00465..45be38809a 100644 --- a/Rdmp.Core.Tests/DataLoad/Modules/Mutilators/RegexRedactionMutilatorTests.cs +++ b/Rdmp.Core.Tests/DataLoad/Modules/Mutilators/RegexRedactionMutilatorTests.cs @@ -1,6 +1,7 @@ using FAnsi; using FAnsi.Discovery; using NUnit.Framework; +using Rdmp.Core.Curation.Data; using Rdmp.Core.Curation.Data.DataLoad; using Rdmp.Core.Curation.Data.Defaults; using Rdmp.Core.Curation.DataHelper.RegexRedaction; @@ -65,6 +66,7 @@ public void RedactionMutilator_BasicTest() lmd.IgnoreTrigger = true; lmd.SaveToDatabase(); + var ti = Import(tbl, lmd, logManager); var projectDirectory = SetupLoadDirectory(lmd); diff --git a/Tests.Common/UnitTests.cs b/Tests.Common/UnitTests.cs index 9569870268..d75b6919cb 100644 --- a/Tests.Common/UnitTests.cs +++ b/Tests.Common/UnitTests.cs @@ -609,7 +609,6 @@ public static T WhenIHaveA(MemoryDataExportRepository repository) where T : D return (T)(object)new ExtractableDataSetProject(repository, WhenIHaveA(repository), WhenIHaveA(repository)); } - throw new TestCaseNotWrittenYetException(typeof(T)); } From ccb1cbb211877c26d05c0156495c035826f71aa3 Mon Sep 17 00:00:00 2001 From: James Friel Date: Wed, 11 Mar 2026 11:32:57 +0000 Subject: [PATCH 12/15] update test --- .../Integration/LoadProgressUnitTests.cs | 6 ------ .../MetadataLoggingConfigurationChecksTests.cs | 4 ---- .../Curation/UnitTestsAllObjectsSupported.cs | 2 +- .../Integration/DataLoadEngineTestsBase.cs | 2 -- .../Mutilators/RegexRedactionMutilatorTests.cs | 1 - .../Reports/CustomMetadataReportTests.cs | 2 +- ...CommandAssociateCatalogueWithLoadMetadata.cs | 2 -- .../ExecuteCommandCreateNewLoadMetadata.cs | 2 -- .../Curation/Data/DataLoad/LoadMetadata.cs | 17 ----------------- .../MetadataLoggingConfigurationChecks.cs | 2 -- .../LoadEvents/LoadEventsTreeView.cs | 10 +++++----- 11 files changed, 7 insertions(+), 43 deletions(-) diff --git a/Rdmp.Core.Tests/Curation/Integration/LoadProgressUnitTests.cs b/Rdmp.Core.Tests/Curation/Integration/LoadProgressUnitTests.cs index 86d031d1c3..9a16f8198a 100644 --- a/Rdmp.Core.Tests/Curation/Integration/LoadProgressUnitTests.cs +++ b/Rdmp.Core.Tests/Curation/Integration/LoadProgressUnitTests.cs @@ -70,12 +70,6 @@ public void LoadProgress_JobFactory_NoDates() var dir = LoadDirectory.CreateDirectoryStructure(new DirectoryInfo(TestContext.CurrentContext.WorkDirectory), "LoadProgress_JobFactory_NoDates", true, (LoadMetadata)lmd); - //foreach (var cata in lmd.GetAllCatalogues()) - //{ - // cata.LoggingDataTask = "ff"; - // cata.SaveToDatabase(); - //} - lmd.SaveToDatabase(); var jobFactory = new SingleScheduledJobFactory(lp, strat, 999, lp.LoadMetadata, null); diff --git a/Rdmp.Core.Tests/Curation/Integration/MetadataLoggingConfigurationChecksTests.cs b/Rdmp.Core.Tests/Curation/Integration/MetadataLoggingConfigurationChecksTests.cs index d2e35172a6..6f12b9576e 100644 --- a/Rdmp.Core.Tests/Curation/Integration/MetadataLoggingConfigurationChecksTests.cs +++ b/Rdmp.Core.Tests/Curation/Integration/MetadataLoggingConfigurationChecksTests.cs @@ -25,9 +25,7 @@ public void Test_MissingLoggingServer() var cata1 = lmd.GetAllCatalogues().Single(); var cata2 = WhenIHaveA(); lmd.LinkToCatalogue(cata2); - //cata1.LoggingDataTask = "OMG YEAGH"; cata1.LiveLoggingServer_ID = 2; - //cata2.LoggingDataTask = "OMG YEAGH"; cata2.LiveLoggingServer_ID = null; Assert.That(lmd.GetAllCatalogues().Count(), Is.EqualTo(2)); @@ -51,9 +49,7 @@ public void Test_MissingLoggingServer_UseDefault() eds.SaveToDatabase(); lmd.LinkToCatalogue(cata2); - //cata1.LoggingDataTask = "OMG YEAGH"; cata1.LiveLoggingServer_ID = null; - //cata2.LoggingDataTask = "OMG YEAGH"; cata2.LiveLoggingServer_ID = null; var defaults = RepositoryLocator.CatalogueRepository; diff --git a/Rdmp.Core.Tests/Curation/UnitTestsAllObjectsSupported.cs b/Rdmp.Core.Tests/Curation/UnitTestsAllObjectsSupported.cs index 95d816bebc..c04a16a9ed 100644 --- a/Rdmp.Core.Tests/Curation/UnitTestsAllObjectsSupported.cs +++ b/Rdmp.Core.Tests/Curation/UnitTestsAllObjectsSupported.cs @@ -38,7 +38,7 @@ public void TestAllSupported() foreach (var t in types) { //ignore these types too - if (SkipTheseTypes.Contains(t.Name) || t.Name.StartsWith("Spontaneous", StringComparison.Ordinal) || + if (SkipTheseTypes.Contains(t.Name) || t.Name.EndsWith("Proxy") || t.Name.StartsWith("Spontaneous", StringComparison.Ordinal) || typeof(SpontaneousObject).IsAssignableFrom(t)) continue; diff --git a/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadEngineTestsBase.cs b/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadEngineTestsBase.cs index 161abb1fb8..c35c8a0733 100644 --- a/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadEngineTestsBase.cs +++ b/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadEngineTestsBase.cs @@ -90,8 +90,6 @@ protected ITableInfo Import(DiscoveredTable tbl, LoadMetadata lmd, LogManager lo var forwardEngineer = new ForwardEngineerCatalogue(ti, cis); forwardEngineer.ExecuteForwardEngineering(out var cata, out var cataItems, out var eis); - //make the catalogue use the load configuration - //cata.LoggingDataTask = lmd.Name; Assert.That(cata.LiveLoggingServer_ID, Is.Not.Null); //catalogue should have one of these because of system defaults cata.SaveToDatabase(); lmd.LinkToCatalogue(cata); diff --git a/Rdmp.Core.Tests/DataLoad/Modules/Mutilators/RegexRedactionMutilatorTests.cs b/Rdmp.Core.Tests/DataLoad/Modules/Mutilators/RegexRedactionMutilatorTests.cs index 45be38809a..08e8e7c3d7 100644 --- a/Rdmp.Core.Tests/DataLoad/Modules/Mutilators/RegexRedactionMutilatorTests.cs +++ b/Rdmp.Core.Tests/DataLoad/Modules/Mutilators/RegexRedactionMutilatorTests.cs @@ -1,7 +1,6 @@ using FAnsi; using FAnsi.Discovery; using NUnit.Framework; -using Rdmp.Core.Curation.Data; using Rdmp.Core.Curation.Data.DataLoad; using Rdmp.Core.Curation.Data.Defaults; using Rdmp.Core.Curation.DataHelper.RegexRedaction; diff --git a/Rdmp.Core.Tests/Reports/CustomMetadataReportTests.cs b/Rdmp.Core.Tests/Reports/CustomMetadataReportTests.cs index 8223b48985..fa198a357d 100644 --- a/Rdmp.Core.Tests/Reports/CustomMetadataReportTests.cs +++ b/Rdmp.Core.Tests/Reports/CustomMetadataReportTests.cs @@ -1387,7 +1387,7 @@ public void TestAllSubs_Catalogue() $IsDeprecated $IsInternalDataset $Last_revision_date -$LoggingDataTask +$LoggingDataTasks $Name $Periodicity $PivotCategory_ExtractionInformation_ID diff --git a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandAssociateCatalogueWithLoadMetadata.cs b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandAssociateCatalogueWithLoadMetadata.cs index 6dd4ba7868..e846ed1a73 100644 --- a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandAssociateCatalogueWithLoadMetadata.cs +++ b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandAssociateCatalogueWithLoadMetadata.cs @@ -90,7 +90,6 @@ public override void Execute() "Synchronise Logging Tasks")) { //switch Catalogue to use that logging task (including servers) - //cata.LoggingDataTask = task; var lmdcl = new LoadMetadataCatalogueLinkage(cata.CatalogueRepository, _loadMetadata, cata,task.Name); lmdcl.SaveToDatabase(); cata.LiveLoggingServer_ID = liveServers.SingleOrDefault(); @@ -101,7 +100,6 @@ public override void Execute() { var lmdcl = new LoadMetadataCatalogueLinkage(cata.CatalogueRepository, _loadMetadata, cata); lmdcl.SaveToDatabase(); - //cata.LoggingDataTask = $"Loading {_loadMetadata.Name}"; } } cata.SaveToDatabase(); diff --git a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCreateNewLoadMetadata.cs b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCreateNewLoadMetadata.cs index 9a7cb2a214..0f559e636c 100644 --- a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCreateNewLoadMetadata.cs +++ b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCreateNewLoadMetadata.cs @@ -60,8 +60,6 @@ public override void Execute() lmd.EnsureLoggingWorksFor(_catalogue); - //_catalogue.SaveToDatabase(); - lmd.Folder = Folder; lmd.SaveToDatabase(); diff --git a/Rdmp.Core/Curation/Data/DataLoad/LoadMetadata.cs b/Rdmp.Core/Curation/Data/DataLoad/LoadMetadata.cs index f563d67ebd..c0fabba211 100644 --- a/Rdmp.Core/Curation/Data/DataLoad/LoadMetadata.cs +++ b/Rdmp.Core/Curation/Data/DataLoad/LoadMetadata.cs @@ -406,23 +406,6 @@ public string GetDistinctLoggingTask() { throw new Exception($"There are {names.Length} distinct logging tasks associated with this LoadMetadata (ID={ID}) - not allowed"); } - //var catalogueMetadatas = GetAllCatalogues().ToArray(); - - //if (!catalogueMetadatas.Any()) - // throw new Exception($"There are no Catalogues associated with load metadata (ID={ID})"); - - //var cataloguesWithoutLoggingTasks = - // catalogueMetadatas.Where(c => c.LoggingDataTasks.Count == 0).ToArray(); - - //if (cataloguesWithoutLoggingTasks.Any()) - // throw new Exception( - // $"The following Catalogues do not have a LoggingDataTask specified:{cataloguesWithoutLoggingTasks.Aggregate("", (s, n) => $"{s}{n}(ID={n.ID}),")}"); - - //var distinctLoggingTasks = catalogueMetadatas.SelectMany(c => c.LoggingDataTasks); - //return distinctLoggingTasks.Count() >= 2 ? - // throw new Exception( - // $"There are {distinctLoggingTasks.Count()} logging tasks in Catalogues belonging to this metadata (ID={ID})") - // : distinctLoggingTasks.First().Name; } /// diff --git a/Rdmp.Core/DataLoad/Engine/Checks/Checkers/MetadataLoggingConfigurationChecks.cs b/Rdmp.Core/DataLoad/Engine/Checks/Checkers/MetadataLoggingConfigurationChecks.cs index 7c8d0d0711..5a3e9ed736 100644 --- a/Rdmp.Core/DataLoad/Engine/Checks/Checkers/MetadataLoggingConfigurationChecks.cs +++ b/Rdmp.Core/DataLoad/Engine/Checks/Checkers/MetadataLoggingConfigurationChecks.cs @@ -193,8 +193,6 @@ private void CreateNewLoggingTaskFor(ICheckNotifier notifier, ICatalogue[] catal catalogue.LiveLoggingServer_ID = loggingServer.ID; var lmdcl = new LoadMetadataCatalogueLinkage(catarepo,_loadMetadata, catalogue, proposedName); lmdcl.SaveToDatabase(); - //catalogue.LoggingDataTask = proposedName; - //catalogue.SaveToDatabase(); } } } \ No newline at end of file diff --git a/Rdmp.UI/CatalogueSummary/LoadEvents/LoadEventsTreeView.cs b/Rdmp.UI/CatalogueSummary/LoadEvents/LoadEventsTreeView.cs index cfa6caca3f..a0f13b6a5d 100644 --- a/Rdmp.UI/CatalogueSummary/LoadEvents/LoadEventsTreeView.cs +++ b/Rdmp.UI/CatalogueSummary/LoadEvents/LoadEventsTreeView.cs @@ -82,7 +82,7 @@ public LoadEventsTreeView() _btnApplyFilter.Click += (s, e) => ApplyFilter(_tbFilterBox.Text); _tbToFetch.TextChanged += TbToFetchTextChanged; _btnFetch.Click += (s, e) => PopulateLoadHistory(); - _btnFlat.Click += (s,e) => ToggleView(); + _btnFlat.Click += (s, e) => ToggleView(); RDMPCollectionCommonFunctionality.SetupColumnTracking(treeView1, olvDescription, new Guid("6b09f39c-2b88-41ed-a396-42a2d2288952")); RDMPCollectionCommonFunctionality.SetupColumnTracking(treeView1, olvDate, @@ -218,7 +218,8 @@ private void _populateLoadHistory_RunWorkerCompleted(object sender, RunWorkerCom public void AddObjects(ArchivalDataLoadInfo[] archivalDataLoadInfos) { - if (_flatView) { + if (_flatView) + { treeView1.AddObjects(archivalDataLoadInfos.SelectMany(adli => adli.TableLoadInfos).ToList()); treeView1.AddObjects(archivalDataLoadInfos.SelectMany(adli => adli.Errors).ToList()); treeView1.AddObjects(archivalDataLoadInfos.SelectMany(adli => adli.Progress).ToList()); @@ -243,7 +244,6 @@ private void _populateLoadHistory_DoWork(object sender, DoWorkEventArgs e) ArchivalDataLoadInfo[] results; try { - var x = Collection.RootObject.GetDistinctLoggingTask(); _logManager = new LogManager(Collection.RootObject.GetDistinctLoggingDatabase()); var unfilteredResults = _logManager.GetArchivalDataLoadInfos( Collection.RootObject.GetDistinctLoggingTask(), _populateLoadHistoryCancel.Token, null, _toFetch); @@ -254,7 +254,7 @@ private void _populateLoadHistory_DoWork(object sender, DoWorkEventArgs e) results = Array.Empty(); } - _populateLoadHistoryResults =results; + _populateLoadHistoryResults = results; } catch (Exception exception) { @@ -265,7 +265,7 @@ private void _populateLoadHistory_DoWork(object sender, DoWorkEventArgs e) private void ToggleView() { _flatView = !_flatView; - _btnFlat.Text = _flatView ?"Nested View": "Flat View"; + _btnFlat.Text = _flatView ? "Nested View" : "Flat View"; PopulateLoadHistory(); } From 6fc1b833d7dc588d67c09a9e800a7ebdd181019b Mon Sep 17 00:00:00 2001 From: James Friel Date: Wed, 11 Mar 2026 11:50:09 +0000 Subject: [PATCH 13/15] delete unused files --- .../CreateNewLoadMetadataUI.Designer.cs | 102 ------- .../DataLoadUIs/CreateNewLoadMetadataUI.cs | 60 ---- .../DataLoadUIs/CreateNewLoadMetadataUI.resx | 120 -------- .../ChooseLoggingTaskUI.Designer.cs | 195 ------------- Rdmp.UI/SimpleDialogs/ChooseLoggingTaskUI.cs | 265 ------------------ .../SimpleDialogs/ChooseLoggingTaskUI.resx | 120 -------- 6 files changed, 862 deletions(-) delete mode 100644 Rdmp.UI/DataLoadUIs/CreateNewLoadMetadataUI.Designer.cs delete mode 100644 Rdmp.UI/DataLoadUIs/CreateNewLoadMetadataUI.cs delete mode 100644 Rdmp.UI/DataLoadUIs/CreateNewLoadMetadataUI.resx delete mode 100644 Rdmp.UI/SimpleDialogs/ChooseLoggingTaskUI.Designer.cs delete mode 100644 Rdmp.UI/SimpleDialogs/ChooseLoggingTaskUI.cs delete mode 100644 Rdmp.UI/SimpleDialogs/ChooseLoggingTaskUI.resx diff --git a/Rdmp.UI/DataLoadUIs/CreateNewLoadMetadataUI.Designer.cs b/Rdmp.UI/DataLoadUIs/CreateNewLoadMetadataUI.Designer.cs deleted file mode 100644 index 6575e8ef13..0000000000 --- a/Rdmp.UI/DataLoadUIs/CreateNewLoadMetadataUI.Designer.cs +++ /dev/null @@ -1,102 +0,0 @@ -using Rdmp.UI.SimpleDialogs; - -namespace Rdmp.UI.DataLoadUIs -{ - partial class CreateNewLoadMetadataUI - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.btnCreate = new System.Windows.Forms.Button(); - this.tbLoadMetadataNameToCreate = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.chooseLoggingTaskUI1 = new ChooseLoggingTaskUI(); - this.SuspendLayout(); - // - // btnCreate - // - this.btnCreate.Enabled = false; - this.btnCreate.Location = new System.Drawing.Point(39, 175); - this.btnCreate.Name = "btnCreate"; - this.btnCreate.Size = new System.Drawing.Size(75, 23); - this.btnCreate.TabIndex = 3; - this.btnCreate.Text = "Create"; - this.btnCreate.UseVisualStyleBackColor = true; - this.btnCreate.Click += new System.EventHandler(this.btnCreate_Click); - // - // tbLoadMetadataNameToCreate - // - this.tbLoadMetadataNameToCreate.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.tbLoadMetadataNameToCreate.Location = new System.Drawing.Point(63, 8); - this.tbLoadMetadataNameToCreate.Name = "tbLoadMetadataNameToCreate"; - this.tbLoadMetadataNameToCreate.Size = new System.Drawing.Size(1003, 20); - this.tbLoadMetadataNameToCreate.TabIndex = 2; - this.tbLoadMetadataNameToCreate.TextChanged += new System.EventHandler(this.tbLoadMetadataNameToCreate_TextChanged); - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(19, 11); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(38, 13); - this.label3.TabIndex = 1; - this.label3.Text = "Name:"; - // - // chooseLoggingTaskUI1 - // - this.chooseLoggingTaskUI1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.chooseLoggingTaskUI1.Catalogue = null; - this.chooseLoggingTaskUI1.Location = new System.Drawing.Point(22, 34); - this.chooseLoggingTaskUI1.Name = "chooseLoggingTaskUI1"; - this.chooseLoggingTaskUI1.Size = new System.Drawing.Size(1044, 144); - this.chooseLoggingTaskUI1.TabIndex = 0; - // - // CreateNewLoadMetadataUI - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1078, 202); - this.Controls.Add(this.btnCreate); - this.Controls.Add(this.tbLoadMetadataNameToCreate); - this.Controls.Add(this.label3); - this.Controls.Add(this.chooseLoggingTaskUI1); - this.Name = "CreateNewLoadMetadataUI"; - this.Text = "Create New Load"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private SimpleDialogs.ChooseLoggingTaskUI chooseLoggingTaskUI1; - private System.Windows.Forms.Button btnCreate; - private System.Windows.Forms.TextBox tbLoadMetadataNameToCreate; - private System.Windows.Forms.Label label3; - } -} \ No newline at end of file diff --git a/Rdmp.UI/DataLoadUIs/CreateNewLoadMetadataUI.cs b/Rdmp.UI/DataLoadUIs/CreateNewLoadMetadataUI.cs deleted file mode 100644 index d64290e85d..0000000000 --- a/Rdmp.UI/DataLoadUIs/CreateNewLoadMetadataUI.cs +++ /dev/null @@ -1,60 +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; -using System.ComponentModel; -using System.Windows.Forms; -using Rdmp.Core.Curation.Data; -using Rdmp.Core.Curation.Data.DataLoad; -using Rdmp.UI.ItemActivation; -using Rdmp.UI.TestsAndSetup.ServicePropogation; - -namespace Rdmp.UI.DataLoadUIs; - -/// -/// There is a M-1 relationship between Catalogues (datasets) and LoadMetadata (data load recipes). This window is accessed by right clicking a Catalogue and choosing -/// to configure its LoadMetadata (how data is loaded). You can either select an existing LoadMetadata (which will probably need modifying such that it correctly loads -/// the new table in addition to what other datasets it already loaded. Or you can create a new LoadMetadata and create a load from scratch. -/// -/// Once selected you will be taken to the dataset load configuration screen (See LoadMetadataUI) -/// -/// -public partial class CreateNewLoadMetadataUI : RDMPForm -{ - private readonly Catalogue _catalogue; - - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public LoadMetadata LoadMetadataCreatedIfAny { get; set; } - - public CreateNewLoadMetadataUI(Catalogue catalogue, IActivateItems activator) : base(activator) - { - _catalogue = catalogue; - InitializeComponent(); - - chooseLoggingTaskUI1.SetItemActivator(activator); - chooseLoggingTaskUI1.Catalogue = catalogue; - } - - private void tbLoadMetadataNameToCreate_TextChanged(object sender, EventArgs e) - { - btnCreate.Enabled = !string.IsNullOrWhiteSpace(tbLoadMetadataNameToCreate.Text); - } - - private void btnCreate_Click(object sender, EventArgs e) - { - //if (string.IsNullOrWhiteSpace(_catalogue.LoggingDataTask)) - //{ - // MessageBox.Show("You must configure a logging task first"); - // return; - //} - - LoadMetadataCreatedIfAny = new LoadMetadata(Activator.RepositoryLocator.CatalogueRepository, - tbLoadMetadataNameToCreate.Text); - - DialogResult = DialogResult.OK; - Close(); - } -} \ No newline at end of file diff --git a/Rdmp.UI/DataLoadUIs/CreateNewLoadMetadataUI.resx b/Rdmp.UI/DataLoadUIs/CreateNewLoadMetadataUI.resx deleted file mode 100644 index 1af7de150c..0000000000 --- a/Rdmp.UI/DataLoadUIs/CreateNewLoadMetadataUI.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Rdmp.UI/SimpleDialogs/ChooseLoggingTaskUI.Designer.cs b/Rdmp.UI/SimpleDialogs/ChooseLoggingTaskUI.Designer.cs deleted file mode 100644 index f9f5af5e35..0000000000 --- a/Rdmp.UI/SimpleDialogs/ChooseLoggingTaskUI.Designer.cs +++ /dev/null @@ -1,195 +0,0 @@ -using Rdmp.UI.ChecksUI; - -namespace Rdmp.UI.SimpleDialogs -{ - partial class ChooseLoggingTaskUI - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.btnClearLive = new System.Windows.Forms.Button(); - this.btnCreateNewLoggingServer = new System.Windows.Forms.Button(); - this.ragSmiley1 = new RAGSmiley(); - this.ddLoggingServer = new System.Windows.Forms.ComboBox(); - this.btnCreateNewLoggingTask = new System.Windows.Forms.Button(); - this.btnRefresh = new System.Windows.Forms.Button(); - this.label2 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.cbxDataLoadTasks = new System.Windows.Forms.ComboBox(); - this.groupBox2.SuspendLayout(); - this.SuspendLayout(); - // - // groupBox2 - // - this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox2.Controls.Add(this.btnClearLive); - this.groupBox2.Controls.Add(this.btnCreateNewLoggingServer); - this.groupBox2.Controls.Add(this.ragSmiley1); - this.groupBox2.Controls.Add(this.ddLoggingServer); - this.groupBox2.Controls.Add(this.btnCreateNewLoggingTask); - this.groupBox2.Controls.Add(this.btnRefresh); - this.groupBox2.Controls.Add(this.label2); - this.groupBox2.Controls.Add(this.label1); - this.groupBox2.Controls.Add(this.cbxDataLoadTasks); - this.groupBox2.Location = new System.Drawing.Point(12, 12); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(1015, 80); - this.groupBox2.TabIndex = 1; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "Logging Architecture"; - // - // btnClearLive - // - this.btnClearLive.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnClearLive.Location = new System.Drawing.Point(786, 49); - this.btnClearLive.Name = "btnClearLive"; - this.btnClearLive.Size = new System.Drawing.Size(52, 23); - this.btnClearLive.TabIndex = 8; - this.btnClearLive.Text = "Clear"; - this.btnClearLive.UseVisualStyleBackColor = true; - this.btnClearLive.Click += new System.EventHandler(this.btnClear_Click); - // - // btnCreateNewLoggingServer - // - this.btnCreateNewLoggingServer.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnCreateNewLoggingServer.Location = new System.Drawing.Point(841, 48); - this.btnCreateNewLoggingServer.Name = "btnCreateNewLoggingServer"; - this.btnCreateNewLoggingServer.Size = new System.Drawing.Size(168, 23); - this.btnCreateNewLoggingServer.TabIndex = 7; - this.btnCreateNewLoggingServer.Text = "Create New Logging Server..."; - this.btnCreateNewLoggingServer.UseVisualStyleBackColor = true; - this.btnCreateNewLoggingServer.Click += new System.EventHandler(this.btnCreateNewLoggingServer_Click); - // - // ragSmiley1 - // - this.ragSmiley1.AlwaysShowHandCursor = false; - this.ragSmiley1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.ragSmiley1.BackColor = System.Drawing.Color.Transparent; - this.ragSmiley1.Cursor = System.Windows.Forms.Cursors.Arrow; - this.ragSmiley1.Location = new System.Drawing.Point(962, 11); - this.ragSmiley1.Name = "ragSmiley1"; - this.ragSmiley1.Size = new System.Drawing.Size(37, 38); - this.ragSmiley1.TabIndex = 6; - // - // ddLoggingServer - // - this.ddLoggingServer.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.ddLoggingServer.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.ddLoggingServer.FormattingEnabled = true; - this.ddLoggingServer.Location = new System.Drawing.Point(118, 50); - this.ddLoggingServer.Name = "ddLoggingServer"; - this.ddLoggingServer.Size = new System.Drawing.Size(664, 21); - this.ddLoggingServer.TabIndex = 5; - this.ddLoggingServer.SelectedIndexChanged += new System.EventHandler(this.ddLoggingServer_SelectedIndexChanged); - // - // btnCreateNewLoggingTask - // - this.btnCreateNewLoggingTask.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnCreateNewLoggingTask.Location = new System.Drawing.Point(869, 21); - this.btnCreateNewLoggingTask.Name = "btnCreateNewLoggingTask"; - this.btnCreateNewLoggingTask.Size = new System.Drawing.Size(75, 23); - this.btnCreateNewLoggingTask.TabIndex = 4; - this.btnCreateNewLoggingTask.Text = "Create"; - this.btnCreateNewLoggingTask.UseVisualStyleBackColor = true; - this.btnCreateNewLoggingTask.Click += new System.EventHandler(this.btnCreateNewLoggingTask_Click); - // - // btnRefresh - // - this.btnRefresh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnRefresh.Location = new System.Drawing.Point(788, 21); - this.btnRefresh.Name = "btnRefresh"; - this.btnRefresh.Size = new System.Drawing.Size(75, 23); - this.btnRefresh.TabIndex = 4; - this.btnRefresh.Text = "Refresh"; - this.btnRefresh.UseVisualStyleBackColor = true; - this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click); - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(6, 53); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(82, 13); - this.label2.TabIndex = 1; - this.label2.Text = "Logging Server:"; - this.label2.Click += new System.EventHandler(this.label1_Click); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(7, 26); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(81, 13); - this.label1.TabIndex = 1; - this.label1.Text = "DataLoadTask:"; - this.label1.Click += new System.EventHandler(this.label1_Click); - // - // cbxDataLoadTasks - // - this.cbxDataLoadTasks.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.cbxDataLoadTasks.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; - this.cbxDataLoadTasks.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; - this.cbxDataLoadTasks.FormattingEnabled = true; - this.cbxDataLoadTasks.Location = new System.Drawing.Point(94, 23); - this.cbxDataLoadTasks.Name = "cbxDataLoadTasks"; - this.cbxDataLoadTasks.Size = new System.Drawing.Size(688, 21); - this.cbxDataLoadTasks.TabIndex = 0; - this.cbxDataLoadTasks.SelectedIndexChanged += new System.EventHandler(this.cbxDataLoadTasks_SelectedIndexChanged); - this.cbxDataLoadTasks.TextChanged += new System.EventHandler(this.cbxDataLoadTasks_TextChanged); - this.cbxDataLoadTasks.KeyUp += new System.Windows.Forms.KeyEventHandler(this.cbxDataLoadTasks_KeyUp); - this.cbxDataLoadTasks.Leave += new System.EventHandler(this.cbxDataLoadTasks_Leave); - // - // ChooseLoggingTaskUI - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.groupBox2); - this.Name = "ChooseLoggingTaskUI"; - this.Size = new System.Drawing.Size(1039, 99); - this.groupBox2.ResumeLayout(false); - this.groupBox2.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.ComboBox cbxDataLoadTasks; - private System.Windows.Forms.Button btnRefresh; - private System.Windows.Forms.ComboBox ddLoggingServer; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Button btnCreateNewLoggingTask; - private RAGSmiley ragSmiley1; - private System.Windows.Forms.Button btnCreateNewLoggingServer; - private System.Windows.Forms.Button btnClearLive; - } -} \ No newline at end of file diff --git a/Rdmp.UI/SimpleDialogs/ChooseLoggingTaskUI.cs b/Rdmp.UI/SimpleDialogs/ChooseLoggingTaskUI.cs deleted file mode 100644 index 42db43c657..0000000000 --- a/Rdmp.UI/SimpleDialogs/ChooseLoggingTaskUI.cs +++ /dev/null @@ -1,265 +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; -using System.ComponentModel; -using System.Linq; -using System.Windows.Forms; -using Rdmp.Core.Curation.Data; -using Rdmp.Core.Curation.Data.Defaults; -using Rdmp.Core.Databases; -using Rdmp.Core.Logging; -using Rdmp.Core.ReusableLibraryCode.Checks; -using Rdmp.Core.ReusableLibraryCode.DataAccess; -using Rdmp.UI.ChecksUI; -using Rdmp.UI.TestsAndSetup.ServicePropogation; -using Rdmp.UI.Versioning; - -namespace Rdmp.UI.SimpleDialogs; - -/// -/// Every dataset (Catalogue) can have its own Logging task and Logging server. If you have multiple logging servers (e.g. a test logging server and a live logging server). You -/// can configure each of these independently. If you only have one logging server then just set the live logging server. -/// -/// Once you have set the logging server you should create or select an existing task (e.g. 'Loading Biochemistry' might be a good logging task for Biochemistry dataset). All datasets -/// in a given load (see LoadMetadataUI) must share the same logging task so it is worth considering the naming for example you might call the task 'Loading Hospital Data' and another -/// 'Loading Primary Care Data'. -/// -/// Data Extraction always gets logged under a task called 'Data Extraction' but the server you select here will be the one that it is logged against when the dataset is extracted. -/// -/// You can configure defaults for the logging servers of new datasets through ManageExternalServers dialog (See ManageExternalServers) -/// -public partial class ChooseLoggingTaskUI : RDMPUserControl, ICheckNotifier -{ - private Catalogue _catalogue; - private string expectedDatabaseTypeString = "HIC.Logging.Database"; - - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public Catalogue Catalogue - { - get => _catalogue; - set - { - _catalogue = value; - RefreshUIFromDatabase(); - } - } - - private void RefreshUIFromDatabase() - { - if (_catalogue == null) - return; - - var servers = Activator.RepositoryLocator.CatalogueRepository.GetAllObjects() - .Where(s => string.Equals(expectedDatabaseTypeString, s.CreatedByAssembly)).ToArray(); - - ddLoggingServer.Items.Clear(); - ddLoggingServer.Items.AddRange(servers); - - ExternalDatabaseServer liveserver = null; - - if (_catalogue.LiveLoggingServer_ID != null) - { - liveserver = ddLoggingServer.Items.Cast() - .SingleOrDefault(i => i.ID == (int)_catalogue.LiveLoggingServer_ID); - ddLoggingServer.SelectedItem = liveserver ?? throw new Exception( - $"Catalogue '{_catalogue}' lists its Live Logging Server as '{_catalogue.LiveLoggingServer}' did not appear in combo box, possibly it is not marked as a '{expectedDatabaseTypeString}' server? Try editing it in Locations=>Manage External Servers"); - } - - try - { - //load data tasks (new architecture) - //if the catalogue knows its logging server - populate values - if (liveserver != null) - { - var lm = new LogManager(liveserver); - - foreach (var t in lm.ListDataTasks()) - if (!cbxDataLoadTasks.Items.Contains(t)) - cbxDataLoadTasks.Items.Add(t); - } - } - catch (Exception ex) - { - MessageBox.Show($"Problem getting the list of DataTasks from the new logging architecture:{ex.Message}"); - } - - //if (!string.IsNullOrWhiteSpace(_catalogue.LoggingDataTask)) - // cbxDataLoadTasks.Text = _catalogue.LoggingDataTask; - - CheckNameExists(); - } - - public ChooseLoggingTaskUI() - { - InitializeComponent(); - } - - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - - if (Activator == null) - return; - - RefreshUIFromDatabase(); - } - - private void btnRefresh_Click(object sender, EventArgs e) - { - RefreshTasks(); - } - - private void RefreshTasks() - { - var liveserver = ddLoggingServer.SelectedItem as ExternalDatabaseServer; - var server = DataAccessPortal.ExpectServer(liveserver, DataAccessContext.Logging); - - if (liveserver != null) - { - cbxDataLoadTasks.Items.Clear(); - - try - { - var lm = new LogManager(server); - cbxDataLoadTasks.Items.AddRange(lm.ListDataTasks()); - } - catch (Exception e) - { - ExceptionViewer.Show(e); - } - } - } - - - private void cbxDataLoadTasks_SelectedIndexChanged(object sender, EventArgs e) - { - //_catalogue.LoggingDataTask = (string)cbxDataLoadTasks.SelectedItem; - //_catalogue.SaveToDatabase(); - } - - private void label1_Click(object sender, EventArgs e) - { - } - - private void ddLoggingServer_SelectedIndexChanged(object sender, EventArgs e) - { - if (ddLoggingServer.SelectedItem == null) - { - _catalogue.LiveLoggingServer_ID = null; - _catalogue.SaveToDatabase(); - return; - } - - _catalogue.LiveLoggingServer_ID = ((ExternalDatabaseServer)ddLoggingServer.SelectedItem).ID; - _catalogue.SaveToDatabase(); - RefreshTasks(); - } - - private void cbxDataLoadTasks_TextChanged(object sender, EventArgs e) - { - if (_catalogue == null) - return; - - //_catalogue.LoggingDataTask = cbxDataLoadTasks.Text; - _catalogue.SaveToDatabase(); - } - - private void btnCreateNewLoggingTask_Click(object sender, EventArgs e) - { - try - { - var liveServer = ddLoggingServer.SelectedItem as ExternalDatabaseServer; - - var target = ""; - - var toCreate = cbxDataLoadTasks.Text; - - if (liveServer != null) - target = $"{liveServer.Server}.{liveServer.Database}"; - - if (string.IsNullOrEmpty(target)) - { - MessageBox.Show("You must select a logging server"); - return; - } - - if (Activator.YesNo($"Create a new dataset and new data task called \"{toCreate}\" in {target}", - "Create new logging task")) - { - if (liveServer != null) - { - var checker = new LoggingDatabaseChecker(liveServer); - checker.Check(this); - - new LogManager(liveServer) - .CreateNewLoggingTaskIfNotExists(toCreate); - } - - MessageBox.Show("Done"); - - RefreshTasks(); - } - - RefreshUIFromDatabase(); - } - catch (Exception exception) - { - ExceptionViewer.Show(exception); - } - } - - public bool OnCheckPerformed(CheckEventArgs args) - { - if (args.ProposedFix != null) - return MakeChangePopup.ShowYesNoMessageBoxToApplyFix(null, args.Message, args.ProposedFix); - //if it is successful user doesn't need to be spammed with messages - if (args.Result == CheckResult.Success) - return true; - - //its a warning or an error possibly with an exception attached - if (args.Ex != null) - ExceptionViewer.Show(args.Message, args.Ex); - else - MessageBox.Show(args.Message); - - return false; - } - - private void cbxDataLoadTasks_Leave(object sender, EventArgs e) - { - CheckNameExists(); - } - - private void cbxDataLoadTasks_KeyUp(object sender, KeyEventArgs e) - { - CheckNameExists(); - } - - private void CheckNameExists() - { - ragSmiley1.Reset(); - - if (string.IsNullOrWhiteSpace(cbxDataLoadTasks.Text)) - ragSmiley1.Warning(new Exception("You must provide a Data Task name e.g. 'Loading my cool dataset'")); - else if (!cbxDataLoadTasks.Items.Contains(cbxDataLoadTasks.Text)) - ragSmiley1.Fatal(new Exception( - $"Task '{cbxDataLoadTasks.Text}' does not exist yet, select 'Create' to create it")); - } - - private void btnCreateNewLoggingServer_Click(object sender, EventArgs e) - { - CreatePlatformDatabase.CreateNewExternalServer(Activator.RepositoryLocator.CatalogueRepository, - PermissableDefaults.LiveLoggingServer_ID, new LoggingDatabasePatcher()); - RefreshUIFromDatabase(); - } - - private void btnClear_Click(object sender, EventArgs e) - { - if (sender == btnClearLive) - ddLoggingServer.SelectedItem = null; - } -} \ No newline at end of file diff --git a/Rdmp.UI/SimpleDialogs/ChooseLoggingTaskUI.resx b/Rdmp.UI/SimpleDialogs/ChooseLoggingTaskUI.resx deleted file mode 100644 index 1af7de150c..0000000000 --- a/Rdmp.UI/SimpleDialogs/ChooseLoggingTaskUI.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file From cfe76902383bddf19f28e0689ccb73cea9fd4acc Mon Sep 17 00:00:00 2001 From: James Friel Date: Wed, 11 Mar 2026 12:45:05 +0000 Subject: [PATCH 14/15] add check --- Rdmp.Core/Curation/Data/DataLoad/LoadMetadata.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rdmp.Core/Curation/Data/DataLoad/LoadMetadata.cs b/Rdmp.Core/Curation/Data/DataLoad/LoadMetadata.cs index c0fabba211..39910815de 100644 --- a/Rdmp.Core/Curation/Data/DataLoad/LoadMetadata.cs +++ b/Rdmp.Core/Curation/Data/DataLoad/LoadMetadata.cs @@ -386,7 +386,7 @@ private IDataAccessPoint[] GetLoggingServers() return !catalogue.Any() ? throw new NotSupportedException( $"LoadMetaData '{ToString()} (ID={ID}) does not have any Catalogues associated with it so it is not possible to fetch its LoggingDatabaseSettings") - : (IDataAccessPoint[])catalogue.Select(c => c.LiveLoggingServer).ToArray(); + : (IDataAccessPoint[])catalogue.Select(c => c.LiveLoggingServer).Where(lls => lls != null).ToArray(); } /// From b5002a7f70c809becbac0f598be5b2740831f727 Mon Sep 17 00:00:00 2001 From: James Friel Date: Wed, 11 Mar 2026 12:47:22 +0000 Subject: [PATCH 15/15] fix todo --- .../ExecuteCommandAssociateCatalogueWithLoadMetadata.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandAssociateCatalogueWithLoadMetadata.cs b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandAssociateCatalogueWithLoadMetadata.cs index e846ed1a73..49dc441a9c 100644 --- a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandAssociateCatalogueWithLoadMetadata.cs +++ b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandAssociateCatalogueWithLoadMetadata.cs @@ -85,8 +85,7 @@ public override void Execute() if (!cata.LoggingDataTasks.Any() //or if the user wants to switch to the new one || YesNo( - //$"Do you want to set Catalogue '{cata.Name}' to use shared logging task '{task}' instead of its current Logging Task '{cata.LoggingDataTask}' (All Catalogues in a load must share the same task and logging servers)?", - $"Do you want to set Catalogue '{cata.Name}' to use shared logging task '{task}' instead of its current Logging Task 'TODO' (All Catalogues in a load must share the same task and logging servers)?", + $"Do you want to set Catalogue '{cata.Name}' to use shared logging task '{task}' instead of its current Logging Task '{cata.LoggingDataTasks.FirstOrDefault()}' (All Catalogues in a load must share the same task and logging servers)?", "Synchronise Logging Tasks")) { //switch Catalogue to use that logging task (including servers)