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

HicServices / RDMP / 20057586828

09 Dec 2025 08:56AM UTC coverage: 57.193% (-0.2%) from 57.422%
20057586828

Pull #2182

github

JFriel
Merge branch 'develop' of https://github.com/HicServices/RDMP into task/RDMP-33-dataset-integration-interface
Pull Request #2182: [Datasets] Task/rdmp 33 dataset integration interface

11510 of 21615 branches covered (53.25%)

Branch coverage included in aggregate %.

1226 of 2024 new or added lines in 85 files covered. (60.57%)

35 existing lines in 15 files now uncovered.

32654 of 55604 relevant lines covered (58.73%)

8854.02 hits per line

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

51.16
/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandMakeProjectSpecificCatalogueNormalAgain.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.Collections.Generic;
8
using System.Linq;
9
using Rdmp.Core.Curation.Data;
10
using Rdmp.Core.DataExport.Data;
11
using Rdmp.Core.Icons.IconProvision;
12
using Rdmp.Core.Repositories;
13
using Rdmp.Core.ReusableLibraryCode.Icons.IconProvision;
14
using SixLabors.ImageSharp;
15
using SixLabors.ImageSharp.PixelFormats;
16

17
namespace Rdmp.Core.CommandExecution.AtomicCommands;
18

19
public class ExecuteCommandMakeProjectSpecificCatalogueNormalAgain : BasicCommandExecution, IAtomicCommand
20
{
21
    private Catalogue _catalogue;
22
    private List<ExtractableDataSet> _extractableDataSets;
23
    private ExtractableDataSet _extractableDataSet;
24
    private Project _selectedProj;
25

26
    public ExecuteCommandMakeProjectSpecificCatalogueNormalAgain(IBasicActivateItems activator, Catalogue catalogue, ExtractableDataSet eds) :
27
        base(activator)
7✔
28
    {
29
        _catalogue = catalogue;
7✔
30
        _extractableDataSet = eds;
7✔
31

32

33
        var dataExportRepository = BasicActivator.RepositoryLocator.DataExportRepository;
7✔
34
        if (dataExportRepository == null)
7!
35
        {
36
            SetImpossible("Data Export functionality is not available");
×
37
            return;
×
38
        }
39
    }
7✔
40

41
    public override string GetCommandHelp() =>
NEW
42
        "Take a dataset that was previously only usable with extractions of a specific project and make it free for use in any extraction project";
×
43

44
    public override void Execute()
45
    {
46
        var dataExportRepository = BasicActivator.RepositoryLocator.DataExportRepository;
6✔
47

48
        base.Execute();
6✔
49
        _extractableDataSets = dataExportRepository.GetAllObjectsWithParent<ExtractableDataSet>(_catalogue).Where(eds => eds.Projects.Any() && eds.Projects.Select(p => ProjectSpecificCatalogueManager.CanMakeCatalogueNonProjectSpecific(dataExportRepository, _catalogue, eds, p)).Contains(true)).ToList();
19!
50
        if (!_extractableDataSets.Any())
6!
51
        {
52
            SetImpossible("Cannot make Catalogue Non-Project specific");
×
53
            return;
×
54
        }
55

56

57

58
        if (_extractableDataSet is null)
6!
59
        {
60

NEW
61
            var projectIds = _extractableDataSets.SelectMany(eds => eds.Projects.Where(p => ProjectSpecificCatalogueManager.CanMakeCatalogueNonProjectSpecific(dataExportRepository,_catalogue, eds,p))).Select(p => p.ID);
×
62
            _selectedProj = SelectOne<Project>(BasicActivator.RepositoryLocator.DataExportRepository.GetAllObjectsInIDList<Project>(projectIds).ToList());
×
63
            if (_selectedProj is null) return;
×
64
            _extractableDataSet = _extractableDataSets.FirstOrDefault(eds => eds.Projects.Select(p => p.ID).Contains(_selectedProj.ID));
×
65
        }
66
        if (_extractableDataSet == null)
6!
67
        {
68
            return;
×
69
        }
70

71
        if (!_extractableDataSet.Projects.Any())
6!
72
        {
73
            SetImpossible("Catalogue is not a project specific Catalogue");
×
74
            return;
×
75
        }
76

77
        ProjectSpecificCatalogueManager.MakeCatalogueNonProjectSpecific(BasicActivator.RepositoryLocator.DataExportRepository, _catalogue, _extractableDataSet,_selectedProj);
6✔
78

79
        Publish(_catalogue);
6✔
80
    }
6✔
81

82
    public override Image<Rgba32> GetImage(IIconProvider iconProvider) =>
83
        Image.Load<Rgba32>(CatalogueIcons.MakeProjectSpecificCatalogueNormalAgain);
×
84
}
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