diff --git a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandRestoreRegexRedactedValueInCatalogue.cs b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandRestoreRegexRedactedValueInCatalogue.cs index 4caffc644f..2e8a8feb69 100644 --- a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandRestoreRegexRedactedValueInCatalogue.cs +++ b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandRestoreRegexRedactedValueInCatalogue.cs @@ -69,7 +69,7 @@ public override void Execute() var updateHelper = server.GetQuerySyntaxHelper().UpdateHelper; var sqlLines = new List { - new CustomLine($"t1.{columnInfo.GetRuntimeName()} = '{newValue}'", QueryComponent.SET) + new($"t1.{columnInfo.GetRuntimeName()} = '{newValue}'", QueryComponent.SET) }; foreach (var rk in _redaction.RedactionKeys) { diff --git a/Rdmp.Core/Curation/DataHelper/RegexRedaction/RegexRedactionHelper.cs b/Rdmp.Core/Curation/DataHelper/RegexRedaction/RegexRedactionHelper.cs index 104797ad5a..c8491c55ad 100644 --- a/Rdmp.Core/Curation/DataHelper/RegexRedaction/RegexRedactionHelper.cs +++ b/Rdmp.Core/Curation/DataHelper/RegexRedaction/RegexRedactionHelper.cs @@ -113,8 +113,6 @@ public static void Redact(ColumnInfo column, DataRow match, List public static void SaveRedactions(ICatalogueRepository catalogueRepo, DiscoveredTable pksToSave, DiscoveredTable redactionsToSaveTable, DiscoveredServer _server, int timeout = 30000) { - //the update isn't working? and do we need the +1? - var sql = $@" DECLARE @output TABLE (id1 int, inc int IDENTITY(1,1)) INSERT INTO RegexRedaction(RedactionConfiguration_ID,ColumnInfo_ID,startingIndex,ReplacementValue,RedactedValue) OUTPUT inserted.id as id1 INTO @output diff --git a/Rdmp.Core/DataLoad/Modules/Mutilators/RegexRedactionMutilator.cs b/Rdmp.Core/DataLoad/Modules/Mutilators/RegexRedactionMutilator.cs index 630174e6fe..e128a73ba3 100644 --- a/Rdmp.Core/DataLoad/Modules/Mutilators/RegexRedactionMutilator.cs +++ b/Rdmp.Core/DataLoad/Modules/Mutilators/RegexRedactionMutilator.cs @@ -73,7 +73,7 @@ protected override void MutilateTable(IDataLoadJob job, ITableInfo tableInfo, Di { if (ColumnMatches(column)) { - var pkSeparator = pkColumnInfos.Count() > 0 ? "," : ""; + var pkSeparator = pkColumnInfos.Any() ? "," : ""; var sql = @$" SELECT {column.GetRuntimeName()} {pkSeparator} {string.Join(", ", pkColumnInfos.Select(c => c.GetRuntimeName()))} FROM {table.GetRuntimeName()} diff --git a/Rdmp.UI/Collections/ConfigurationsCollectionUI.cs b/Rdmp.UI/Collections/ConfigurationsCollectionUI.cs index 41a7a32adf..60bf6b0a6f 100644 --- a/Rdmp.UI/Collections/ConfigurationsCollectionUI.cs +++ b/Rdmp.UI/Collections/ConfigurationsCollectionUI.cs @@ -6,6 +6,7 @@ using System.Linq; using Rdmp.Core.Curation.Data; using Rdmp.Core.Providers.Nodes; +using Rdmp.Core.Curation.DataHelper.RegexRedaction; namespace Rdmp.UI.Collections; @@ -53,6 +54,9 @@ public void RefreshBus_RefreshObject(object sender, RefreshObjectEventArgs e) case Dataset: tlvConfigurations.RefreshObject(tlvConfigurations.Objects.OfType()); break; + case RegexRedactionConfiguration: + tlvConfigurations.RefreshObject(tlvConfigurations.Objects.OfType()); + break; } } diff --git a/Rdmp.UI/CommandExecution/AtomicCommands/ExecuteCommandAddNewRegexRedactionConfigurationUI.cs b/Rdmp.UI/CommandExecution/AtomicCommands/ExecuteCommandAddNewRegexRedactionConfigurationUI.cs index 4ed68a9510..494c41ee9a 100644 --- a/Rdmp.UI/CommandExecution/AtomicCommands/ExecuteCommandAddNewRegexRedactionConfigurationUI.cs +++ b/Rdmp.UI/CommandExecution/AtomicCommands/ExecuteCommandAddNewRegexRedactionConfigurationUI.cs @@ -1,14 +1,12 @@ -using Rdmp.Core.CommandExecution; -using Rdmp.Core.CommandExecution.AtomicCommands; +// Copyright (c) The University of Dundee 2024-2024 +// 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 Rdmp.Core.CommandExecution; using Rdmp.UI.ItemActivation; -using Rdmp.UI.SimpleDialogs.Datasets; using Rdmp.UI.SimpleDialogs.RegexRedactionConfigurationForm; -using Rdmp.UI.TestsAndSetup.ServicePropogation; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Rdmp.UI.CommandExecution.AtomicCommands { diff --git a/Rdmp.UI/CommandExecution/AtomicCommands/ExecuteCommandRegexRedaction.cs b/Rdmp.UI/CommandExecution/AtomicCommands/ExecuteCommandRegexRedaction.cs index d780cd57a8..0d27a28e2d 100644 --- a/Rdmp.UI/CommandExecution/AtomicCommands/ExecuteCommandRegexRedaction.cs +++ b/Rdmp.UI/CommandExecution/AtomicCommands/ExecuteCommandRegexRedaction.cs @@ -1,4 +1,10 @@ -using Rdmp.Core.CommandExecution.AtomicCommands; +// Copyright (c) The University of Dundee 2024-2024 +// 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 Rdmp.Core.CommandExecution.AtomicCommands; using Rdmp.Core.Curation.Data; using Rdmp.Core.Icons.IconProvision; using Rdmp.Core.ReusableLibraryCode.Icons.IconProvision; diff --git a/Rdmp.UI/CommandExecution/Proposals/ProposeExecutionWhenTargetIsRegexRedactionConfiguration.cs b/Rdmp.UI/CommandExecution/Proposals/ProposeExecutionWhenTargetIsRegexRedactionConfiguration.cs index fbab8356be..e38b591d92 100644 --- a/Rdmp.UI/CommandExecution/Proposals/ProposeExecutionWhenTargetIsRegexRedactionConfiguration.cs +++ b/Rdmp.UI/CommandExecution/Proposals/ProposeExecutionWhenTargetIsRegexRedactionConfiguration.cs @@ -1,4 +1,10 @@ -using Rdmp.Core.CommandExecution; +// Copyright (c) The University of Dundee 2024-2024 +// 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 Rdmp.Core.CommandExecution; using Rdmp.Core.Curation.DataHelper.RegexRedaction; using Rdmp.Core.ReusableLibraryCode.Annotations; using Rdmp.UI.ItemActivation; diff --git a/Rdmp.UI/SimpleDialogs/RegexRedactionConfigurationForm/CreateNewRegexRedactionConfigurationUI.cs b/Rdmp.UI/SimpleDialogs/RegexRedactionConfigurationForm/CreateNewRegexRedactionConfigurationUI.cs index 064e88ad77..0f2118d49f 100644 --- a/Rdmp.UI/SimpleDialogs/RegexRedactionConfigurationForm/CreateNewRegexRedactionConfigurationUI.cs +++ b/Rdmp.UI/SimpleDialogs/RegexRedactionConfigurationForm/CreateNewRegexRedactionConfigurationUI.cs @@ -1,18 +1,10 @@ -using Rdmp.Core.CommandExecution.AtomicCommands; -using Rdmp.Core.Curation.DataHelper.RegexRedaction; -using Rdmp.UI.CommandExecution.AtomicCommands; +using Rdmp.Core.Curation.DataHelper.RegexRedaction; using Rdmp.UI.ItemActivation; using Rdmp.UI.TestsAndSetup.ServicePropogation; using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; using System.Drawing; -using System.Linq; -using System.Text; using System.Text.RegularExpressions; -using System.Threading.Tasks; -using System.Windows.Forms; + namespace Rdmp.UI.SimpleDialogs.RegexRedactionConfigurationForm {