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

HicServices / RDMP / 26566925905

28 May 2026 09:37AM UTC coverage: 57.023% (-0.08%) from 57.101%
26566925905

push

github

JFriel
Merge branch 'bugfix/cohort-commit-issue' of https://github.com/HicServices/RDMP into bugfix/cohort-commit-issue

11562 of 21813 branches covered (53.01%)

Branch coverage included in aggregate %.

32688 of 55787 relevant lines covered (58.59%)

18057.84 hits per line

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

0.0
/Rdmp.Core/DataViewing/ViewSelectedDatasetExtractionUICollection.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;
8
using System.Collections.Generic;
9
using System.Linq;
10
using FAnsi.Discovery.QuerySyntax;
11
using Rdmp.Core.Curation.Data;
12
using Rdmp.Core.Curation.Data.Dashboarding;
13
using Rdmp.Core.DataExport.Data;
14
using Rdmp.Core.DataExport.DataExtraction.Commands;
15
using Rdmp.Core.DataExport.DataExtraction.UserPicks;
16
using Rdmp.Core.ReusableLibraryCode.DataAccess;
17

18
namespace Rdmp.Core.DataViewing;
19

20
internal class ViewSelectedDatasetExtractionUICollection : PersistableObjectCollection, IViewSQLAndResultsCollection
21
{
22
    private ExtractDatasetCommand _request;
23

24
    private ISelectedDataSets SelectedDataset => DatabaseObjects.OfType<ISelectedDataSets>().FirstOrDefault();
×
25
    public bool DisableRun => false;
×
26

27
    public ViewSelectedDatasetExtractionUICollection()
×
28
    {
29
    }
×
30

31
    public ViewSelectedDatasetExtractionUICollection(ISelectedDataSets dataset) : this()
×
32
    {
33
        DatabaseObjects.Add(dataset);
×
34
    }
×
35

36
    public string GetSql()
37
    {
38
        BuildRequest();
×
39

40
        //get the SQL from the query builder
41
        return _request.QueryBuilder.SQL;
×
42
    }
43

44
    private void BuildRequest()
45
    {
46
        if (_request != null)
×
47
            return;
×
48

49
        var ec = SelectedDataset.ExtractionConfiguration;
×
50

51
        if (ec.Cohort_ID == null)
×
52
            throw new Exception("No cohort has been defined for this ExtractionConfiguration");
×
53

54
        //We are generating what the extraction SQL will be like, that only requires the dataset so empty bundle is fine
55
        _request = new ExtractDatasetCommand(ec, new ExtractableDatasetBundle(SelectedDataset.ExtractableDataSet));
×
56
        _request.GenerateQueryBuilder();
×
57
        _request.QueryBuilder.RegenerateSQL();
×
58
    }
×
59

60
    public IDataAccessPoint GetDataAccessPoint()
61
    {
62
        BuildRequest();
×
63

64
        return _request?.QueryBuilder?.TablesUsedInQuery?.FirstOrDefault();
×
65
    }
66

67
    public IEnumerable<DatabaseEntity> GetToolStripObjects()
68
    {
69
        yield return (DatabaseEntity)SelectedDataset;
×
70
    }
×
71

72
    public string GetTabName() => $"Extract {SelectedDataset}";
×
73

74
    public void AdjustAutocomplete(IAutoCompleteProvider autoComplete)
75
    {
76
    }
×
77

78
    public IQuerySyntaxHelper GetQuerySyntaxHelper()
79
    {
80
        BuildRequest();
×
81

82
        return _request.QueryBuilder.QuerySyntaxHelper;
×
83
    }
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