diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 864260862d..99e5f6f12e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,10 @@ name: Build # Run this workflow every time a new commit pushed to your repository -on: push +on: + push: + schedule: + - cron: '0 1 * * *' env: DOTNET_NOLOGO: 1 @@ -72,7 +75,6 @@ jobs: files: ./db-ui.lcov ./db-core.lcov flag-name: unit tests - tests_file_system: name: Run File System Tests runs-on: windows-latest @@ -145,7 +147,7 @@ jobs: shell: bash run: perl -ne "print \"rdmpversion=\$1\n\" if /AssemblyInformationalVersion\(\"([0-9a-z.-]+)\"\)/;" SharedAssemblyInfo.cs >> $GITHUB_OUTPUT - name: Setup .NET Core - uses: actions/setup-dotnet@v4.0.0 + uses: actions/setup-dotnet@v4.0.1 with: dotnet-version: 7.0.x - name: BundleSource diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b3cb3dbfa6..0e9efd4cfb 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -17,7 +17,7 @@ jobs: with: submodules: true - name: Setup .NET Core - uses: actions/setup-dotnet@v4.0.0 + uses: actions/setup-dotnet@v4.0.1 with: dotnet-version: 6.0.x - name: Cache Nuget diff --git a/Application/ResearchDataManagementPlatform/Menus/RDMPTopMenuStripUI.Designer.cs b/Application/ResearchDataManagementPlatform/Menus/RDMPTopMenuStripUI.Designer.cs index 1b872ce7ee..adf3033f2d 100644 --- a/Application/ResearchDataManagementPlatform/Menus/RDMPTopMenuStripUI.Designer.cs +++ b/Application/ResearchDataManagementPlatform/Menus/RDMPTopMenuStripUI.Designer.cs @@ -1,4 +1,5 @@ using System; +using System.Windows.Forms; namespace ResearchDataManagementPlatform.Menus { @@ -216,6 +217,9 @@ private void InitializeComponent() launchNewWithDefaultSettings.Size = new System.Drawing.Size(112, 22); launchNewWithDefaultSettings.Text = "Default"; launchNewWithDefaultSettings.ToolTipText = "The RDMP instance recorded in your user settings"; + launchNewWithDefaultSettings.Click += launchDefaultInstance; + + // // switchToInstanceToolStripMenuItem // diff --git a/Application/ResearchDataManagementPlatform/Menus/RDMPTopMenuStripUI.cs b/Application/ResearchDataManagementPlatform/Menus/RDMPTopMenuStripUI.cs index 592dbfa38e..15445d594a 100644 --- a/Application/ResearchDataManagementPlatform/Menus/RDMPTopMenuStripUI.cs +++ b/Application/ResearchDataManagementPlatform/Menus/RDMPTopMenuStripUI.cs @@ -74,6 +74,7 @@ public partial class RDMPTopMenuStripUI : RDMPUserControl private SaveMenuItem _saveToolStripMenuItem; private AtomicCommandUIFactory _atomicCommandUIFactory; + private ConnectionStringsYamlFile _connectionStringsFileInUse; public RDMPTopMenuStripUI() { @@ -87,10 +88,10 @@ private void BuildSwitchInstanceMenuItems() // somehow app was launched without populating the load args if (args == null) return; - var origYamlFile = args.ConnectionStringsFileLoaded; + _connectionStringsFileInUse = args.ConnectionStringsFileLoaded; //default settings were used if no yaml file was specified or the file specified did not exist - var defaultsUsed = origYamlFile == null; + var defaultsUsed = _connectionStringsFileInUse == null; // if defaults were not used then it is valid to switch to them switchToDefaultSettings.Enabled = !defaultsUsed; @@ -100,11 +101,11 @@ private void BuildSwitchInstanceMenuItems() // load the yaml files in the RDMP binary directory var exeDir = UsefulStuff.GetExecutableDirectory(); - AddMenuItemsForSwitchingToInstancesInYamlFilesOf(origYamlFile, exeDir); + AddMenuItemsForSwitchingToInstancesInYamlFilesOf(_connectionStringsFileInUse, exeDir); // also add yaml files from wherever they got their original yaml file - if (origYamlFile?.FileLoaded != null && !exeDir.FullName.Equals(origYamlFile.FileLoaded.Directory?.FullName)) - AddMenuItemsForSwitchingToInstancesInYamlFilesOf(origYamlFile, origYamlFile.FileLoaded.Directory); + if (_connectionStringsFileInUse?.FileLoaded != null && !exeDir.FullName.Equals(_connectionStringsFileInUse.FileLoaded.Directory?.FullName)) + AddMenuItemsForSwitchingToInstancesInYamlFilesOf(_connectionStringsFileInUse, _connectionStringsFileInUse.FileLoaded.Directory); } private void AddMenuItemsForSwitchingToInstancesInYamlFilesOf(ConnectionStringsYamlFile origYamlFile, @@ -162,6 +163,16 @@ private void configureExternalServersToolStripMenuItem_Click(object sender, Even new ExecuteCommandConfigureDefaultServers(Activator).Execute(); } + private void launchDefaultInstance(object sender, EventArgs e) + { + if (_connectionStringsFileInUse != null) + { + var exeName = Path.Combine(UsefulStuff.GetExecutableDirectory().FullName, + Process.GetCurrentProcess().ProcessName); + Process.Start(exeName); + } + } + private void setTicketingSystemToolStripMenuItem_Click(object sender, EventArgs e) { var ui = new TicketingSystemConfigurationUI(); @@ -291,7 +302,7 @@ public void SetWindowManager(WindowManager windowManager) // Location menu instancesToolStripMenuItem.DropDownItems.Add(_atomicCommandUIFactory.CreateMenuItem( new ExecuteCommandChoosePlatformDatabase(Activator.RepositoryLocator) - { OverrideCommandName = "Change Default Instance" })); + { OverrideCommandName = "Change Default Instance" })); Activator.Theme.ApplyTo(menuStrip1); @@ -463,7 +474,7 @@ private void navigateForwardToolStripMenuItem_Click(object sender, EventArgs e) _windowManager.Navigation.Forward(true); } - + private void checkForUpdatesToolStripMenuItem_Click(object sender, EventArgs e) { diff --git a/Application/ResearchDataManagementPlatform/Program.cs b/Application/ResearchDataManagementPlatform/Program.cs index 1dc16342ca..f1aa4928fd 100644 --- a/Application/ResearchDataManagementPlatform/Program.cs +++ b/Application/ResearchDataManagementPlatform/Program.cs @@ -7,7 +7,6 @@ using System; using System.Runtime.InteropServices; using CommandLine; -using Rdmp.Core.Logging.PastEvents; using Rdmp.Core.ReusableLibraryCode; using Rdmp.Core.ReusableLibraryCode.Checks; using Rdmp.Core.ReusableLibraryCode.Settings; diff --git a/CHANGELOG.md b/CHANGELOG.md index c3110e2f57..744d4d03f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,19 @@ + # Changelog 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). +## [8.2.1] - 2024-07-18 + +- Add Release status options to the ticketing system +- Improve Interface for Lookup table generation +- Add directory validity checking to data loads +- Open plugin files read-only to avoid permissions errors on Linux +- Improve PK mapping for ExtractionIdentifiers when extracting data +- Fix issue with default instance button not launching instance + ## [8.2.0] - 2024-07-09 ## Changed diff --git a/Directory.Packages.props b/Directory.Packages.props index b997485201..bfed1f32e3 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ - + all @@ -19,15 +19,15 @@ - - + + - + diff --git a/Rdmp.Core.Tests/Caching/Integration/CachingHostTests.cs b/Rdmp.Core.Tests/Caching/Integration/CachingHostTests.cs index 91c80b48be..616f85fd42 100644 --- a/Rdmp.Core.Tests/Caching/Integration/CachingHostTests.cs +++ b/Rdmp.Core.Tests/Caching/Integration/CachingHostTests.cs @@ -35,15 +35,10 @@ public void CacheHostOutwithPermissionWindow() if (testDir.Exists) Directory.Delete(testDir.FullName, true); - var loadDirectory = LoadDirectory.CreateDirectoryStructure(testDir, "Test"); - - var cp = WhenIHaveA(); var loadMetadata = cp.LoadProgress.LoadMetadata; - loadMetadata.LocationOfForLoadingDirectory = Path.Combine(loadDirectory.RootPath.FullName , ((LoadMetadata)loadMetadata).DefaultForLoadingPath); - loadMetadata.LocationOfForArchivingDirectory = Path.Combine(loadDirectory.RootPath.FullName , ((LoadMetadata)loadMetadata).DefaultForArchivingPath); - loadMetadata.LocationOfExecutablesDirectory = Path.Combine(loadDirectory.RootPath.FullName , ((LoadMetadata)loadMetadata).DefaultExecutablesPath); - loadMetadata.LocationOfCacheDirectory = Path.Combine(loadDirectory.RootPath.FullName , ((LoadMetadata)loadMetadata).DefaultCachePath); + + LoadDirectory.CreateDirectoryStructure(testDir, "Test", false, (LoadMetadata)loadMetadata); // This feels a bit nasty, but quick and much better than having the test wait for an arbitrary time period. var listener = new ExpectedNotificationListener("Download not permitted at this time, sleeping for 60 seconds"); diff --git a/Rdmp.Core.Tests/Caching/Integration/CustomDateCachingTests.cs b/Rdmp.Core.Tests/Caching/Integration/CustomDateCachingTests.cs index 468cf44f07..8e4730b9b9 100644 --- a/Rdmp.Core.Tests/Caching/Integration/CustomDateCachingTests.cs +++ b/Rdmp.Core.Tests/Caching/Integration/CustomDateCachingTests.cs @@ -55,16 +55,11 @@ public void FetchMultipleDays_Success(bool singleDay) pipeline.Destination.Returns(destinationComponent); pipeline.Repository.Returns(CatalogueRepository); pipeline.PipelineComponents.Returns(Enumerable.Empty().OrderBy(o => o).ToList()); + var lmd = Substitute.For(); var projDir = LoadDirectory.CreateDirectoryStructure(new DirectoryInfo(TestContext.CurrentContext.TestDirectory), "delme", - true); - - var lmd = Substitute.For(); - lmd.LocationOfForLoadingDirectory = Path.Combine(projDir.RootPath.FullName , Path.Combine("Data", "ForLoading")); - lmd.LocationOfForArchivingDirectory = Path.Combine(projDir.RootPath.FullName , Path.Combine("Data", "ForArchiving")); - lmd.LocationOfExecutablesDirectory = Path.Combine(projDir.RootPath.FullName ,"Executables"); - lmd.LocationOfCacheDirectory = Path.Combine(projDir.RootPath.FullName , Path.Combine("Data", "Cache")); + true, lmd); var loadProgress = Substitute.For(); loadProgress.OriginDate.Returns(new DateTime(2001, 01, 01)); diff --git a/Rdmp.Core.Tests/CommandExecution/ExecuteCommandCreateDatasetTests.cs b/Rdmp.Core.Tests/CommandExecution/ExecuteCommandCreateDatasetTests.cs index c39374f20b..3a7169231c 100644 --- a/Rdmp.Core.Tests/CommandExecution/ExecuteCommandCreateDatasetTests.cs +++ b/Rdmp.Core.Tests/CommandExecution/ExecuteCommandCreateDatasetTests.cs @@ -1,7 +1,6 @@  using NUnit.Framework; using Rdmp.Core.CommandExecution.AtomicCommands; -using System; using System.Linq; using Rdmp.Core.CommandExecution; diff --git a/Rdmp.Core.Tests/CommandExecution/ExecuteCommandLinkCatalogueToDatasetTests.cs b/Rdmp.Core.Tests/CommandExecution/ExecuteCommandLinkCatalogueToDatasetTests.cs index 35b1b3ab36..89b7dcb6b1 100644 --- a/Rdmp.Core.Tests/CommandExecution/ExecuteCommandLinkCatalogueToDatasetTests.cs +++ b/Rdmp.Core.Tests/CommandExecution/ExecuteCommandLinkCatalogueToDatasetTests.cs @@ -1,5 +1,4 @@ -using System; -using System.Linq; +using System.Linq; using NUnit.Framework; using Rdmp.Core.CommandExecution; using Rdmp.Core.CommandExecution.AtomicCommands; diff --git a/Rdmp.Core.Tests/CommandLine/AutomationLoopTests/EndToEndCacheTest.cs b/Rdmp.Core.Tests/CommandLine/AutomationLoopTests/EndToEndCacheTest.cs index 076f36a837..1acc1df77a 100644 --- a/Rdmp.Core.Tests/CommandLine/AutomationLoopTests/EndToEndCacheTest.cs +++ b/Rdmp.Core.Tests/CommandLine/AutomationLoopTests/EndToEndCacheTest.cs @@ -48,11 +48,7 @@ protected override void SetUp() _lmd = new LoadMetadata(CatalogueRepository, "Ive got a lovely bunch o' coconuts"); _LoadDirectory = LoadDirectory.CreateDirectoryStructure(new DirectoryInfo(TestContext.CurrentContext.TestDirectory), - @"EndToEndCacheTest", true); - _lmd.LocationOfForLoadingDirectory = Path.Combine(_LoadDirectory.RootPath.FullName , _lmd.DefaultForLoadingPath); - _lmd.LocationOfForArchivingDirectory = Path.Combine(_LoadDirectory.RootPath.FullName , _lmd.DefaultForArchivingPath); - _lmd.LocationOfExecutablesDirectory = Path.Combine(_LoadDirectory.RootPath.FullName , _lmd.DefaultExecutablesPath); - _lmd.LocationOfCacheDirectory = Path.Combine(_LoadDirectory.RootPath.FullName , _lmd.DefaultCachePath); + @"EndToEndCacheTest", true,_lmd); _lmd.SaveToDatabase(); Clear(_LoadDirectory); diff --git a/Rdmp.Core.Tests/CommandLine/AutomationLoopTests/EndToEndDLETest.cs b/Rdmp.Core.Tests/CommandLine/AutomationLoopTests/EndToEndDLETest.cs index 2772b7f2af..b697fdb035 100644 --- a/Rdmp.Core.Tests/CommandLine/AutomationLoopTests/EndToEndDLETest.cs +++ b/Rdmp.Core.Tests/CommandLine/AutomationLoopTests/EndToEndDLETest.cs @@ -13,7 +13,6 @@ using Tests.Common; using Tests.Common.Scenarios; using TypeGuesser; -using System.IO; namespace Rdmp.Core.Tests.CommandLine.AutomationLoopTests; @@ -46,10 +45,7 @@ public void TestDle_DodgyColumnNames(DatabaseType dbType) var cata = Import(tbl); var lmd = new LoadMetadata(CatalogueRepository, nameof(TestDle_DodgyColumnNames)); - lmd.LocationOfForLoadingDirectory = Path.Combine(LoadDirectory.RootPath.FullName , lmd.DefaultForLoadingPath); - lmd.LocationOfForArchivingDirectory = Path.Combine(LoadDirectory.RootPath.FullName , lmd.DefaultForArchivingPath); - lmd.LocationOfExecutablesDirectory = Path.Combine(LoadDirectory.RootPath.FullName , lmd.DefaultExecutablesPath); - lmd.LocationOfCacheDirectory = Path.Combine(LoadDirectory.RootPath.FullName , lmd.DefaultCachePath); + LoadDirectory.PopulateLoadMetadata(lmd); lmd.SaveToDatabase(); CreateFlatFileAttacher(lmd, "Troll.csv", cata.GetTableInfoList(false).Single()); diff --git a/Rdmp.Core.Tests/Curation/Integration/LoadMetadataTests.cs b/Rdmp.Core.Tests/Curation/Integration/LoadMetadataTests.cs index 167488c598..ffd5557fb0 100644 --- a/Rdmp.Core.Tests/Curation/Integration/LoadMetadataTests.cs +++ b/Rdmp.Core.Tests/Curation/Integration/LoadMetadataTests.cs @@ -7,7 +7,6 @@ using System; using System.IO; using NUnit.Framework; -using Rdmp.Core.Curation; using Rdmp.Core.Curation.Data.DataLoad; using Rdmp.Core.DataLoad.Engine.Checks.Checkers; using Rdmp.Core.DataLoad.Engine.DatabaseManagement.EntityNaming; diff --git a/Rdmp.Core.Tests/Curation/Integration/LoadProgressUnitTests.cs b/Rdmp.Core.Tests/Curation/Integration/LoadProgressUnitTests.cs index 7f1e9bdbbf..ca14b85ba3 100644 --- a/Rdmp.Core.Tests/Curation/Integration/LoadProgressUnitTests.cs +++ b/Rdmp.Core.Tests/Curation/Integration/LoadProgressUnitTests.cs @@ -65,15 +65,10 @@ public void LoadProgress_JobFactory_NoDates() var stratFactory = new JobDateGenerationStrategyFactory(new AnyAvailableLoadProgressSelectionStrategy(lp.LoadMetadata)); var strat = stratFactory.Create(lp, ThrowImmediatelyDataLoadEventListener.Quiet); + var lmd = lp.LoadMetadata; var dir = LoadDirectory.CreateDirectoryStructure(new DirectoryInfo(TestContext.CurrentContext.WorkDirectory), - "LoadProgress_JobFactory_NoDates", true); - - var lmd = lp.LoadMetadata; - lmd.LocationOfForLoadingDirectory = Path.Combine(dir.RootPath.FullName , ((LoadMetadata)lmd).DefaultForLoadingPath); - lmd.LocationOfForArchivingDirectory = Path.Combine(dir.RootPath.FullName , ((LoadMetadata)lmd).DefaultForArchivingPath); - lmd.LocationOfExecutablesDirectory = Path.Combine(dir.RootPath.FullName , ((LoadMetadata)lmd).DefaultExecutablesPath); - lmd.LocationOfCacheDirectory = Path.Combine(dir.RootPath.FullName , ((LoadMetadata)lmd).DefaultCachePath); + "LoadProgress_JobFactory_NoDates", true, (LoadMetadata)lmd); foreach (var cata in lmd.GetAllCatalogues()) { diff --git a/Rdmp.Core.Tests/DataExport/DataExtraction/ExecuteFullExtractionToDatabaseMSSqlDestinationReExtractionTest.cs b/Rdmp.Core.Tests/DataExport/DataExtraction/ExecuteFullExtractionToDatabaseMSSqlDestinationReExtractionTest.cs index 29bc80951b..5edb4639ae 100644 --- a/Rdmp.Core.Tests/DataExport/DataExtraction/ExecuteFullExtractionToDatabaseMSSqlDestinationReExtractionTest.cs +++ b/Rdmp.Core.Tests/DataExport/DataExtraction/ExecuteFullExtractionToDatabaseMSSqlDestinationReExtractionTest.cs @@ -86,6 +86,7 @@ public void ReExtractToADatabaseWithNoNewData() var chiColumnInfo = catalogue.CatalogueItems.Where(ci => ci.Name == "chi").First(); var ei = chiColumnInfo.ExtractionInformation; ei.IsExtractionIdentifier = true; + ei.IsPrimaryKey = true; ei.SaveToDatabase(); var project = new Project(DataExportRepository, "MyProject") { @@ -312,6 +313,7 @@ public void ReExtractToADatabaseWithNewDataAndNoPKs() var chiColumnInfo = catalogue.CatalogueItems.Where(ci => ci.Name == "chi").First(); var ei = chiColumnInfo.ExtractionInformation; ei.IsExtractionIdentifier = true; + ei.IsPrimaryKey = true; ei.SaveToDatabase(); var project = new Project(DataExportRepository, "MyProject") { @@ -568,6 +570,7 @@ public void ReExtractToADatabaseWithNewDataAndSinglePK() var chiColumnInfo = catalogue.CatalogueItems.Where(ci => ci.Name == "chi").First(); var ei = chiColumnInfo.ExtractionInformation; ei.IsExtractionIdentifier = true; + ei.IsPrimaryKey = true; ei.SaveToDatabase(); var surnameInfo = catalogue.CatalogueItems.Where(ci => ci.Name == "surname").First(); diff --git a/Rdmp.Core.Tests/DataLoad/Engine/Integration/CheckingTests/ProcessTaskCheckingTests.cs b/Rdmp.Core.Tests/DataLoad/Engine/Integration/CheckingTests/ProcessTaskCheckingTests.cs index 35bbe414d0..7a88a4db20 100644 --- a/Rdmp.Core.Tests/DataLoad/Engine/Integration/CheckingTests/ProcessTaskCheckingTests.cs +++ b/Rdmp.Core.Tests/DataLoad/Engine/Integration/CheckingTests/ProcessTaskCheckingTests.cs @@ -35,11 +35,7 @@ public void CreateTask() _dir = new DirectoryInfo(Path.Combine(TestContext.CurrentContext.TestDirectory, "ProcessTaskCheckingTests")); _dir.Create(); - var hicdir = LoadDirectory.CreateDirectoryStructure(_dir, "ProjDir", true); - _lmd.LocationOfForLoadingDirectory = Path.Combine(hicdir.RootPath.FullName, _lmd.DefaultForLoadingPath); - _lmd.LocationOfForArchivingDirectory = Path.Combine(hicdir.RootPath.FullName, _lmd.DefaultForArchivingPath); - _lmd.LocationOfExecutablesDirectory = Path.Combine(hicdir.RootPath.FullName, _lmd.DefaultExecutablesPath); - _lmd.LocationOfCacheDirectory = Path.Combine(hicdir.RootPath.FullName, _lmd.DefaultCachePath); + LoadDirectory.CreateDirectoryStructure(_dir, "ProjDir", true, _lmd); _lmd.SaveToDatabase(); var c = new Catalogue(CatalogueRepository, "c"); @@ -128,13 +124,9 @@ public void MEFCompatibleType_NoArgs() { var projDir = LoadDirectory.CreateDirectoryStructure(new DirectoryInfo(TestContext.CurrentContext.TestDirectory), - "DelMeProjDir", true); + "DelMeProjDir", true, _lmd); try { - _lmd.LocationOfForLoadingDirectory = Path.Combine(projDir.RootPath.FullName, _lmd.DefaultForLoadingPath); - _lmd.LocationOfForArchivingDirectory = Path.Combine(projDir.RootPath.FullName, _lmd.DefaultForArchivingPath); - _lmd.LocationOfExecutablesDirectory = Path.Combine(projDir.RootPath.FullName, _lmd.DefaultExecutablesPath); - _lmd.LocationOfCacheDirectory = Path.Combine(projDir.RootPath.FullName, _lmd.DefaultCachePath); _task.ProcessTaskType = ProcessTaskType.Attacher; _task.LoadStage = LoadStage.Mounting; _task.Path = typeof(AnySeparatorFileAttacher).FullName; @@ -158,13 +150,9 @@ public void MEFCompatibleType_Passes() { var projDir = LoadDirectory.CreateDirectoryStructure(new DirectoryInfo(TestContext.CurrentContext.TestDirectory), - "DelMeProjDir", true); + "DelMeProjDir", true, _lmd); try { - _lmd.LocationOfForLoadingDirectory = Path.Combine(projDir.RootPath.FullName, _lmd.DefaultForLoadingPath); - _lmd.LocationOfForArchivingDirectory = Path.Combine(projDir.RootPath.FullName, _lmd.DefaultForArchivingPath); - _lmd.LocationOfExecutablesDirectory = Path.Combine(projDir.RootPath.FullName, _lmd.DefaultExecutablesPath); - _lmd.LocationOfCacheDirectory = Path.Combine(projDir.RootPath.FullName, _lmd.DefaultCachePath); _task.ProcessTaskType = ProcessTaskType.Attacher; _task.LoadStage = LoadStage.Mounting; _task.Path = typeof(AnySeparatorFileAttacher).FullName; diff --git a/Rdmp.Core.Tests/DataLoad/Engine/Integration/CrossDatabaseTypeTests/CrossDatabaseDataLoadTests.cs b/Rdmp.Core.Tests/DataLoad/Engine/Integration/CrossDatabaseTypeTests/CrossDatabaseDataLoadTests.cs index 2dab13fe1c..8189a5e5fc 100644 --- a/Rdmp.Core.Tests/DataLoad/Engine/Integration/CrossDatabaseTypeTests/CrossDatabaseDataLoadTests.cs +++ b/Rdmp.Core.Tests/DataLoad/Engine/Integration/CrossDatabaseTypeTests/CrossDatabaseDataLoadTests.cs @@ -155,7 +155,6 @@ public void Load(DatabaseType databaseType, TestCase testCase) //define a new load configuration var lmd = new LoadMetadata(CatalogueRepository, "MyLoad"); - if (testCase == TestCase.NoTrigger) { lmd.IgnoreTrigger = true; diff --git a/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadEngineTestsBase.cs b/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadEngineTestsBase.cs index 454fae0e12..bdada6dbc1 100644 --- a/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadEngineTestsBase.cs +++ b/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataLoadEngineTestsBase.cs @@ -71,11 +71,8 @@ protected static LoadDirectory SetupLoadDirectory(LoadMetadata lmd) { var projectDirectory = LoadDirectory.CreateDirectoryStructure(new DirectoryInfo(TestContext.CurrentContext.TestDirectory), - "MyLoadDir", true); - lmd.LocationOfForLoadingDirectory = Path.Combine(projectDirectory.RootPath.FullName, lmd.DefaultForLoadingPath); - lmd.LocationOfForArchivingDirectory = Path.Combine(projectDirectory.RootPath.FullName, lmd.DefaultForArchivingPath); - lmd.LocationOfExecutablesDirectory = Path.Combine(projectDirectory.RootPath.FullName, lmd.DefaultExecutablesPath); - lmd.LocationOfCacheDirectory = Path.Combine(projectDirectory.RootPath.FullName, lmd.DefaultCachePath); + "MyLoadDir", true,lmd); + lmd.SaveToDatabase(); return projectDirectory; diff --git a/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataTableUploadDestinationTests.cs b/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataTableUploadDestinationTests.cs index 27f38c6a30..dbf274644d 100644 --- a/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataTableUploadDestinationTests.cs +++ b/Rdmp.Core.Tests/DataLoad/Engine/Integration/DataTableUploadDestinationTests.cs @@ -13,7 +13,6 @@ using FAnsi.Discovery; using FAnsi.Discovery.TableCreation; using NUnit.Framework; -using NUnit.Framework.Internal; using Rdmp.Core.DataFlowPipeline; using Rdmp.Core.DataLoad.Engine.Pipeline.Destinations; using Rdmp.Core.DataLoad.Triggers; diff --git a/Rdmp.Core.Tests/DataLoad/Engine/Integration/ExcelAttacherTests.cs b/Rdmp.Core.Tests/DataLoad/Engine/Integration/ExcelAttacherTests.cs index b58e4500f2..84fc86b813 100644 --- a/Rdmp.Core.Tests/DataLoad/Engine/Integration/ExcelAttacherTests.cs +++ b/Rdmp.Core.Tests/DataLoad/Engine/Integration/ExcelAttacherTests.cs @@ -6,7 +6,6 @@ using FAnsi; using FAnsi.Discovery; -using NPOI.SS.Formula.Functions; using NPOI.SS.UserModel; using NPOI.XSSF.UserModel; using NUnit.Framework; @@ -17,12 +16,8 @@ using Rdmp.Core.DataLoad.Modules.Attachers; using Rdmp.Core.ReusableLibraryCode.Progress; using System; -using System.Collections.Generic; -using System.Drawing; using System.IO; using System.Linq; -using System.Text; -using System.Threading.Tasks; using Tests.Common; namespace Rdmp.Core.Tests.DataLoad.Engine.Integration; diff --git a/Rdmp.Core.Tests/DataLoad/Engine/Integration/JobDateGenerationStrategyFactoryTestsIntegration.cs b/Rdmp.Core.Tests/DataLoad/Engine/Integration/JobDateGenerationStrategyFactoryTestsIntegration.cs index 8ce1f15643..75d0ddbe15 100644 --- a/Rdmp.Core.Tests/DataLoad/Engine/Integration/JobDateGenerationStrategyFactoryTestsIntegration.cs +++ b/Rdmp.Core.Tests/DataLoad/Engine/Integration/JobDateGenerationStrategyFactoryTestsIntegration.cs @@ -126,11 +126,7 @@ public void CacheProvider_NoPipeline() var projDir = LoadDirectory.CreateDirectoryStructure(new DirectoryInfo(TestContext.CurrentContext.TestDirectory), "delme", - true); - _lmd.LocationOfForLoadingDirectory = Path.Combine(projDir.RootPath.FullName, _lmd.DefaultForLoadingPath); - _lmd.LocationOfForArchivingDirectory = Path.Combine(projDir.RootPath.FullName, _lmd.DefaultForArchivingPath); - _lmd.LocationOfExecutablesDirectory = Path.Combine(projDir.RootPath.FullName, _lmd.DefaultExecutablesPath); - _lmd.LocationOfCacheDirectory = Path.Combine(projDir.RootPath.FullName, _lmd.DefaultCachePath); + true, _lmd); _lmd.SaveToDatabase(); try { @@ -156,11 +152,7 @@ public void CacheProvider_NoCacheProgress() var projDir = LoadDirectory.CreateDirectoryStructure(new DirectoryInfo(TestContext.CurrentContext.TestDirectory), "delme", - true); - _lmd.LocationOfForLoadingDirectory = Path.Combine(projDir.RootPath.FullName, _lmd.DefaultForLoadingPath); - _lmd.LocationOfForArchivingDirectory = Path.Combine(projDir.RootPath.FullName, _lmd.DefaultForArchivingPath); - _lmd.LocationOfExecutablesDirectory = Path.Combine(projDir.RootPath.FullName, _lmd.DefaultExecutablesPath); - _lmd.LocationOfCacheDirectory = Path.Combine(projDir.RootPath.FullName, _lmd.DefaultCachePath); + true, _lmd); _lmd.SaveToDatabase(); var pipeAssembler = new TestDataPipelineAssembler("CacheProvider_Normal", CatalogueRepository); @@ -197,11 +189,7 @@ public void CacheProvider_Normal() var projDir = LoadDirectory.CreateDirectoryStructure(new DirectoryInfo(TestContext.CurrentContext.TestDirectory), "delme", - true); - _lmd.LocationOfForLoadingDirectory = Path.Combine(projDir.RootPath.FullName, _lmd.DefaultForLoadingPath); - _lmd.LocationOfForArchivingDirectory = Path.Combine(projDir.RootPath.FullName, _lmd.DefaultForArchivingPath); - _lmd.LocationOfExecutablesDirectory = Path.Combine(projDir.RootPath.FullName, _lmd.DefaultExecutablesPath); - _lmd.LocationOfCacheDirectory = Path.Combine(projDir.RootPath.FullName, _lmd.DefaultCachePath); + true, _lmd); _lmd.SaveToDatabase(); var pipeAssembler = new TestDataPipelineAssembler("CacheProvider_Normal", CatalogueRepository); diff --git a/Rdmp.Core.Tests/DataLoad/Engine/Integration/PayloadTest.cs b/Rdmp.Core.Tests/DataLoad/Engine/Integration/PayloadTest.cs index 3792edb53b..f442288206 100644 --- a/Rdmp.Core.Tests/DataLoad/Engine/Integration/PayloadTest.cs +++ b/Rdmp.Core.Tests/DataLoad/Engine/Integration/PayloadTest.cs @@ -39,12 +39,8 @@ public void TestPayloadInjection() var lmd = new LoadMetadata(CatalogueRepository, "Loading"); var filePath = LoadDirectory - .CreateDirectoryStructure(new DirectoryInfo(TestContext.CurrentContext.TestDirectory), "delme", true) + .CreateDirectoryStructure(new DirectoryInfo(TestContext.CurrentContext.TestDirectory), "delme", true,lmd) .RootPath.FullName; - lmd.LocationOfForLoadingDirectory = Path.Combine(filePath , lmd.DefaultForLoadingPath); - lmd.LocationOfForArchivingDirectory = Path.Combine(filePath , lmd.DefaultForArchivingPath); - lmd.LocationOfExecutablesDirectory = Path.Combine(filePath , lmd.DefaultExecutablesPath); - lmd.LocationOfCacheDirectory = Path.Combine(filePath , lmd.DefaultCachePath); lmd.SaveToDatabase(); MEF.AddTypeToCatalogForTesting(typeof(TestPayloadAttacher)); diff --git a/Rdmp.Core.Tests/DataLoad/Engine/Integration/RemoteAttacherTests.cs b/Rdmp.Core.Tests/DataLoad/Engine/Integration/RemoteAttacherTests.cs index 751438be1f..726312b35e 100644 --- a/Rdmp.Core.Tests/DataLoad/Engine/Integration/RemoteAttacherTests.cs +++ b/Rdmp.Core.Tests/DataLoad/Engine/Integration/RemoteAttacherTests.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 FAnsi.Implementations.MicrosoftSQL; using NUnit.Framework; using Rdmp.Core.Curation.Data.DataLoad; using Rdmp.Core.DataLoad.Modules.Attachers; diff --git a/Rdmp.Core.Tests/DataLoad/Engine/Integration/RemoteDatabaseAttacherTests.cs b/Rdmp.Core.Tests/DataLoad/Engine/Integration/RemoteDatabaseAttacherTests.cs index 3b48e2085f..59c1c0dadd 100644 --- a/Rdmp.Core.Tests/DataLoad/Engine/Integration/RemoteDatabaseAttacherTests.cs +++ b/Rdmp.Core.Tests/DataLoad/Engine/Integration/RemoteDatabaseAttacherTests.cs @@ -8,8 +8,6 @@ using System.Collections.Generic; using System.Data; using FAnsi; -using MongoDB.Driver.Linq; -using NPOI.SS.Formula.Functions; using NSubstitute; using NUnit.Framework; using Rdmp.Core.Curation.Data; @@ -213,13 +211,13 @@ public void TestRemoteDatabaseAttacherWithDateFilter(DatabaseType dbType, Scenar if (duration == AttacherHistoricalDurations.Custom) { - attacher.CustomFetchDurationStartDate = DateTime.Now.AddDays(-7); - attacher.CustomFetchDurationEndDate = DateTime.Now; + attacher.CustomFetchDurationStartDate = DateTime.UtcNow.AddDays(-7); + attacher.CustomFetchDurationEndDate = DateTime.UtcNow; } if (duration == AttacherHistoricalDurations.DeltaReading) { - attacher.DeltaReadingStartDate = DateTime.Now.AddDays(-7); + attacher.DeltaReadingStartDate = DateTime.UtcNow.AddDays(-7); attacher.DeltaReadingLookBackDays = 0; attacher.DeltaReadingLookForwardDays = 5; } @@ -236,7 +234,7 @@ public void TestRemoteDatabaseAttacherWithDateFilter(DatabaseType dbType, Scenar if (duration == AttacherHistoricalDurations.SinceLastUse) { - job.LoadMetadata.LastLoadTime = DateTime.Now.AddDays(-1);// last used yesterday + job.LoadMetadata.LastLoadTime = DateTime.UtcNow.AddDays(-1);// last used yesterday job.LoadMetadata.SaveToDatabase(); } if (scenario == Scenario.MissingPreLoadDiscardedColumn) diff --git a/Rdmp.Core.Tests/DataLoad/Modules/Attachers/RemoteTableAttacherTests.cs b/Rdmp.Core.Tests/DataLoad/Modules/Attachers/RemoteTableAttacherTests.cs index 464982691f..78094c6ee8 100644 --- a/Rdmp.Core.Tests/DataLoad/Modules/Attachers/RemoteTableAttacherTests.cs +++ b/Rdmp.Core.Tests/DataLoad/Modules/Attachers/RemoteTableAttacherTests.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; using System.Data; -using System.Globalization; using FAnsi; using FAnsi.Discovery; using NSubstitute; @@ -25,7 +24,6 @@ using Rdmp.Core.ReusableLibraryCode.Progress; using Tests.Common; using TypeGuesser; -using static Rdmp.Core.Tests.DataLoad.Engine.Integration.RemoteDatabaseAttacherTests; namespace Rdmp.Core.Tests.DataLoad.Modules.Attachers; @@ -269,19 +267,19 @@ private static string Within(AttacherHistoricalDurations duration) switch (duration) { case AttacherHistoricalDurations.Past24Hours: - return DateTime.Now.AddHours(-1).ToString(); + return DateTime.UtcNow.AddHours(-1).ToString(); case AttacherHistoricalDurations.Past7Days: - return DateTime.Now.AddHours(-1).ToString(); + return DateTime.UtcNow.AddHours(-1).ToString(); case AttacherHistoricalDurations.PastMonth: - return DateTime.Now.AddHours(-1).ToString(); + return DateTime.UtcNow.AddHours(-1).ToString(); case AttacherHistoricalDurations.PastYear: - return DateTime.Now.AddHours(-1).ToString(); + return DateTime.UtcNow.AddHours(-1).ToString(); case AttacherHistoricalDurations.SinceLastUse: - return DateTime.Now.AddHours(-1).ToString(); + return DateTime.UtcNow.AddHours(-1).ToString(); case AttacherHistoricalDurations.Custom: - return DateTime.Now.AddDays(-1).ToString(); + return DateTime.UtcNow.AddDays(-1).ToString(); case AttacherHistoricalDurations.DeltaReading: - return DateTime.Now.AddDays(-4).ToString(); + return DateTime.UtcNow.AddDays(-4).ToString(); default: return "fail"; } @@ -292,19 +290,19 @@ private static string Outwith(AttacherHistoricalDurations duration) switch (duration) { case AttacherHistoricalDurations.Past24Hours: - return DateTime.Now.AddDays(-2).ToString(); + return DateTime.UtcNow.AddDays(-2).ToString(); case AttacherHistoricalDurations.Past7Days: - return DateTime.Now.AddDays(-8).ToString(); + return DateTime.UtcNow.AddDays(-8).ToString(); case AttacherHistoricalDurations.PastMonth: - return DateTime.Now.AddMonths(-2).ToString(); + return DateTime.UtcNow.AddMonths(-2).ToString(); case AttacherHistoricalDurations.PastYear: - return DateTime.Now.AddYears(-2).ToString(); + return DateTime.UtcNow.AddYears(-2).ToString(); case AttacherHistoricalDurations.SinceLastUse: - return DateTime.Now.AddDays(-2).ToString(); + return DateTime.UtcNow.AddDays(-2).ToString(); case AttacherHistoricalDurations.Custom: - return DateTime.Now.AddDays(-14).ToString(); + return DateTime.UtcNow.AddDays(-14).ToString(); case AttacherHistoricalDurations.DeltaReading: - return DateTime.Now.AddDays(-10).ToString(); + return DateTime.UtcNow.AddDays(-10).ToString(); default: return "fail"; } @@ -351,17 +349,17 @@ private void RunAttachStageWithFilterJob(RemoteTableAttacher attacher, Discovere job.StartLogging(); if (duration == AttacherHistoricalDurations.SinceLastUse) { - job.LoadMetadata.LastLoadTime = DateTime.Now.AddDays(-1);// last used yesterday + job.LoadMetadata.LastLoadTime = DateTime.UtcNow.AddDays(-1);// last used yesterday job.LoadMetadata.SaveToDatabase(); } if (duration == AttacherHistoricalDurations.Custom) { - attacher.CustomFetchDurationStartDate = DateTime.Now.AddDays(-7); - attacher.CustomFetchDurationEndDate = DateTime.Now; + attacher.CustomFetchDurationStartDate = DateTime.UtcNow.AddDays(-7); + attacher.CustomFetchDurationEndDate = DateTime.UtcNow; } if (duration == AttacherHistoricalDurations.DeltaReading) { - attacher.DeltaReadingStartDate = DateTime.Now.AddDays(-7); + attacher.DeltaReadingStartDate = DateTime.UtcNow.AddDays(-7); attacher.DeltaReadingLookBackDays = 0; attacher.DeltaReadingLookForwardDays = 5; } diff --git a/Rdmp.Core.Tests/Setting/SettingValidationTest.cs b/Rdmp.Core.Tests/Setting/SettingValidationTest.cs index db39bfa322..5d6a912853 100644 --- a/Rdmp.Core.Tests/Setting/SettingValidationTest.cs +++ b/Rdmp.Core.Tests/Setting/SettingValidationTest.cs @@ -6,7 +6,6 @@ using Microsoft.Data.SqlClient; using NUnit.Framework; -using System; using System.Linq; using Tests.Common; diff --git a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCreateNewDataLoadDirectory.cs b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCreateNewDataLoadDirectory.cs index 9642a2356b..deb5bf4d92 100644 --- a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCreateNewDataLoadDirectory.cs +++ b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCreateNewDataLoadDirectory.cs @@ -61,16 +61,12 @@ public override void Execute() var loadDir = string.IsNullOrWhiteSpace(newFolderName) - ? LoadDirectory.CreateDirectoryStructure(d.Parent, d.Name, true) - : LoadDirectory.CreateDirectoryStructure(d, newFolderName, true); + ? LoadDirectory.CreateDirectoryStructure(d.Parent, d.Name, true, LoadMetadata) + : LoadDirectory.CreateDirectoryStructure(d, newFolderName, true, LoadMetadata); // if we have a load then update the path to this location we just created if (LoadMetadata != null) { - LoadMetadata.LocationOfForLoadingDirectory = Path.Combine(loadDir.RootPath.FullName ,LoadMetadata.DefaultForLoadingPath); - LoadMetadata.LocationOfForArchivingDirectory = Path.Combine(loadDir.RootPath.FullName, LoadMetadata.DefaultForArchivingPath); - LoadMetadata.LocationOfExecutablesDirectory = Path.Combine(loadDir.RootPath.FullName , LoadMetadata.DefaultExecutablesPath); - LoadMetadata.LocationOfCacheDirectory = Path.Combine(loadDir.RootPath.FullName , LoadMetadata.DefaultCachePath); LoadMetadata.SaveToDatabase(); Publish(LoadMetadata); } diff --git a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCreateNewSplitDataLoadDirectory.cs b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCreateNewSplitDataLoadDirectory.cs index b2f838c735..914fa3381e 100644 --- a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCreateNewSplitDataLoadDirectory.cs +++ b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCreateNewSplitDataLoadDirectory.cs @@ -114,11 +114,7 @@ public override void Execute() // if we have a load then update the path to this location we just created if (LoadMetadata != null) { - LoadMetadata.LocationOfForLoadingDirectory = loadDir.ForLoading.FullName; - LoadMetadata.LocationOfForArchivingDirectory = loadDir.ForArchiving.FullName; - LoadMetadata.LocationOfExecutablesDirectory = loadDir.ExecutablesPath.FullName; - LoadMetadata.LocationOfCacheDirectory = loadDir.Cache.FullName; - LoadMetadata.SaveToDatabase(); + loadDir.PopulateLoadMetadata(LoadMetadata); Publish(LoadMetadata); } } diff --git a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCreateVersionOfCohortConfiguration.cs b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCreateVersionOfCohortConfiguration.cs index 0fe48fb990..8f8ccee351 100644 --- a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCreateVersionOfCohortConfiguration.cs +++ b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCreateVersionOfCohortConfiguration.cs @@ -1,13 +1,11 @@ -using Rdmp.Core.CohortCommitting.Pipeline.Sources; -using Rdmp.Core.Curation.Data; -using Rdmp.Core.Curation.Data.Cohort; -// Copyright (c) The University of Dundee 2024-2024 +// 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 Spectre.Console; + using System.Linq; +using Rdmp.Core.Curation.Data.Cohort; namespace Rdmp.Core.CommandExecution.AtomicCommands; diff --git a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandExportDatabaseToDir.cs b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandExportDatabaseToDir.cs index eefdba5401..e063a6afc0 100644 --- a/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandExportDatabaseToDir.cs +++ b/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandExportDatabaseToDir.cs @@ -7,8 +7,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Linq.Expressions; using Rdmp.Core.Curation.Data; using Rdmp.Core.Repositories; diff --git a/Rdmp.Core/CommandLine/Runners/DleRunner.cs b/Rdmp.Core/CommandLine/Runners/DleRunner.cs index 3860bb6e7c..d602f9b916 100644 --- a/Rdmp.Core/CommandLine/Runners/DleRunner.cs +++ b/Rdmp.Core/CommandLine/Runners/DleRunner.cs @@ -5,11 +5,9 @@ // 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 System.Collections.Immutable; using System.Linq; using System.Reflection; -using NPOI.Util.Collections; using Rdmp.Core.CommandLine.Options; using Rdmp.Core.Curation.Data; using Rdmp.Core.Curation.Data.DataLoad; diff --git a/Rdmp.Core/Curation/ANOEngineering/ColumnInfoANOPlan.cs b/Rdmp.Core/Curation/ANOEngineering/ColumnInfoANOPlan.cs index 3108c81356..708957f568 100644 --- a/Rdmp.Core/Curation/ANOEngineering/ColumnInfoANOPlan.cs +++ b/Rdmp.Core/Curation/ANOEngineering/ColumnInfoANOPlan.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Linq; using FAnsi.Discovery.QuerySyntax; -using FAnsi.Discovery.TypeTranslation; using Rdmp.Core.Curation.Data; using Rdmp.Core.Curation.Data.DataLoad; using Rdmp.Core.Curation.Data.Serialization; diff --git a/Rdmp.Core/Curation/Data/DataLoad/LoadMetadataCatalogueLinkage.cs b/Rdmp.Core/Curation/Data/DataLoad/LoadMetadataCatalogueLinkage.cs index 3889b52d23..b550ac78e9 100644 --- a/Rdmp.Core/Curation/Data/DataLoad/LoadMetadataCatalogueLinkage.cs +++ b/Rdmp.Core/Curation/Data/DataLoad/LoadMetadataCatalogueLinkage.cs @@ -7,8 +7,6 @@ using Rdmp.Core.Curation.Data.ImportExport; using Rdmp.Core.Curation.Data.Serialization; using Rdmp.Core.Repositories; -using Rdmp.Core.ReusableLibraryCode; -using System; using System.Collections.Generic; using System.Data.Common; using System.Diagnostics.CodeAnalysis; diff --git a/Rdmp.Core/Curation/Data/EncryptedString.cs b/Rdmp.Core/Curation/Data/EncryptedString.cs index 126c6ca373..ca4d294712 100644 --- a/Rdmp.Core/Curation/Data/EncryptedString.cs +++ b/Rdmp.Core/Curation/Data/EncryptedString.cs @@ -40,7 +40,7 @@ public string Value } catch (Exception e) { - if (e.Message.Contains("Bad Length") || e.Message.Contains("data too large for key size")) + if (e.Message.Contains("Bad Length") || e.Message.Contains("data too large for key size")) throw new InvalidOperationException( $"The free text Value supplied to this class was too long to be encrypted (Length of string was {value.Length})", e); diff --git a/Rdmp.Core/Curation/Data/ICatalogue.cs b/Rdmp.Core/Curation/Data/ICatalogue.cs index b260c2da39..380980645a 100644 --- a/Rdmp.Core/Curation/Data/ICatalogue.cs +++ b/Rdmp.Core/Curation/Data/ICatalogue.cs @@ -11,7 +11,6 @@ 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; diff --git a/Rdmp.Core/Curation/Data/LoadModuleAssembly.cs b/Rdmp.Core/Curation/Data/LoadModuleAssembly.cs index 3c328ef9bb..837a20354a 100644 --- a/Rdmp.Core/Curation/Data/LoadModuleAssembly.cs +++ b/Rdmp.Core/Curation/Data/LoadModuleAssembly.cs @@ -52,7 +52,7 @@ private static Dictionary HandlePluginVersioning() var pluginFiles = Directory.EnumerateFiles(AppDomain.CurrentDomain.BaseDirectory, "*.rdmp"); foreach (var pluginFile in pluginFiles) { - using FileStream fs = new(pluginFile, FileMode.Open); + using FileStream fs = new(pluginFile, FileMode.Open,FileAccess.Read); using ZipFile zip = new(fs); foreach (ZipEntry ze in zip) { diff --git a/Rdmp.Core/Curation/Data/TicketingSystemConfiguration.cs b/Rdmp.Core/Curation/Data/TicketingSystemConfiguration.cs index 00fd3667fa..812de065a1 100644 --- a/Rdmp.Core/Curation/Data/TicketingSystemConfiguration.cs +++ b/Rdmp.Core/Curation/Data/TicketingSystemConfiguration.cs @@ -1,4 +1,4 @@ -// Copyright (c) The University of Dundee 2018-2019 +// Copyright (c) The University of Dundee 2018-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. @@ -118,6 +118,14 @@ public TicketingSystemConfiguration(ICatalogueRepository repository, string name }); } + /// + /// Fetches a list of acceptable release statuses set for the ticketing system + /// + public List GetReleaseStatuses() + { + return [.. Repository.GetAllObjectsWhere("TicketingSystemConfigurationID", this.ID)]; + } + /// internal TicketingSystemConfiguration(ICatalogueRepository repository, DbDataReader r) : base(repository, r) { @@ -127,4 +135,5 @@ internal TicketingSystemConfiguration(ICatalogueRepository repository, DbDataRea Name = r["Name"] as string; DataAccessCredentials_ID = ObjectToNullableInt(r["DataAccessCredentials_ID"]); } + } \ No newline at end of file diff --git a/Rdmp.Core/Curation/LoadDirectory.cs b/Rdmp.Core/Curation/LoadDirectory.cs index 8b678e2b71..345ca31a14 100644 --- a/Rdmp.Core/Curation/LoadDirectory.cs +++ b/Rdmp.Core/Curation/LoadDirectory.cs @@ -1,9 +1,10 @@ -// Copyright (c) The University of Dundee 2018-2019 +// Copyright (c) The University of Dundee 2018-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.Curation.Data.DataLoad; using System; using System.IO; using System.Linq; @@ -52,7 +53,7 @@ public class LoadDirectory : ILoadDirectory /// /// /// - public LoadDirectory(string rootPath, bool validate=true) + public LoadDirectory(string rootPath, bool validate = true) { if (string.IsNullOrWhiteSpace(rootPath)) throw new Exception("Root path was blank, there is no LoadDirectory path specified?"); @@ -81,7 +82,7 @@ public LoadDirectory(string ForLoadingPath, string ForArchivingPath, string Exec throw new Exception($"One if the LoadDirectory Paths was blank. ForLoading: {ForLoading}. ForArchiving: {ForArchivingPath}. Cache: {CachePath}. Extractables:{ExecutablesPath}"); ForLoading = new DirectoryInfo(ForLoadingPath); ForArchiving = new DirectoryInfo(ForArchivingPath); - ExecutablesPath =new DirectoryInfo(ExecutablesPathString); + ExecutablesPath = new DirectoryInfo(ExecutablesPathString); Cache = new DirectoryInfo(CachePath); } @@ -102,9 +103,10 @@ private DirectoryInfo FindFolderInPathOrThrow(DirectoryInfo path, string folderN /// Parent folder to create the tree in e.g. c:\temp /// Root folder name for the DLE e.g. LoadingBiochem /// Determines behaviour if the folder already exists and contains files. True to carry on, False to throw an Exception + /// Optional loadMetadata object to populate with the created locations /// public static LoadDirectory CreateDirectoryStructure(DirectoryInfo parentDir, string dirName, - bool overrideExistsCheck = false) + bool overrideExistsCheck = false, ILoadMetadata loadMetadataToPopulate = null) { if (!parentDir.Exists) parentDir.Create(); @@ -128,7 +130,27 @@ public static LoadDirectory CreateDirectoryStructure(DirectoryInfo parentDir, st swExampleFixedWidth.Close(); projectDir.CreateSubdirectory("Executables"); + if (loadMetadataToPopulate != null) + { + loadMetadataToPopulate.LocationOfForLoadingDirectory = Path.Combine(projectDir.FullName, "Data", "ForLoading"); + loadMetadataToPopulate.LocationOfForArchivingDirectory = Path.Combine(projectDir.FullName, "Data", "ForArchiving"); + loadMetadataToPopulate.LocationOfExecutablesDirectory = Path.Combine(projectDir.FullName, "Executables"); + loadMetadataToPopulate.LocationOfCacheDirectory = Path.Combine(projectDir.FullName, "Data", "Cache"); + } return new LoadDirectory(projectDir.FullName); } + + public void PopulateLoadMetadata(ILoadMetadata loadMetadata) + { + loadMetadata.LocationOfForLoadingDirectory = ForLoading.FullName; + loadMetadata.LocationOfForArchivingDirectory = ForArchiving.FullName; + loadMetadata.LocationOfExecutablesDirectory = ExecutablesPath.FullName; + loadMetadata.LocationOfCacheDirectory = Cache.FullName; + } + + public bool AllSubdirectoriesExist() + { + return Directory.Exists(ForLoading.FullName) && Directory.Exists(ForArchiving.FullName) && Directory.Exists(Cache.FullName) && Directory.Exists(ExecutablesPath.FullName); + } } \ No newline at end of file diff --git a/Rdmp.Core/Curation/TicketingSystemReleaseStatus.cs b/Rdmp.Core/Curation/TicketingSystemReleaseStatus.cs new file mode 100644 index 0000000000..05abd73b63 --- /dev/null +++ b/Rdmp.Core/Curation/TicketingSystemReleaseStatus.cs @@ -0,0 +1,46 @@ +// 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.Curation.Data; +using Rdmp.Core.Repositories; +using Rdmp.Core.ReusableLibraryCode.Annotations; +using System.Collections.Generic; +using System.Data.Common; +namespace Rdmp.Core.Curation +{ + /// + /// Stored a status name and which ticketing system it coresponds to + /// + public class TicketingSystemReleaseStatus : DatabaseEntity + { + + private string _status; + private int _ticketingSystemConfiguratonID; + + [NotNull] + public string Status { get => _status; set => SetField(ref _status, value); } + + [NotNull] + public int TicketingSystemConfigurationID { get => _ticketingSystemConfiguratonID; set => SetField(ref _ticketingSystemConfiguratonID, value); } + + public TicketingSystemReleaseStatus() { } + + public TicketingSystemReleaseStatus(ICatalogueRepository repository, string status, int? statusID, TicketingSystemConfiguration config) : base() + { + repository.InsertAndHydrate(this, new Dictionary + { + {"Status", status}, + {"TicketingSystemConfigurationID", config.ID } + }); + } + + public TicketingSystemReleaseStatus(ICatalogueRepository repository, DbDataReader r) : base(repository, r) + { + Status = r["Status"] as string; + TicketingSystemConfigurationID = int.Parse(r["TicketingSystemConfigurationID"].ToString()); + } + } +} diff --git a/Rdmp.Core/DataExport/DataExtraction/Pipeline/Destinations/ExecuteFullExtractionToDatabaseMSSql.cs b/Rdmp.Core/DataExport/DataExtraction/Pipeline/Destinations/ExecuteFullExtractionToDatabaseMSSql.cs index cd70ce7dec..87714dd133 100644 --- a/Rdmp.Core/DataExport/DataExtraction/Pipeline/Destinations/ExecuteFullExtractionToDatabaseMSSql.cs +++ b/Rdmp.Core/DataExport/DataExtraction/Pipeline/Destinations/ExecuteFullExtractionToDatabaseMSSql.cs @@ -19,7 +19,6 @@ using Rdmp.Core.DataExport.DataRelease.Potential; using Rdmp.Core.DataFlowPipeline; using Rdmp.Core.DataLoad.Engine.Pipeline.Destinations; -using Rdmp.Core.Logging; using Rdmp.Core.MapsDirectlyToDatabaseTable; using Rdmp.Core.QueryBuilding; using Rdmp.Core.Repositories; diff --git a/Rdmp.Core/DataExport/DataExtraction/Pipeline/Sources/ExecuteDatasetExtractionSource.cs b/Rdmp.Core/DataExport/DataExtraction/Pipeline/Sources/ExecuteDatasetExtractionSource.cs index f21f4da12a..7c2ffe9057 100644 --- a/Rdmp.Core/DataExport/DataExtraction/Pipeline/Sources/ExecuteDatasetExtractionSource.cs +++ b/Rdmp.Core/DataExport/DataExtraction/Pipeline/Sources/ExecuteDatasetExtractionSource.cs @@ -323,7 +323,11 @@ public virtual DataTable GetChunk(IDataLoadEventListener listener, GracefulCance if (includesReleaseIdentifier) foreach (var idx in _extractionIdentifiersidx.Distinct().ToList()) { - pks.Add(chunk.Columns[idx]); + var sub = Request.ReleaseIdentifierSubstitutions.Where(s => s.Alias == chunk.Columns[idx].ColumnName).FirstOrDefault(); + if (sub != null && sub.ColumnInfo.ExtractionInformations.FirstOrDefault() != null && sub.ColumnInfo.ExtractionInformations.FirstOrDefault().IsPrimaryKey) + { + pks.Add(chunk.Columns[idx]); + } foreach (DataRow r in chunk.Rows) { if (r[idx] == DBNull.Value) diff --git a/Rdmp.Core/DataExport/DataRelease/ReleaseEnvironmentPotential.cs b/Rdmp.Core/DataExport/DataRelease/ReleaseEnvironmentPotential.cs index 3d9e9c7d4e..2a5cce3893 100644 --- a/Rdmp.Core/DataExport/DataRelease/ReleaseEnvironmentPotential.cs +++ b/Rdmp.Core/DataExport/DataRelease/ReleaseEnvironmentPotential.cs @@ -1,4 +1,4 @@ -// Copyright (c) The University of Dundee 2018-2019 +// Copyright (c) The University of Dundee 2018-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. @@ -44,7 +44,6 @@ private void MakeAssessment() var configuration = _repository.CatalogueRepository .GetAllObjectsWhere("IsActive", 1).SingleOrDefault(); if (configuration == null) return; - var factory = new TicketingSystemFactory(_repository.CatalogueRepository); @@ -66,7 +65,7 @@ private void MakeAssessment() try { Assesment = ticketingSystem.GetDataReleaseabilityOfTicket(Project.MasterTicket, - Configuration.RequestTicket, Configuration.ReleaseTicket, out var reason, out var e); + Configuration.RequestTicket, Configuration.ReleaseTicket, configuration.GetReleaseStatuses(), out var reason, out var e); Exception = e; Reason = reason; } diff --git a/Rdmp.Core/DataLoad/Engine/Checks/Checkers/CatalogueLoadChecks.cs b/Rdmp.Core/DataLoad/Engine/Checks/Checkers/CatalogueLoadChecks.cs index 0aa2e9ff5c..666c64eabb 100644 --- a/Rdmp.Core/DataLoad/Engine/Checks/Checkers/CatalogueLoadChecks.cs +++ b/Rdmp.Core/DataLoad/Engine/Checks/Checkers/CatalogueLoadChecks.cs @@ -1,4 +1,4 @@ -// Copyright (c) The University of Dundee 2018-2019 +// Copyright (c) The University of Dundee 2018-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. @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using FAnsi.Discovery; using Rdmp.Core.Curation; @@ -34,6 +35,12 @@ public CatalogueLoadChecks(ILoadMetadata loadMetadata, HICLoadConfigurationFlags _databaseConfiguration = databaseConfiguration; } + + private bool ValidateFilePath(string directoryPath) + { + return Path.Exists(directoryPath); + } + public void Check(ICheckNotifier notifier) { Catalogue[] catalogueMetadatas; @@ -69,6 +76,18 @@ public void Check(ICheckNotifier notifier) $"Catalogue {catalogue.Name} does not have any TableInfos", CheckResult.Fail, null)); tablesFound.AddRange(tableInfos.Where(tableInfo => !tablesFound.Contains(tableInfo))); + if(_loadMetadata.LocationOfForLoadingDirectory != null && !ValidateFilePath(_loadMetadata.LocationOfForLoadingDirectory)) + notifier.OnCheckPerformed(new CheckEventArgs($"The ForLoading directory for this load ({_loadMetadata.LocationOfForLoadingDirectory}) does not exist.", + CheckResult.Fail, null)); + if (_loadMetadata.LocationOfForArchivingDirectory!= null && !ValidateFilePath(_loadMetadata.LocationOfForArchivingDirectory)) + notifier.OnCheckPerformed(new CheckEventArgs($"The ForArchiving directory for this load ({_loadMetadata.LocationOfForArchivingDirectory}) does not exist.", + CheckResult.Fail, null)); + if (_loadMetadata.LocationOfCacheDirectory != null && _loadMetadata.LocationOfForLoadingDirectory != null && !ValidateFilePath(_loadMetadata.LocationOfCacheDirectory)) + notifier.OnCheckPerformed(new CheckEventArgs($"The Cache directory for this load ({_loadMetadata.LocationOfCacheDirectory}) does not exist.", + CheckResult.Fail, null)); + if (_loadMetadata.LocationOfExecutablesDirectory != null && !ValidateFilePath(_loadMetadata.LocationOfExecutablesDirectory)) + notifier.OnCheckPerformed(new CheckEventArgs($"The Executables directory for this load ({_loadMetadata.LocationOfExecutablesDirectory}) does not exist.", + CheckResult.Fail, null)); } diff --git a/Rdmp.Core/DataLoad/Engine/Job/Scheduling/SingleScheduledJobFactory.cs b/Rdmp.Core/DataLoad/Engine/Job/Scheduling/SingleScheduledJobFactory.cs index 6986be1874..b707d24f4f 100644 --- a/Rdmp.Core/DataLoad/Engine/Job/Scheduling/SingleScheduledJobFactory.cs +++ b/Rdmp.Core/DataLoad/Engine/Job/Scheduling/SingleScheduledJobFactory.cs @@ -9,7 +9,6 @@ using Rdmp.Core.Curation.Data.DataLoad; using Rdmp.Core.DataLoad.Engine.DatabaseManagement.EntityNaming; using Rdmp.Core.Logging; -using Rdmp.Core.Providers.Nodes.LoadMetadataNodes; using Rdmp.Core.Repositories; using Rdmp.Core.ReusableLibraryCode.Progress; diff --git a/Rdmp.Core/DataLoad/Engine/LoadExecution/Components/LoadFiles.cs b/Rdmp.Core/DataLoad/Engine/LoadExecution/Components/LoadFiles.cs index 7398dfac4e..1b13e27c2a 100644 --- a/Rdmp.Core/DataLoad/Engine/LoadExecution/Components/LoadFiles.cs +++ b/Rdmp.Core/DataLoad/Engine/LoadExecution/Components/LoadFiles.cs @@ -40,12 +40,22 @@ public override ExitCodeType Run(IDataLoadJob job, GracefulCancellationToken can { if (Components.Any()) toReturn = base.Run(job, cancellationToken); - else if (job.LoadDirectory.ForLoading.EnumerateFileSystemInfos().Any()) - job.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information, - $"Using existing files in '{job.LoadDirectory.ForLoading.FullName}', there are no GetFiles processes or DataProviders configured")); else - job.OnNotify(this, new NotifyEventArgs(ProgressEventType.Warning, - $"There are no GetFiles tasks and there are no files in the ForLoading directory ({job.LoadDirectory.ForLoading.FullName})")); + { + if (!((LoadDirectory)job.LoadDirectory).AllSubdirectoriesExist()) + { + job.OnNotify(this, new NotifyEventArgs(ProgressEventType.Error, + $"One or more of the Load Metadata directories does not exist. Check the following locations exits: {string.Join(", ", [job.LoadDirectory.ForLoading.FullName, job.LoadDirectory.ForArchiving.FullName, job.LoadDirectory.Cache.FullName, job.LoadDirectory.ExecutablesPath.FullName])}")); + return ExitCodeType.Error; + } + else if (job.LoadDirectory.ForLoading.EnumerateFileSystemInfos().Any()) + job.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information, + $"Using existing files in '{job.LoadDirectory.ForLoading.FullName}', there are no GetFiles processes or DataProviders configured")); + else + job.OnNotify(this, new NotifyEventArgs(ProgressEventType.Warning, + $"There are no GetFiles tasks and there are no files in the ForLoading directory ({job.LoadDirectory.ForLoading.FullName})")); + } + } finally { diff --git a/Rdmp.Core/DataLoad/Engine/Pipeline/Destinations/DataTableUploadDestination.cs b/Rdmp.Core/DataLoad/Engine/Pipeline/Destinations/DataTableUploadDestination.cs index daa0fb47f1..a286795be7 100644 --- a/Rdmp.Core/DataLoad/Engine/Pipeline/Destinations/DataTableUploadDestination.cs +++ b/Rdmp.Core/DataLoad/Engine/Pipeline/Destinations/DataTableUploadDestination.cs @@ -29,10 +29,6 @@ using Rdmp.Core.ReusableLibraryCode.Progress; using TypeGuesser; using FAnsi; -using Terminal.Gui; -using TB.ComponentModel; -using Npgsql; -using MathNet.Numerics.LinearAlgebra; namespace Rdmp.Core.DataLoad.Engine.Pipeline.Destinations; diff --git a/Rdmp.Core/DataLoad/Modules/Attachers/MDFAttacher.cs b/Rdmp.Core/DataLoad/Modules/Attachers/MDFAttacher.cs index 494ae9a607..5ef59f0b5e 100644 --- a/Rdmp.Core/DataLoad/Modules/Attachers/MDFAttacher.cs +++ b/Rdmp.Core/DataLoad/Modules/Attachers/MDFAttacher.cs @@ -6,10 +6,8 @@ using System; using System.Data; -using System.Diagnostics; using System.IO; using System.Linq; -using MathNet.Numerics.Distributions; using Microsoft.Data.SqlClient; using Rdmp.Core.Curation.Data; using Rdmp.Core.DataFlowPipeline; diff --git a/Rdmp.Core/DataLoad/Modules/Attachers/MdfFileAttachLocations.cs b/Rdmp.Core/DataLoad/Modules/Attachers/MdfFileAttachLocations.cs index a282cfe83d..aad5d56b57 100644 --- a/Rdmp.Core/DataLoad/Modules/Attachers/MdfFileAttachLocations.cs +++ b/Rdmp.Core/DataLoad/Modules/Attachers/MdfFileAttachLocations.cs @@ -7,7 +7,6 @@ using System; using System.IO; using System.Linq; -using MathNet.Numerics.Statistics; using Rdmp.Core.DataLoad.Modules.Exceptions; namespace Rdmp.Core.DataLoad.Modules.Attachers; diff --git a/Rdmp.Core/DataLoad/Modules/Attachers/RemoteAttacher.cs b/Rdmp.Core/DataLoad/Modules/Attachers/RemoteAttacher.cs index 2cbd6ffccb..2c39517b77 100644 --- a/Rdmp.Core/DataLoad/Modules/Attachers/RemoteAttacher.cs +++ b/Rdmp.Core/DataLoad/Modules/Attachers/RemoteAttacher.cs @@ -10,12 +10,10 @@ using Rdmp.Core.DataFlowPipeline; using Rdmp.Core.DataLoad.Engine.Attachers; using Rdmp.Core.DataLoad.Engine.Job; -using Rdmp.Core.DataLoad.Engine.Pipeline.Sources; using Rdmp.Core.ReusableLibraryCode.Checks; using Rdmp.Core.ReusableLibraryCode.Progress; using System; using System.Data; -using System.Globalization; using System.Linq; namespace Rdmp.Core.DataLoad.Modules.Attachers; diff --git a/Rdmp.Core/DataLoad/Modules/Attachers/RemoteTableAttacher.cs b/Rdmp.Core/DataLoad/Modules/Attachers/RemoteTableAttacher.cs index 96878f4dc8..781cd5bd2d 100644 --- a/Rdmp.Core/DataLoad/Modules/Attachers/RemoteTableAttacher.cs +++ b/Rdmp.Core/DataLoad/Modules/Attachers/RemoteTableAttacher.cs @@ -6,7 +6,6 @@ using System; using System.Data; -using System.Diagnostics; using System.Linq; using System.Text.RegularExpressions; using FAnsi; @@ -27,7 +26,6 @@ using Rdmp.Core.ReusableLibraryCode.DataAccess; using Rdmp.Core.ReusableLibraryCode.Progress; using TypeGuesser; -using static NPOI.HSSF.Util.HSSFColor; namespace Rdmp.Core.DataLoad.Modules.Attachers; diff --git a/Rdmp.Core/DataLoad/Modules/DataProvider/ImportFilesDataProvider.cs b/Rdmp.Core/DataLoad/Modules/DataProvider/ImportFilesDataProvider.cs index 867a3736f7..f772e96b03 100644 --- a/Rdmp.Core/DataLoad/Modules/DataProvider/ImportFilesDataProvider.cs +++ b/Rdmp.Core/DataLoad/Modules/DataProvider/ImportFilesDataProvider.cs @@ -48,7 +48,6 @@ public void Check(ICheckNotifier notifier) notifier.OnCheckPerformed(new CheckEventArgs( "No FilePattern has been specified, this should be a pattern that matches files in the remote folder you want to copy files out of e.g. *.*", CheckResult.Fail)); - notifier.OnCheckPerformed(new DirectoryInfo(DirectoryPath).Exists ? new CheckEventArgs($"Path {DirectoryPath} was found", CheckResult.Success) : new CheckEventArgs($"Path {DirectoryPath} was not found", CheckResult.Fail)); diff --git a/Rdmp.Core/DataViewing/ViewCohortExtractionUICollection.cs b/Rdmp.Core/DataViewing/ViewCohortExtractionUICollection.cs index d385afb035..77857d9a97 100644 --- a/Rdmp.Core/DataViewing/ViewCohortExtractionUICollection.cs +++ b/Rdmp.Core/DataViewing/ViewCohortExtractionUICollection.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; using System.Linq; -using Azure.Core; using FAnsi.Discovery.QuerySyntax; using Rdmp.Core.Curation.Data; using Rdmp.Core.Curation.Data.Dashboarding; diff --git a/Rdmp.Core/Databases/CatalogueDatabase/up/085_AddTicketingReleaseStatuses.sql b/Rdmp.Core/Databases/CatalogueDatabase/up/085_AddTicketingReleaseStatuses.sql new file mode 100644 index 0000000000..f44590b5af --- /dev/null +++ b/Rdmp.Core/Databases/CatalogueDatabase/up/085_AddTicketingReleaseStatuses.sql @@ -0,0 +1,19 @@ +--Version: 8.2.1 +--Description: Add lookup table of release status names for a ticketing configuration + + +if not exists (select 1 from sys.tables where name = 'TicketingSystemReleaseStatus') +BEGIN +CREATE TABLE [dbo].[TicketingSystemReleaseStatus]( + [ID] [int] IDENTITY(1,1) NOT NULL, + [Status] [nvarchar](250) NOT NULL, + [TicketingSystemConfigurationID] [int] NOT NULL, + FOREIGN KEY (TicketingSystemConfigurationID) REFERENCES TicketingSystemConfiguration(ID) ON DELETE CASCADE, + +CONSTRAINT [PK_TicketingSystemReleaseStatus] PRIMARY KEY CLUSTERED +( + [ID] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +) ON [PRIMARY] +END +GO diff --git a/Rdmp.Core/Icons/IconProvision/CatalogueIcons.resx b/Rdmp.Core/Icons/IconProvision/CatalogueIcons.resx index 571c731520..f33525f753 100644 --- a/Rdmp.Core/Icons/IconProvision/CatalogueIcons.resx +++ b/Rdmp.Core/Icons/IconProvision/CatalogueIcons.resx @@ -757,7 +757,10 @@ ..\LoadMetadataCatalogueLinkage.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\famfamfam\cog.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file + + ..\famfamfam\cog.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\TicketingSystemReleaseStatus.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Rdmp.Core/Icons/IconProvision/RDMPConcept.cs b/Rdmp.Core/Icons/IconProvision/RDMPConcept.cs index a814693fa9..31ff8cefcf 100644 --- a/Rdmp.Core/Icons/IconProvision/RDMPConcept.cs +++ b/Rdmp.Core/Icons/IconProvision/RDMPConcept.cs @@ -205,5 +205,6 @@ public enum RDMPConcept TableInfoDatabaseNode, Dataset, LoadMetadataCatalogueLinkage, - Setting + Setting, + TicketingSystemReleaseStatus } \ No newline at end of file diff --git a/Rdmp.Core/Icons/TicketingSystemReleaseStatus.png b/Rdmp.Core/Icons/TicketingSystemReleaseStatus.png new file mode 100644 index 0000000000..d0fb946cb5 Binary files /dev/null and b/Rdmp.Core/Icons/TicketingSystemReleaseStatus.png differ diff --git a/Rdmp.Core/Logging/DataLoadInfo.cs b/Rdmp.Core/Logging/DataLoadInfo.cs index 55d453e578..3f1fd0fda1 100644 --- a/Rdmp.Core/Logging/DataLoadInfo.cs +++ b/Rdmp.Core/Logging/DataLoadInfo.cs @@ -10,7 +10,6 @@ using System.Threading; using FAnsi; using FAnsi.Discovery; -using Rdmp.Core.ReusableLibraryCode.Settings; namespace Rdmp.Core.Logging; diff --git a/Rdmp.Core/Logging/LogManager.cs b/Rdmp.Core/Logging/LogManager.cs index dbba1afde6..7376316c9b 100644 --- a/Rdmp.Core/Logging/LogManager.cs +++ b/Rdmp.Core/Logging/LogManager.cs @@ -13,7 +13,6 @@ using System.Threading; using FAnsi.Discovery; using FAnsi.Discovery.QuerySyntax; -using Rdmp.Core.Curation.Data; using Rdmp.Core.Logging.PastEvents; using Rdmp.Core.ReusableLibraryCode; using Rdmp.Core.ReusableLibraryCode.DataAccess; diff --git a/Rdmp.Core/Logging/TableLoadInfo.cs b/Rdmp.Core/Logging/TableLoadInfo.cs index a80491cebf..777e8e9f1a 100644 --- a/Rdmp.Core/Logging/TableLoadInfo.cs +++ b/Rdmp.Core/Logging/TableLoadInfo.cs @@ -7,11 +7,8 @@ using System; using System.Data; using System.Threading; -using Amazon.Auth.AccessControlPolicy; -using SynthEHR; using FAnsi.Connections; using FAnsi.Discovery; -using Rdmp.Core.ReusableLibraryCode.Settings; namespace Rdmp.Core.Logging; diff --git a/Rdmp.Core/Providers/Nodes/LoadMetadataNodes/CatalogueUsedByLoadMetadataNode.cs b/Rdmp.Core/Providers/Nodes/LoadMetadataNodes/CatalogueUsedByLoadMetadataNode.cs index f4d99d7d1c..8107277305 100644 --- a/Rdmp.Core/Providers/Nodes/LoadMetadataNodes/CatalogueUsedByLoadMetadataNode.cs +++ b/Rdmp.Core/Providers/Nodes/LoadMetadataNodes/CatalogueUsedByLoadMetadataNode.cs @@ -8,7 +8,6 @@ using Rdmp.Core.Curation.Data.DataLoad; using Rdmp.Core.MapsDirectlyToDatabaseTable; using Rdmp.Core.Providers.Nodes.UsedByNodes; -using System.Linq; namespace Rdmp.Core.Providers.Nodes.LoadMetadataNodes; diff --git a/Rdmp.Core/Rdmp.Core.csproj b/Rdmp.Core/Rdmp.Core.csproj index 95a9950395..c7c2c97d2c 100644 --- a/Rdmp.Core/Rdmp.Core.csproj +++ b/Rdmp.Core/Rdmp.Core.csproj @@ -127,6 +127,7 @@ + @@ -251,6 +252,7 @@ + diff --git a/Rdmp.Core/Repositories/VersionYamlTypeConverter.cs b/Rdmp.Core/Repositories/VersionYamlTypeConverter.cs index f8eabea6cb..44a960f4f7 100644 --- a/Rdmp.Core/Repositories/VersionYamlTypeConverter.cs +++ b/Rdmp.Core/Repositories/VersionYamlTypeConverter.cs @@ -15,18 +15,20 @@ namespace Rdmp.Core.Repositories; /// /// Reads/Writes as a simple string value /// -internal class VersionYamlTypeConverter : IYamlTypeConverter +internal sealed class VersionYamlTypeConverter : IYamlTypeConverter { public bool Accepts(Type type) => type == typeof(Version); - public object ReadYaml(IParser parser, Type type) + public object ReadYaml(IParser parser, Type _1, ObjectDeserializer _2) { var s = parser.Consume(); return new Version(s.Value); } - public void WriteYaml(IEmitter emitter, object value, Type type) + public void WriteYaml(IEmitter emitter, object value, Type _1, ObjectSerializer _2) { - emitter.Emit(new Scalar(((Version)value).ToString())); + if (value is not Version v) throw new ArgumentException("Non-Version argument", nameof(value)); + + emitter.Emit(new Scalar(v.ToString())); } } \ No newline at end of file diff --git a/Rdmp.Core/Startup/Startup.cs b/Rdmp.Core/Startup/Startup.cs index 6f3629d561..edfec72d25 100644 --- a/Rdmp.Core/Startup/Startup.cs +++ b/Rdmp.Core/Startup/Startup.cs @@ -6,7 +6,6 @@ using System; using System.Diagnostics; -using System.IO; using System.Linq; using System.Runtime.Loader; using FAnsi.Discovery; diff --git a/Rdmp.Core/Ticketing/ITicketingSystem.cs b/Rdmp.Core/Ticketing/ITicketingSystem.cs index eb772e62ce..3a1d87735a 100644 --- a/Rdmp.Core/Ticketing/ITicketingSystem.cs +++ b/Rdmp.Core/Ticketing/ITicketingSystem.cs @@ -5,6 +5,8 @@ // 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 Rdmp.Core.Curation; using Rdmp.Core.ReusableLibraryCode.Checks; namespace Rdmp.Core.Ticketing; @@ -41,13 +43,16 @@ public interface ITicketingSystem : ICheckable /// /// /// + /// /// /// /// TicketingReleaseabilityEvaluation GetDataReleaseabilityOfTicket(string masterTicket, string requestTicket, - string releaseTicket, out string reason, out Exception exception); + string releaseTicket, List acceptedStatuses,out string reason, out Exception exception); string GetProjectFolderName(string masterTicket); + + List GetAvailableStatuses(); } public enum TicketingReleaseabilityEvaluation diff --git a/Rdmp.Core/Ticketing/PluginTicketingSystem.cs b/Rdmp.Core/Ticketing/PluginTicketingSystem.cs index afa95545ec..ba1f1d0bc4 100644 --- a/Rdmp.Core/Ticketing/PluginTicketingSystem.cs +++ b/Rdmp.Core/Ticketing/PluginTicketingSystem.cs @@ -5,6 +5,8 @@ // 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 Rdmp.Core.Curation; using Rdmp.Core.ReusableLibraryCode.Checks; using Rdmp.Core.ReusableLibraryCode.DataAccess; @@ -26,7 +28,10 @@ protected PluginTicketingSystem(TicketingSystemConstructorParameters parameters) public abstract void NavigateToTicket(string ticketName); public abstract TicketingReleaseabilityEvaluation GetDataReleaseabilityOfTicket(string masterTicket, - string requestTicket, string releaseTicket, out string reason, out Exception exception); + string requestTicket, string releaseTicket, List acceptedStatuses,out string reason, out Exception exception); public abstract string GetProjectFolderName(string masterTicket); + + public abstract List GetAvailableStatuses(); + } \ No newline at end of file diff --git a/Rdmp.Core/Ticketing/SimpleTicketingSystem.cs b/Rdmp.Core/Ticketing/SimpleTicketingSystem.cs index 101c155658..5a9816eca1 100644 --- a/Rdmp.Core/Ticketing/SimpleTicketingSystem.cs +++ b/Rdmp.Core/Ticketing/SimpleTicketingSystem.cs @@ -5,6 +5,8 @@ // 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 Rdmp.Core.Curation; using Rdmp.Core.ReusableLibraryCode; using Rdmp.Core.ReusableLibraryCode.Checks; using Rdmp.Core.ReusableLibraryCode.DataAccess; @@ -45,7 +47,7 @@ public void NavigateToTicket(string ticketName) } public TicketingReleaseabilityEvaluation GetDataReleaseabilityOfTicket(string masterTicket, string requestTicket, - string releaseTicket, out string reason, out Exception exception) + string releaseTicket, List acceptedStatuses, out string reason, out Exception exception) { reason = null; exception = null; @@ -55,4 +57,9 @@ public TicketingReleaseabilityEvaluation GetDataReleaseabilityOfTicket(string ma public string GetProjectFolderName(string masterTicket) => UsefulStuff.RegexThingsThatAreNotNumbersOrLettersOrUnderscores.Replace(masterTicket, ""); + + public List GetAvailableStatuses() + { + return new List(); + } } \ No newline at end of file diff --git a/Rdmp.Core/Ticketing/TicketingSystemConstructorParameters.cs b/Rdmp.Core/Ticketing/TicketingSystemConstructorParameters.cs index 425d41aa31..a55c0608e6 100644 --- a/Rdmp.Core/Ticketing/TicketingSystemConstructorParameters.cs +++ b/Rdmp.Core/Ticketing/TicketingSystemConstructorParameters.cs @@ -1,11 +1,10 @@ -// Copyright (c) The University of Dundee 2018-2019 +// Copyright (c) The University of Dundee 2018-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.ReusableLibraryCode.DataAccess; - namespace Rdmp.Core.Ticketing; /// diff --git a/Rdmp.UI.Tests/DesignPatternTests/ClassFileEvaluation/DocumentationCrossExaminationTest.cs b/Rdmp.UI.Tests/DesignPatternTests/ClassFileEvaluation/DocumentationCrossExaminationTest.cs index 1407948d02..31c158d4bc 100644 --- a/Rdmp.UI.Tests/DesignPatternTests/ClassFileEvaluation/DocumentationCrossExaminationTest.cs +++ b/Rdmp.UI.Tests/DesignPatternTests/ClassFileEvaluation/DocumentationCrossExaminationTest.cs @@ -159,6 +159,7 @@ internal class DocumentationCrossExaminationTest "ProposedFixes", "PropertyX", "FamilyMembers", + "LookupConfiguration", //CreatingANewCollectionTreeNode.md "FolderOfX", @@ -278,7 +279,10 @@ internal class DocumentationCrossExaminationTest "BuildInParallel", //Quickstart.md - "ResearchDataManagmentPlatform" + "ResearchDataManagmentPlatform", + + // CSVHandling + "TypeTranslation" }; #endregion diff --git a/Rdmp.UI/AggregationUIs/Advanced/AggregateGraphDateSelector.cs b/Rdmp.UI/AggregationUIs/Advanced/AggregateGraphDateSelector.cs index 573ba3bc3a..983ef4dd37 100644 --- a/Rdmp.UI/AggregationUIs/Advanced/AggregateGraphDateSelector.cs +++ b/Rdmp.UI/AggregationUIs/Advanced/AggregateGraphDateSelector.cs @@ -1,12 +1,6 @@ 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.AggregationUIs.Advanced diff --git a/Rdmp.UI/AggregationUIs/Advanced/SelectColumnUI.cs b/Rdmp.UI/AggregationUIs/Advanced/SelectColumnUI.cs index 7676e1c4a9..2fef95d0fc 100644 --- a/Rdmp.UI/AggregationUIs/Advanced/SelectColumnUI.cs +++ b/Rdmp.UI/AggregationUIs/Advanced/SelectColumnUI.cs @@ -9,7 +9,6 @@ using System.Collections.ObjectModel; using System.Drawing; using System.Linq; -using System.Runtime.InteropServices.Marshalling; using System.Windows.Forms; using BrightIdeasSoftware; using FAnsi.Discovery; diff --git a/Rdmp.UI/CommandExecution/AtomicCommands/ExecuteCommandChooseHICProjectDirectory.cs b/Rdmp.UI/CommandExecution/AtomicCommands/ExecuteCommandChooseHICProjectDirectory.cs index e4e991b37a..205ed48ddf 100644 --- a/Rdmp.UI/CommandExecution/AtomicCommands/ExecuteCommandChooseHICProjectDirectory.cs +++ b/Rdmp.UI/CommandExecution/AtomicCommands/ExecuteCommandChooseHICProjectDirectory.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.IO; using System.Windows.Forms; using Rdmp.Core.CommandExecution.AtomicCommands; using Rdmp.Core.Curation.Data.DataLoad; @@ -39,20 +38,14 @@ public override void Execute() if (dialog.ResultDirectory.RootPath != null) { //todo check these are correct & make it work with linux - _loadMetadata.LocationOfForLoadingDirectory = Path.Combine(dialog.ResultDirectory.RootPath.FullName, _loadMetadata.DefaultForLoadingPath); - _loadMetadata.LocationOfForArchivingDirectory = Path.Combine(dialog.ResultDirectory.RootPath.FullName, _loadMetadata.DefaultForArchivingPath); - _loadMetadata.LocationOfExecutablesDirectory = Path.Combine(dialog.ResultDirectory.RootPath.FullName, _loadMetadata.DefaultExecutablesPath); - _loadMetadata.LocationOfCacheDirectory = Path.Combine(dialog.ResultDirectory.RootPath.FullName, _loadMetadata.DefaultCachePath); + dialog.ResultDirectory.PopulateLoadMetadata(_loadMetadata); } else if (dialog.ResultDirectory.ForLoading != null && dialog.ResultDirectory.ForArchiving != null && dialog.ResultDirectory.ExecutablesPath != null && dialog.ResultDirectory.Cache != null) { - _loadMetadata.LocationOfForLoadingDirectory = dialog.ResultDirectory.ForLoading.FullName; - _loadMetadata.LocationOfForArchivingDirectory = dialog.ResultDirectory.ForArchiving.FullName; - _loadMetadata.LocationOfExecutablesDirectory = dialog.ResultDirectory.ExecutablesPath.FullName; - _loadMetadata.LocationOfCacheDirectory = dialog.ResultDirectory.Cache.FullName; + dialog.ResultDirectory.PopulateLoadMetadata(_loadMetadata); } _loadMetadata.SaveToDatabase(); Publish(_loadMetadata); diff --git a/Rdmp.UI/ExtractionUIs/JoinsAndLookups/LookupConfigurationUI.Designer.cs b/Rdmp.UI/ExtractionUIs/JoinsAndLookups/LookupConfigurationUI.Designer.cs index b415a5d3b0..fbee6a5c8a 100644 --- a/Rdmp.UI/ExtractionUIs/JoinsAndLookups/LookupConfigurationUI.Designer.cs +++ b/Rdmp.UI/ExtractionUIs/JoinsAndLookups/LookupConfigurationUI.Designer.cs @@ -1,6 +1,7 @@ using BrightIdeasSoftware; using Rdmp.UI.ChecksUI; using Rdmp.UI.SimpleControls; +using System; namespace Rdmp.UI.ExtractionUIs.JoinsAndLookups { @@ -32,445 +33,288 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.label1 = new System.Windows.Forms.Label(); - this.olvExtractionInformations = new BrightIdeasSoftware.ObjectListView(); - this.olvExtractionInformationsNameColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this.tbCollation = new System.Windows.Forms.TextBox(); - this.label13 = new System.Windows.Forms.Label(); - this.label12 = new System.Windows.Forms.Label(); - this.olvSelectedDescriptionColumns = new BrightIdeasSoftware.ObjectListView(); - this.olvDescriptionsColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this.olvLookupColumns = new BrightIdeasSoftware.ObjectListView(); - this.olvLookupNameColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this.btnImportNewTableInfo = new System.Windows.Forms.Button(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.cbxLookup = new SelectIMapsDirectlyToDatabaseTableComboBox(); - this.label3 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.tbCatalogue = new System.Windows.Forms.TextBox(); - this.label4 = new System.Windows.Forms.Label(); - this.label7 = new System.Windows.Forms.Label(); - this.label10 = new System.Windows.Forms.Label(); - this.btnPrimaryKeyCompositeHelp = new System.Windows.Forms.Button(); - this.btnCreateLookup = new System.Windows.Forms.Button(); - this.ragSmiley1 = new RAGSmiley(); - this.fk3 = new KeyDropLocationUI(); - this.fk2 = new KeyDropLocationUI(); - this.fk1 = new KeyDropLocationUI(); - this.pk2 = new KeyDropLocationUI(); - this.pk3 = new KeyDropLocationUI(); - this.pk1 = new KeyDropLocationUI(); - this.tbFilter = new System.Windows.Forms.TextBox(); - this.label5 = new System.Windows.Forms.Label(); - ((System.ComponentModel.ISupportInitialize)(this.olvExtractionInformations)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.olvSelectedDescriptionColumns)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.olvLookupColumns)).BeginInit(); - this.groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(7, 354); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(143, 13); - this.label1.TabIndex = 0; - this.label1.Text = "Extractable Dataset Columns"; - // - // olvExtractionInformations - // - this.olvExtractionInformations.AllColumns.Add(this.olvExtractionInformationsNameColumn); - this.olvExtractionInformations.AllowDrop = true; - this.olvExtractionInformations.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); - this.olvExtractionInformations.CellEditUseWholeCell = false; - this.olvExtractionInformations.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.olvExtractionInformationsNameColumn}); - this.olvExtractionInformations.Cursor = System.Windows.Forms.Cursors.Default; - this.olvExtractionInformations.Location = new System.Drawing.Point(9, 370); - this.olvExtractionInformations.Name = "olvExtractionInformations"; - this.olvExtractionInformations.Size = new System.Drawing.Size(476, 369); - this.olvExtractionInformations.TabIndex = 1; - this.olvExtractionInformations.UseCompatibleStateImageBehavior = false; - this.olvExtractionInformations.View = System.Windows.Forms.View.Details; - this.olvExtractionInformations.ItemActivate += new System.EventHandler(this.olv_ItemActivate); - // - // olvExtractionInformationsNameColumn - // - this.olvExtractionInformationsNameColumn.AspectName = "ToString"; - this.olvExtractionInformationsNameColumn.FillsFreeSpace = true; - this.olvExtractionInformationsNameColumn.Groupable = false; - this.olvExtractionInformationsNameColumn.Text = "ExtractionInformations"; - this.olvExtractionInformationsNameColumn.MinimumWidth = 100; - // - // tbCollation - // - this.tbCollation.Location = new System.Drawing.Point(661, 595); - this.tbCollation.Name = "tbCollation"; - this.tbCollation.Size = new System.Drawing.Size(229, 20); - this.tbCollation.TabIndex = 18; - // - // label13 - // - this.label13.AutoSize = true; - this.label13.Location = new System.Drawing.Point(605, 599); - this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(50, 13); - this.label13.TabIndex = 17; - this.label13.Text = "Collation:"; - // - // label12 - // - this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(605, 437); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(146, 13); - this.label12.TabIndex = 15; - this.label12.Text = "Drag in Description Column(s)"; - // - // olvSelectedDescriptionColumns - // - this.olvSelectedDescriptionColumns.AllColumns.Add(this.olvDescriptionsColumn); - this.olvSelectedDescriptionColumns.CellEditUseWholeCell = false; - this.olvSelectedDescriptionColumns.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.olvDescriptionsColumn}); - this.olvSelectedDescriptionColumns.Cursor = System.Windows.Forms.Cursors.Default; - this.olvSelectedDescriptionColumns.IsSimpleDropSink = true; - this.olvSelectedDescriptionColumns.Location = new System.Drawing.Point(603, 456); - this.olvSelectedDescriptionColumns.Name = "olvSelectedDescriptionColumns"; - this.olvSelectedDescriptionColumns.Size = new System.Drawing.Size(406, 134); - this.olvSelectedDescriptionColumns.TabIndex = 14; - this.olvSelectedDescriptionColumns.UseCompatibleStateImageBehavior = false; - this.olvSelectedDescriptionColumns.View = System.Windows.Forms.View.Details; - this.olvSelectedDescriptionColumns.ModelCanDrop += new System.EventHandler(this.olvSelectedDescriptionColumns_ModelCanDrop); - this.olvSelectedDescriptionColumns.ModelDropped += new System.EventHandler(this.olvSelectedDescriptionColumns_ModelDropped); - this.olvSelectedDescriptionColumns.KeyUp += new System.Windows.Forms.KeyEventHandler(this.olvSelectedDescriptionColumns_KeyUp); - // - // olvDescriptionsColumn - // - this.olvDescriptionsColumn.AspectName = "ToString"; - this.olvDescriptionsColumn.FillsFreeSpace = true; - this.olvDescriptionsColumn.Groupable = false; - this.olvDescriptionsColumn.Text = "Description Fields"; - this.olvDescriptionsColumn.MinimumWidth = 100; - // - // olvLookupColumns - // - this.olvLookupColumns.AllColumns.Add(this.olvLookupNameColumn); - this.olvLookupColumns.AllowDrop = true; - this.olvLookupColumns.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.olvLookupColumns.CellEditUseWholeCell = false; - this.olvLookupColumns.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.olvLookupNameColumn}); - this.olvLookupColumns.Cursor = System.Windows.Forms.Cursors.Default; - this.olvLookupColumns.Location = new System.Drawing.Point(6, 67); - this.olvLookupColumns.Name = "olvLookupColumns"; - this.olvLookupColumns.Size = new System.Drawing.Size(461, 148); - this.olvLookupColumns.TabIndex = 12; - this.olvLookupColumns.UseCompatibleStateImageBehavior = false; - this.olvLookupColumns.View = System.Windows.Forms.View.Details; - this.olvLookupColumns.CellRightClick += new System.EventHandler(this.olvLookupColumns_CellRightClick); - this.olvLookupColumns.ItemActivate += new System.EventHandler(this.olv_ItemActivate); - // - // olvLookupNameColumn - // - this.olvLookupNameColumn.AspectName = "ToString"; - this.olvLookupNameColumn.FillsFreeSpace = true; - this.olvLookupNameColumn.Groupable = false; - this.olvLookupNameColumn.Text = "ColumnInfos"; - this.olvLookupNameColumn.MinimumWidth = 100; - // - // btnImportNewTableInfo - // - this.btnImportNewTableInfo.Location = new System.Drawing.Point(441, 24); - this.btnImportNewTableInfo.Name = "btnImportNewTableInfo"; - this.btnImportNewTableInfo.Size = new System.Drawing.Size(26, 26); - this.btnImportNewTableInfo.TabIndex = 148; - this.btnImportNewTableInfo.UseVisualStyleBackColor = true; - this.btnImportNewTableInfo.Click += new System.EventHandler(this.btnImportNewTableInfo_Click); - // - // groupBox1 - // - this.groupBox1.Controls.Add(this.cbxLookup); - this.groupBox1.Controls.Add(this.label3); - this.groupBox1.Controls.Add(this.label6); - this.groupBox1.Controls.Add(this.label2); - this.groupBox1.Controls.Add(this.olvLookupColumns); - this.groupBox1.Controls.Add(this.btnImportNewTableInfo); - this.groupBox1.Location = new System.Drawing.Point(3, 3); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(473, 234); - this.groupBox1.TabIndex = 149; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "1.Choose Lookup Table (contains the codes and descriptions e.g. T = Tayside, F = " + - "Fife"; - // - // cbxLookup - // - this.cbxLookup.Location = new System.Drawing.Point(9, 26); - this.cbxLookup.Name = "cbxLookup"; - this.cbxLookup.SelectedItem = null; - this.cbxLookup.Size = new System.Drawing.Size(426, 24); - this.cbxLookup.TabIndex = 152; - this.cbxLookup.SelectedItemChanged += new System.EventHandler(this.cbxLookup_SelectedItemChanged); - // - // label3 - // - this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label3.AutoSize = true; - this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label3.Location = new System.Drawing.Point(224, 218); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(53, 13); - this.label3.TabIndex = 151; - this.label3.Text = "(Columns)"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label6.Location = new System.Drawing.Point(435, 51); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(36, 13); - this.label6.TabIndex = 151; - this.label6.Text = "Import"; + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LookupConfigurationUI)); + lblTitle = new System.Windows.Forms.Label(); + label2 = new System.Windows.Forms.Label(); + cbSelectLookupTable = new System.Windows.Forms.ComboBox(); + btnAddAnotherRelation = new System.Windows.Forms.Button(); + gbAddRelation = new System.Windows.Forms.GroupBox(); + pictureBox2 = new System.Windows.Forms.PictureBox(); + gbDescription = new System.Windows.Forms.GroupBox(); + pictureBox3 = new System.Windows.Forms.PictureBox(); + btnAddDescription = new System.Windows.Forms.Button(); + label1 = new System.Windows.Forms.Label(); + tbCollation = new System.Windows.Forms.TextBox(); + btnCreateLookup = new System.Windows.Forms.Button(); + groupBox1 = new System.Windows.Forms.GroupBox(); + gbSubmit = new System.Windows.Forms.GroupBox(); + pictureBox5 = new System.Windows.Forms.PictureBox(); + pictureBox4 = new System.Windows.Forms.PictureBox(); + lblErrorText = new System.Windows.Forms.Label(); + pictureBox1 = new System.Windows.Forms.PictureBox(); + gbAddRelation.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBox2).BeginInit(); + gbDescription.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBox3).BeginInit(); + groupBox1.SuspendLayout(); + gbSubmit.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBox5).BeginInit(); + ((System.ComponentModel.ISupportInitialize)pictureBox4).BeginInit(); + ((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit(); + SuspendLayout(); + // + // lblTitle + // + lblTitle.AutoSize = true; + lblTitle.Font = new System.Drawing.Font("Segoe UI", 16F); + lblTitle.Location = new System.Drawing.Point(3, 9); + lblTitle.Name = "lblTitle"; + lblTitle.Size = new System.Drawing.Size(385, 30); + lblTitle.TabIndex = 0; + lblTitle.Text = "Create Lookup For SOME_CATALOGUE"; + lblTitle.Visible = false; // // label2 // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label2.Location = new System.Drawing.Point(121, 51); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(79, 13); - this.label2.TabIndex = 151; - this.label2.Text = "(Lookup Table)"; - // - // pictureBox1 - // - this.pictureBox1.Location = new System.Drawing.Point(12, 325); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(25, 25); - this.pictureBox1.TabIndex = 150; - this.pictureBox1.TabStop = false; - // - // tbCatalogue + label2.AutoSize = true; + label2.Location = new System.Drawing.Point(18, 66); + label2.Name = "label2"; + label2.Size = new System.Drawing.Size(114, 15); + label2.TabIndex = 1; + label2.Text = "Select Lookup Table:"; + label2.Click += label2_Click; + // + // cbSelectLookupTable + // + cbSelectLookupTable.FormattingEnabled = true; + cbSelectLookupTable.Location = new System.Drawing.Point(138, 63); + cbSelectLookupTable.Name = "cbSelectLookupTable"; + cbSelectLookupTable.Size = new System.Drawing.Size(281, 23); + cbSelectLookupTable.TabIndex = 2; + cbSelectLookupTable.SelectedIndexChanged += cbSelectLookupTable_SelectedIndexchanged; + // + // btnAddAnotherRelation + // + btnAddAnotherRelation.Enabled = false; + btnAddAnotherRelation.Location = new System.Drawing.Point(0, 22); + btnAddAnotherRelation.Name = "btnAddAnotherRelation"; + btnAddAnotherRelation.Size = new System.Drawing.Size(153, 23); + btnAddAnotherRelation.TabIndex = 4; + btnAddAnotherRelation.Text = "Add Another"; + btnAddAnotherRelation.UseVisualStyleBackColor = true; + btnAddAnotherRelation.Click += btnAddAnotherRelation_Click; + // + // gbAddRelation + // + gbAddRelation.AutoSize = true; + gbAddRelation.Controls.Add(pictureBox2); + gbAddRelation.Controls.Add(btnAddAnotherRelation); + gbAddRelation.Location = new System.Drawing.Point(15, 22); + gbAddRelation.Name = "gbAddRelation"; + gbAddRelation.Size = new System.Drawing.Size(580, 72); + gbAddRelation.TabIndex = 5; + gbAddRelation.TabStop = false; + gbAddRelation.Text = "Add Relation:"; + gbAddRelation.Enter += gbAddRelation_Enter; + // + // pictureBox2 + // + pictureBox2.ErrorImage = (System.Drawing.Image)resources.GetObject("pictureBox2.ErrorImage"); + pictureBox2.Image = (System.Drawing.Image)resources.GetObject("pictureBox2.Image"); + pictureBox2.InitialImage = (System.Drawing.Image)resources.GetObject("pictureBox2.InitialImage"); + pictureBox2.Location = new System.Drawing.Point(159, 22); + pictureBox2.Name = "pictureBox2"; + pictureBox2.Size = new System.Drawing.Size(21, 21); + pictureBox2.TabIndex = 12; + pictureBox2.TabStop = false; + pictureBox2.Click += pictureBox2_Click; + // + // gbDescription + // + gbDescription.AutoSize = true; + gbDescription.Controls.Add(pictureBox3); + gbDescription.Controls.Add(btnAddDescription); + gbDescription.Location = new System.Drawing.Point(15, 109); + gbDescription.Name = "gbDescription"; + gbDescription.Size = new System.Drawing.Size(318, 74); + gbDescription.TabIndex = 6; + gbDescription.TabStop = false; + gbDescription.Text = "Add Description Column(s):"; + // + // pictureBox3 + // + pictureBox3.ErrorImage = (System.Drawing.Image)resources.GetObject("pictureBox3.ErrorImage"); + pictureBox3.Image = (System.Drawing.Image)resources.GetObject("pictureBox3.Image"); + pictureBox3.InitialImage = (System.Drawing.Image)resources.GetObject("pictureBox3.InitialImage"); + pictureBox3.Location = new System.Drawing.Point(159, 24); + pictureBox3.Name = "pictureBox3"; + pictureBox3.Size = new System.Drawing.Size(21, 21); + pictureBox3.TabIndex = 13; + pictureBox3.TabStop = false; + pictureBox3.Click += pictureBox3_Click; + // + // btnAddDescription + // + btnAddDescription.Enabled = false; + btnAddDescription.Location = new System.Drawing.Point(0, 22); + btnAddDescription.Name = "btnAddDescription"; + btnAddDescription.Size = new System.Drawing.Size(153, 23); + btnAddDescription.TabIndex = 4; + btnAddDescription.Text = "Add Another"; + btnAddDescription.UseVisualStyleBackColor = true; + btnAddDescription.Click += btnAddDescription_Click; // - this.tbCatalogue.Location = new System.Drawing.Point(43, 331); - this.tbCatalogue.Name = "tbCatalogue"; - this.tbCatalogue.ReadOnly = true; - this.tbCatalogue.Size = new System.Drawing.Size(442, 20); - this.tbCatalogue.TabIndex = 151; - // - // label4 + // label1 // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(807, 295); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(13, 13); - this.label4.TabIndex = 152; - this.label4.Text = "="; + label1.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + label1.AutoSize = true; + label1.Location = new System.Drawing.Point(6, 19); + label1.Name = "label1"; + label1.Size = new System.Drawing.Size(58, 15); + label1.TabIndex = 7; + label1.Text = "Collation:"; // - // label7 + // tbCollation // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(807, 334); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(13, 13); - this.label7.TabIndex = 152; - this.label7.Text = "="; + tbCollation.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + tbCollation.Location = new System.Drawing.Point(64, 16); + tbCollation.Name = "tbCollation"; + tbCollation.Size = new System.Drawing.Size(254, 23); + tbCollation.TabIndex = 8; // - // label10 + // btnCreateLookup // - this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(807, 373); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(13, 13); - this.label10.TabIndex = 152; - this.label10.Text = "="; + btnCreateLookup.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + btnCreateLookup.Enabled = false; + btnCreateLookup.Location = new System.Drawing.Point(6, 45); + btnCreateLookup.Name = "btnCreateLookup"; + btnCreateLookup.Size = new System.Drawing.Size(114, 23); + btnCreateLookup.TabIndex = 9; + btnCreateLookup.Text = "Create Lookup"; + btnCreateLookup.UseVisualStyleBackColor = true; + btnCreateLookup.Click += btnCreateLookup_Click; // - // btnPrimaryKeyCompositeHelp + // groupBox1 // - this.btnPrimaryKeyCompositeHelp.Location = new System.Drawing.Point(1058, 328); - this.btnPrimaryKeyCompositeHelp.Name = "btnPrimaryKeyCompositeHelp"; - this.btnPrimaryKeyCompositeHelp.Size = new System.Drawing.Size(26, 26); - this.btnPrimaryKeyCompositeHelp.TabIndex = 153; - this.btnPrimaryKeyCompositeHelp.UseVisualStyleBackColor = true; - this.btnPrimaryKeyCompositeHelp.Click += new System.EventHandler(this.btnPrimaryKeyCompositeHelp_Click); + groupBox1.AutoSize = true; + groupBox1.Controls.Add(gbSubmit); + groupBox1.Controls.Add(gbAddRelation); + groupBox1.Controls.Add(gbDescription); + groupBox1.Location = new System.Drawing.Point(18, 92); + groupBox1.Name = "groupBox1"; + groupBox1.Size = new System.Drawing.Size(1141, 471); + groupBox1.TabIndex = 10; + groupBox1.TabStop = false; + // + // gbSubmit + // + gbSubmit.Controls.Add(pictureBox5); + gbSubmit.Controls.Add(pictureBox4); + gbSubmit.Controls.Add(lblErrorText); + gbSubmit.Controls.Add(btnCreateLookup); + gbSubmit.Controls.Add(tbCollation); + gbSubmit.Controls.Add(label1); + gbSubmit.Location = new System.Drawing.Point(15, 203); + gbSubmit.Name = "gbSubmit"; + gbSubmit.Size = new System.Drawing.Size(1081, 123); + gbSubmit.TabIndex = 10; + gbSubmit.TabStop = false; + // + // pictureBox5 + // + pictureBox5.ErrorImage = (System.Drawing.Image)resources.GetObject("pictureBox5.ErrorImage"); + pictureBox5.Image = (System.Drawing.Image)resources.GetObject("pictureBox5.Image"); + pictureBox5.InitialImage = (System.Drawing.Image)resources.GetObject("pictureBox5.InitialImage"); + pictureBox5.Location = new System.Drawing.Point(132, 45); + pictureBox5.Name = "pictureBox5"; + pictureBox5.Size = new System.Drawing.Size(21, 21); + pictureBox5.TabIndex = 15; + pictureBox5.TabStop = false; + pictureBox5.Click += pictureBox5_Click; + // + // pictureBox4 + // + pictureBox4.ErrorImage = (System.Drawing.Image)resources.GetObject("pictureBox4.ErrorImage"); + pictureBox4.Image = (System.Drawing.Image)resources.GetObject("pictureBox4.Image"); + pictureBox4.InitialImage = (System.Drawing.Image)resources.GetObject("pictureBox4.InitialImage"); + pictureBox4.Location = new System.Drawing.Point(324, 18); + pictureBox4.Name = "pictureBox4"; + pictureBox4.Size = new System.Drawing.Size(21, 21); + pictureBox4.TabIndex = 14; + pictureBox4.TabStop = false; + pictureBox4.Click += pictureBox4_Click; + // + // lblErrorText + // + lblErrorText.AutoSize = true; + lblErrorText.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0); + lblErrorText.ForeColor = System.Drawing.Color.Red; + lblErrorText.Location = new System.Drawing.Point(7, 90); + lblErrorText.Name = "lblErrorText"; + lblErrorText.Size = new System.Drawing.Size(57, 21); + lblErrorText.TabIndex = 11; + lblErrorText.Text = "label3"; + lblErrorText.Visible = false; // - // btnCreateLookup + // pictureBox1 // - this.btnCreateLookup.Enabled = false; - this.btnCreateLookup.Location = new System.Drawing.Point(603, 621); - this.btnCreateLookup.Name = "btnCreateLookup"; - this.btnCreateLookup.Size = new System.Drawing.Size(109, 23); - this.btnCreateLookup.TabIndex = 162; - this.btnCreateLookup.Text = "Create Lookup"; - this.btnCreateLookup.UseVisualStyleBackColor = true; - this.btnCreateLookup.Click += new System.EventHandler(this.btnCreateLookup_Click); - // - // ragSmiley1 - // - this.ragSmiley1.AlwaysShowHandCursor = false; - this.ragSmiley1.BackColor = System.Drawing.Color.Transparent; - this.ragSmiley1.Cursor = System.Windows.Forms.Cursors.Arrow; - this.ragSmiley1.Location = new System.Drawing.Point(572, 619); - this.ragSmiley1.Name = "ragSmiley1"; - this.ragSmiley1.Size = new System.Drawing.Size(25, 25); - this.ragSmiley1.TabIndex = 163; - // - // fk3 - // - this.fk3.IsValidGetter = null; - this.fk3.KeyType = JoinKeyType.PrimaryKey; - this.fk3.Location = new System.Drawing.Point(826, 369); - this.fk3.Name = "fk3"; - this.fk3.Size = new System.Drawing.Size(226, 35); - this.fk3.TabIndex = 161; - // - // fk2 - // - this.fk2.IsValidGetter = null; - this.fk2.KeyType = JoinKeyType.PrimaryKey; - this.fk2.Location = new System.Drawing.Point(826, 328); - this.fk2.Name = "fk2"; - this.fk2.Size = new System.Drawing.Size(226, 35); - this.fk2.TabIndex = 160; - // - // fk1 - // - this.fk1.IsValidGetter = null; - this.fk1.KeyType = JoinKeyType.PrimaryKey; - this.fk1.Location = new System.Drawing.Point(826, 285); - this.fk1.Name = "fk1"; - this.fk1.Size = new System.Drawing.Size(226, 35); - this.fk1.TabIndex = 159; - // - // pk2 - // - this.pk2.IsValidGetter = null; - this.pk2.KeyType = JoinKeyType.PrimaryKey; - this.pk2.Location = new System.Drawing.Point(575, 328); - this.pk2.Name = "pk2"; - this.pk2.Size = new System.Drawing.Size(226, 35); - this.pk2.TabIndex = 158; - // - // pk3 - // - this.pk3.IsValidGetter = null; - this.pk3.KeyType = JoinKeyType.PrimaryKey; - this.pk3.Location = new System.Drawing.Point(575, 369); - this.pk3.Name = "pk3"; - this.pk3.Size = new System.Drawing.Size(226, 35); - this.pk3.TabIndex = 157; - // - // pk1 - // - this.pk1.IsValidGetter = null; - this.pk1.KeyType = JoinKeyType.PrimaryKey; - this.pk1.Location = new System.Drawing.Point(575, 285); - this.pk1.Name = "pk1"; - this.pk1.Size = new System.Drawing.Size(226, 35); - this.pk1.TabIndex = 156; - // - // tbFilter - // - this.tbFilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.tbFilter.Location = new System.Drawing.Point(43, 745); - this.tbFilter.Name = "tbFilter"; - this.tbFilter.Size = new System.Drawing.Size(442, 20); - this.tbFilter.TabIndex = 164; - this.tbFilter.TextChanged += new System.EventHandler(this.tbFilter_TextChanged); - // - // label5 - // - this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(9, 748); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(32, 13); - this.label5.TabIndex = 165; - this.label5.Text = "Filter:"; - // - // LookupConfiguration - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.AutoScroll = true; - this.Controls.Add(this.label5); - this.Controls.Add(this.tbFilter); - this.Controls.Add(this.ragSmiley1); - this.Controls.Add(this.btnCreateLookup); - this.Controls.Add(this.fk3); - this.Controls.Add(this.fk2); - this.Controls.Add(this.fk1); - this.Controls.Add(this.pk2); - this.Controls.Add(this.pk3); - this.Controls.Add(this.pk1); - this.Controls.Add(this.btnPrimaryKeyCompositeHelp); - this.Controls.Add(this.label10); - this.Controls.Add(this.label7); - this.Controls.Add(this.label4); - this.Controls.Add(this.tbCatalogue); - this.Controls.Add(this.pictureBox1); - this.Controls.Add(this.groupBox1); - this.Controls.Add(this.tbCollation); - this.Controls.Add(this.label13); - this.Controls.Add(this.label12); - this.Controls.Add(this.olvSelectedDescriptionColumns); - this.Controls.Add(this.olvExtractionInformations); - this.Controls.Add(this.label1); - this.Name = "LookupConfiguration"; - this.Size = new System.Drawing.Size(1103, 772); - this.Paint += new System.Windows.Forms.PaintEventHandler(this.LookupConfiguration_Paint); - ((System.ComponentModel.ISupportInitialize)(this.olvExtractionInformations)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.olvSelectedDescriptionColumns)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.olvLookupColumns)).EndInit(); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - + pictureBox1.ErrorImage = (System.Drawing.Image)resources.GetObject("pictureBox1.ErrorImage"); + pictureBox1.Image = (System.Drawing.Image)resources.GetObject("pictureBox1.Image"); + pictureBox1.InitialImage = (System.Drawing.Image)resources.GetObject("pictureBox1.InitialImage"); + pictureBox1.Location = new System.Drawing.Point(425, 60); + pictureBox1.Name = "pictureBox1"; + pictureBox1.Size = new System.Drawing.Size(21, 21); + pictureBox1.TabIndex = 11; + pictureBox1.TabStop = false; + pictureBox1.Click += pictureBox1_Click; + // + // LookupConfigurationUI + // + AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + AutoScroll = true; + Controls.Add(pictureBox1); + Controls.Add(groupBox1); + Controls.Add(cbSelectLookupTable); + Controls.Add(label2); + Controls.Add(lblTitle); + Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + Name = "LookupConfigurationUI"; + Size = new System.Drawing.Size(1083, 789); + gbAddRelation.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)pictureBox2).EndInit(); + gbDescription.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)pictureBox3).EndInit(); + groupBox1.ResumeLayout(false); + groupBox1.PerformLayout(); + gbSubmit.ResumeLayout(false); + gbSubmit.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBox5).EndInit(); + ((System.ComponentModel.ISupportInitialize)pictureBox4).EndInit(); + ((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit(); + ResumeLayout(false); + PerformLayout(); } #endregion + private System.Windows.Forms.Label lblTitle; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.ComboBox cbSelectLookupTable; + private System.Windows.Forms.Button btnAddAnotherRelation; + private System.Windows.Forms.GroupBox gbAddRelation; + private System.Windows.Forms.GroupBox gbDescription; + private System.Windows.Forms.Button btnAddDescription; private System.Windows.Forms.Label label1; - private ObjectListView olvExtractionInformations; - private ObjectListView olvLookupColumns; - private ObjectListView olvSelectedDescriptionColumns; - private System.Windows.Forms.Label label12; private System.Windows.Forms.TextBox tbCollation; - private System.Windows.Forms.Label label13; - private System.Windows.Forms.Button btnImportNewTableInfo; + private System.Windows.Forms.Button btnCreateLookup; private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label2; - private OLVColumn olvLookupNameColumn; + private System.Windows.Forms.GroupBox gbSubmit; + private System.Windows.Forms.Label lblErrorText; private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.TextBox tbCatalogue; - private OLVColumn olvExtractionInformationsNameColumn; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label label10; - private System.Windows.Forms.Button btnPrimaryKeyCompositeHelp; - private KeyDropLocationUI pk1; - private KeyDropLocationUI pk3; - private KeyDropLocationUI pk2; - private KeyDropLocationUI fk1; - private KeyDropLocationUI fk2; - private KeyDropLocationUI fk3; - private OLVColumn olvDescriptionsColumn; - private System.Windows.Forms.Button btnCreateLookup; - private RAGSmiley ragSmiley1; - private System.Windows.Forms.TextBox tbFilter; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label6; - private SelectIMapsDirectlyToDatabaseTableComboBox cbxLookup; + private System.Windows.Forms.PictureBox pictureBox2; + private System.Windows.Forms.PictureBox pictureBox3; + private System.Windows.Forms.PictureBox pictureBox5; + private System.Windows.Forms.PictureBox pictureBox4; } } \ No newline at end of file diff --git a/Rdmp.UI/ExtractionUIs/JoinsAndLookups/LookupConfigurationUI.cs b/Rdmp.UI/ExtractionUIs/JoinsAndLookups/LookupConfigurationUI.cs index 094a9627d5..0eccd004ea 100644 --- a/Rdmp.UI/ExtractionUIs/JoinsAndLookups/LookupConfigurationUI.cs +++ b/Rdmp.UI/ExtractionUIs/JoinsAndLookups/LookupConfigurationUI.cs @@ -7,26 +7,12 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Drawing; -using System.Drawing.Drawing2D; using System.Linq; using System.Windows.Forms; -using BrightIdeasSoftware; -using Rdmp.Core; -using Rdmp.Core.CommandExecution; using Rdmp.Core.CommandExecution.AtomicCommands; using Rdmp.Core.Curation.Data; -using Rdmp.Core.Icons.IconProvision; -using Rdmp.Core.MapsDirectlyToDatabaseTable; -using Rdmp.Core.ReusableLibraryCode.Icons.IconProvision; using Rdmp.UI.ItemActivation; -using Rdmp.UI.MainFormUITabs.SubComponents; -using Rdmp.UI.Menus; -using Rdmp.UI.Refreshing; -using Rdmp.UI.SimpleDialogs; using Rdmp.UI.TestsAndSetup.ServicePropogation; -using DragDropEffects = System.Windows.Forms.DragDropEffects; -using Point = System.Drawing.Point; using WideMessageBox = Rdmp.UI.SimpleDialogs.WideMessageBox; namespace Rdmp.UI.ExtractionUIs.JoinsAndLookups; @@ -62,452 +48,314 @@ public partial class LookupConfigurationUI : LookupConfiguration_Design { private Catalogue _catalogue; private ToolTip toolTip = new(); + private string _errorMessage = null; + private List _allExtractionInformationFromCatalogue = new(); //constructor public LookupConfigurationUI() { InitializeComponent(); - olvLookupColumns.RowHeight = 19; - olvExtractionInformations.RowHeight = 19; - olvSelectedDescriptionColumns.RowHeight = 19; - - olvLookupColumns.IsSimpleDragSource = true; - olvExtractionInformations.IsSimpleDragSource = true; - - pk1.KeyType = JoinKeyType.PrimaryKey; - pk1.SelectedColumnChanged += pk1_SelectedColumnChanged; - - pk2.KeyType = JoinKeyType.PrimaryKey; - pk2.SelectedColumnChanged += UpdateValidityAssesment; - - pk3.KeyType = JoinKeyType.PrimaryKey; - pk3.SelectedColumnChanged += UpdateValidityAssesment; - - fk1.KeyType = JoinKeyType.ForeignKey; - fk1.SelectedColumnChanged += fk1_SelectedColumnChanged; - - fk2.KeyType = JoinKeyType.ForeignKey; - fk2.SelectedColumnChanged += UpdateValidityAssesment; - - fk3.KeyType = JoinKeyType.ForeignKey; - fk3.SelectedColumnChanged += UpdateValidityAssesment; - - AssociatedCollection = RDMPCollection.Tables; - } - - private void UpdateValidityAssesment() - { - UpdateValidityAssesment(false); - } - - private void fk1_SelectedColumnChanged() - { - SetStage( - pk1.SelectedColumn == null ? LookupCreationStage.DragAForeignKey : LookupCreationStage.DragADescription); - UpdateValidityAssesment(); - } - - private void pk1_SelectedColumnChanged() - { - SetStage(pk1.SelectedColumn == null - ? LookupCreationStage.DragAPrimaryKey - : LookupCreationStage.DragAForeignKey); - UpdateValidityAssesment(); } public override void SetDatabaseObject(IActivateItems activator, Catalogue databaseObject) { base.SetDatabaseObject(activator, databaseObject); _catalogue = databaseObject; - - cbxLookup.SetItemActivator(activator); - olvLookupNameColumn.ImageGetter = o => activator.CoreIconProvider.GetImage(o).ImageToBitmap(); - olvExtractionInformationsNameColumn.ImageGetter = o => activator.CoreIconProvider.GetImage(o).ImageToBitmap(); - olvDescriptionsColumn.ImageGetter = o => activator.CoreIconProvider.GetImage(o).ImageToBitmap(); - - //add the currently configured extraction informations in the order they appear in the dataset - var allExtractionInformationFromCatalogue = - new List(_catalogue.GetAllExtractionInformation(ExtractionCategory.Any)); - allExtractionInformationFromCatalogue.Sort(); - - olvExtractionInformations.ClearObjects(); - olvExtractionInformations.AddObjects(allExtractionInformationFromCatalogue.ToArray()); - - btnImportNewTableInfo.Image = activator.CoreIconProvider.GetImage(RDMPConcept.TableInfo, OverlayKind.Import) - .ImageToBitmap(); - toolTip.SetToolTip(btnImportNewTableInfo, "Import new..."); - - btnPrimaryKeyCompositeHelp.Image = FamFamFamIcons.help.ImageToBitmap(); - - pictureBox1.Image = activator.CoreIconProvider.GetImage(RDMPConcept.Catalogue).ImageToBitmap(); - tbCatalogue.Text = databaseObject.ToString(); - - cbxLookup.SetUp(activator.CoreChildProvider.AllTableInfos); - - UpdateValidityAssesment(); - } - - public void SetLookupTableInfo(TableInfo t, bool setComboBox = true) - { - if (t is { IsTableValuedFunction: true }) + lblTitle.Text = $"Create Lookup For {_catalogue.Name}"; + lblTitle.Visible = true; + var tableInfo = activator.CoreChildProvider.AllTableInfos; + if (tableInfo.Length == 0) { - WideMessageBox.Show("Lookup table not valid", - $"Table '{t}' is a TableValuedFunction, you cannot use it as a lookup table"); + HandleError("No Table Infos Available"); return; } - - if (setComboBox) - cbxLookup.SelectedItem = t; - - olvLookupColumns.ClearObjects(); - - if (t != null) + cbSelectLookupTable.Enabled = true; + foreach (var tb in tableInfo) { - olvLookupColumns.AddObjects(t.ColumnInfos); - - SetStage(LookupCreationStage.DragAPrimaryKey); - - pk1.IsValidGetter = c => c.TableInfo_ID == t.ID; - pk2.IsValidGetter = c => c.TableInfo_ID == t.ID; - pk3.IsValidGetter = c => c.TableInfo_ID == t.ID; - - fk1.IsValidGetter = c => c.TableInfo_ID != t.ID; - fk2.IsValidGetter = c => c.TableInfo_ID != t.ID; - fk3.IsValidGetter = c => c.TableInfo_ID != t.ID; - } - else - { - SetStage(LookupCreationStage.ChooseLookupTable); + cbSelectLookupTable.Items.Add(tb); } + _allExtractionInformationFromCatalogue = + new List(_catalogue.GetAllExtractionInformation(ExtractionCategory.Any)); + _allExtractionInformationFromCatalogue.Sort(); + AddRelationOption(); + AddDescriptionOption(); } - private void btnImportNewTableInfo_Click(object sender, EventArgs e) - { - var importDialog = new ImportSQLTableUI(Activator, false); + private List PKRelations = new(); + private List FKRelations = new(); + private List