Skip to content

Commit 5eee9b5

Browse files
authored
Task/rdmp 357 cohort clone no association (#2310)
* copy associations when cloning cic * add changelog * update params * Update CHANGELOG.md
1 parent f61b66d commit 5eee9b5

14 files changed

+44
-28
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [9.2.0] - Unreleased
88
- Add Internal Note to Catalogue
9+
- Fix issue where project associations were not copied when a CIC was cloned
910
- Fix issue with using Internal Catalogues in Cohort Identification Configurations
1011

1112
## [9.1.2] - Unreleased

Rdmp.Core.Tests/CohortCreation/CohortContainerAndCloningTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ public void CohortIdentificationConfiguration_CloneEntirely()
240240

241241
try
242242
{
243-
var clone = cohortIdentificationConfiguration.CreateClone(ThrowImmediatelyCheckNotifier.Quiet);
243+
var clone = cohortIdentificationConfiguration.CreateClone(ThrowImmediatelyCheckNotifier.Quiet,DataExportRepository);
244244

245245
Assert.Multiple(() =>
246246
{

Rdmp.Core.Tests/CohortCreation/CohortIdentificationConfigurationMergerTests.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// You should have received a copy of the GNU General Public License along with RDMP. If not, see <https://www.gnu.org/licenses/>.
66

77
using NUnit.Framework;
8+
using Rdmp.Core.CommandExecution;
89
using Rdmp.Core.Curation.Data.Cohort;
910
using System.Linq;
1011

@@ -15,7 +16,7 @@ internal class CohortIdentificationConfigurationMergerTests : CohortIdentificati
1516
[Test]
1617
public void TestSimpleMerge()
1718
{
18-
var merger = new CohortIdentificationConfigurationMerger(CatalogueRepository);
19+
var merger = new CohortIdentificationConfigurationMerger(RepositoryLocator);
1920

2021
var cic1 = new CohortIdentificationConfiguration(CatalogueRepository, "cic1");
2122
var cic2 = new CohortIdentificationConfiguration(CatalogueRepository, "cic2");
@@ -90,7 +91,7 @@ public void TestSimpleMerge()
9091
[Test]
9192
public void TestSimpleUnMerge()
9293
{
93-
var merger = new CohortIdentificationConfigurationMerger(CatalogueRepository);
94+
var merger = new CohortIdentificationConfigurationMerger(RepositoryLocator);
9495

9596
var cicInput = new CohortIdentificationConfiguration(CatalogueRepository, "cic99");
9697

@@ -153,7 +154,7 @@ public void TestSimpleUnMerge()
153154
[Test]
154155
public void TestSimpleImportCic()
155156
{
156-
var merger = new CohortIdentificationConfigurationMerger(CatalogueRepository);
157+
var merger = new CohortIdentificationConfigurationMerger(RepositoryLocator);
157158

158159
var cic1 = new CohortIdentificationConfiguration(CatalogueRepository, "cic1");
159160
var cic2 = new CohortIdentificationConfiguration(CatalogueRepository, "cic2");

Rdmp.Core.Tests/CohortCreation/QueryTests/JoinableCohortConfigurationTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ public void QueryBuilderTest_JoinableCloning()
402402

403403
try
404404
{
405-
var clone = cohortIdentificationConfiguration.CreateClone(ThrowImmediatelyCheckNotifier.Quiet);
405+
var clone = cohortIdentificationConfiguration.CreateClone(ThrowImmediatelyCheckNotifier.Quiet, DataExportRepository);
406406

407407
var cloneBuilder = new CohortQueryBuilder(clone, null);
408408

Rdmp.Core/CommandExecution/AtomicCommands/CohortCreationCommands/ExecuteCommandCreateCohortIdentificationConfigurationTemplate.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public override void Execute()
3232
var associations = _activator.RepositoryLocator.DataExportRepository.GetAllObjects<ProjectCohortIdentificationConfigurationAssociation>();
3333
var projectAssociations = associations.Where(a => a.CohortIdentificationConfiguration_ID == _cic.ID).ToList();
3434
base.Execute();
35-
var clone = _cic.CreateClone(ThrowImmediatelyCheckNotifier.Quiet);
35+
var clone = _cic.CreateClone(ThrowImmediatelyCheckNotifier.Quiet, _activator.RepositoryLocator.DataExportRepository);
3636
clone.IsTemplate = true;
3737
clone.Freeze();
3838
clone.Name = GenerateTemplateName(clone.Name);

Rdmp.Core/CommandExecution/AtomicCommands/CohortCreationCommands/ExecuteCommandUseTemplateCohortIdentificationConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public override void Execute()
7070
}
7171
}
7272
base.Execute();
73-
var clone = _cic.CreateClone(ThrowImmediatelyCheckNotifier.Quiet);
73+
var clone = _cic.CreateClone(ThrowImmediatelyCheckNotifier.Quiet, _activator.RepositoryLocator.DataExportRepository);
7474
clone.IsTemplate = false;
7575
clone.Name = RenameTemplateForUse(clone.Name);
7676
clone.SaveToDatabase();

Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandCloneCohortIdentificationConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public override void Execute()
9898
if (!_autoConfirm && BasicActivator.IsInteractive && !YesNo(
9999
"This will create a 100% copy of the entire CohortIdentificationConfiguration including all datasets, filters, parameters and set operations. Are you sure this is what you want?",
100100
"Confirm Cloning")) return;
101-
CloneCreatedIfAny = _cic.CreateClone(ThrowImmediatelyCheckNotifier.Quiet);
101+
CloneCreatedIfAny = _cic.CreateClone(ThrowImmediatelyCheckNotifier.Quiet, BasicActivator.RepositoryLocator.DataExportRepository);
102102
if (CloneCreatedIfAny != null && _version is not null)
103103
{
104104
CloneCreatedIfAny.Version = _version;

Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandImportCohortIdentificationConfiguration.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ public override void Execute()
6969

7070

7171
var merger =
72-
new CohortIdentificationConfigurationMerger(
73-
(CatalogueRepository)BasicActivator.RepositoryLocator.CatalogueRepository);
72+
new CohortIdentificationConfigurationMerger(BasicActivator.RepositoryLocator);
7473
merger.Import(import, IntoContainer);
7574

7675
Publish(IntoContainer);

Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandMergeCohortIdentificationConfigurations.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ public override void Execute()
3737
}
3838

3939
var merger =
40-
new CohortIdentificationConfigurationMerger(
41-
(CatalogueRepository)BasicActivator.RepositoryLocator.CatalogueRepository);
40+
new CohortIdentificationConfigurationMerger(BasicActivator.RepositoryLocator);
4241
var result = merger.Merge(toMerge, SetOperation.UNION);
4342

4443
if (result == null) return;

Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandRevertToHistoricalCohortVersion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public override void Execute()
4141
}
4242

4343
base.Execute();
44-
var clone = _historicalConfiguration.CloneIntoExistingConfiguration(ThrowImmediatelyCheckNotifier.Quiet, _configuration,false);
44+
var clone = _historicalConfiguration.CloneIntoExistingConfiguration(ThrowImmediatelyCheckNotifier.Quiet, _configuration,_activator.RepositoryLocator.DataExportRepository, false);
4545
Publish(clone);
4646
Emphasise(clone);
4747
}

0 commit comments

Comments
 (0)