• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

HicServices / RDMP / 19465055827

18 Nov 2025 11:47AM UTC coverage: 57.142% (+0.05%) from 57.097%
19465055827

push

github

web-flow
Merge pull request #2260 from HicServices/task/RDMP-342-cic-templates

Task/rdmp-342 CIC Templates

11472 of 21559 branches covered (53.21%)

Branch coverage included in aggregate %.

1000 of 1215 new or added lines in 34 files covered. (82.3%)

2 existing lines in 2 files now uncovered.

32516 of 55421 relevant lines covered (58.67%)

8798.98 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandImportCohortIdentificationConfiguration.cs
1
// Copyright (c) The University of Dundee 2018-2019
2
// This file is part of the Research Data Management Platform (RDMP).
3
// 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.
4
// 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.
5
// You should have received a copy of the GNU General Public License along with RDMP. If not, see <https://www.gnu.org/licenses/>.
6

7
using System.Linq;
8
using Rdmp.Core.Curation.Data.Cohort;
9
using Rdmp.Core.Icons.IconProvision;
10
using Rdmp.Core.Repositories;
11
using Rdmp.Core.ReusableLibraryCode.Icons.IconProvision;
12
using SixLabors.ImageSharp;
13
using SixLabors.ImageSharp.PixelFormats;
14

15
namespace Rdmp.Core.CommandExecution.AtomicCommands;
16

17
/// <summary>
18
/// Clone and import one or more <see cref="CohortIdentificationConfiguration"/> into a root or subcontainer of another
19
/// </summary>
20
public class ExecuteCommandImportCohortIdentificationConfiguration : BasicCommandExecution
21
{
22
    public CohortAggregateContainer IntoContainer { get; }
×
23
    public CohortIdentificationConfiguration[] ToImport { get; }
×
24

25
    public ExecuteCommandImportCohortIdentificationConfiguration(IBasicActivateItems activator,
26
        CohortIdentificationConfiguration[] toImport, CohortAggregateContainer intoContainer) : base(activator)
×
27
    {
28
        Weight = 0.15f;
×
29

30
        ToImport = toImport;
×
31
        IntoContainer = intoContainer;
×
32

33
        if (IntoContainer == null)
×
34
        {
35
            SetImpossible("You must specify a container");
×
36
            return;
×
37
        }
38

NEW
39
        if (intoContainer.ShouldBeReadOnly(this.GetType().Name, out var reason)) SetImpossible(reason);
×
40

41
        // if we don't know what to import yet then we should have the
42
        // 'more choices to come' suffix
43
        UseTripleDotSuffix = ToImport == null;
×
44
    }
×
45

46
    public override Image<Rgba32> GetImage(IIconProvider iconProvider) =>
47
        iconProvider.GetImage(RDMPConcept.CohortIdentificationConfiguration, OverlayKind.Add);
×
48

49
    public override void Execute()
50
    {
51
        base.Execute();
×
52

53
        var import = ToImport;
×
54

55
        if (import == null)
×
56
            if (!BasicActivator.SelectObjects(new DialogArgs
×
57
            {
×
58
                WindowTitle = "Add CohortIdentificationConfiguration(s) to Container",
×
59
                TaskDescription =
×
60
                            $"Choose which CohortIdentificationConfiguration(s) to add to the cohort container '{IntoContainer.Name}'.  For each one selected, the entire query tree will be imported."
×
61
            },
×
62
                    BasicActivator.RepositoryLocator.CatalogueRepository
×
63
                        .GetAllObjects<CohortIdentificationConfiguration>(),
×
64
                    out import))
×
65
                return;
×
66

67
        if (import == null || !import.Any())
×
68
            return;
×
69

70

71
        var merger =
×
72
            new CohortIdentificationConfigurationMerger(
×
73
                (CatalogueRepository)BasicActivator.RepositoryLocator.CatalogueRepository);
×
74
        merger.Import(import, IntoContainer);
×
75

76
        Publish(IntoContainer);
×
77
        Emphasise(IntoContainer, int.MaxValue);
×
78
    }
×
79
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc