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

HicServices / RDMP / 6237307473

19 Sep 2023 04:02PM UTC coverage: 57.015% (-0.4%) from 57.44%
6237307473

push

github

web-flow
Feature/rc4 (#1570)

* Syntax tidying
* Dependency updates
* Event handling singletons (ThrowImmediately and co)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: James A Sutherland <>
Co-authored-by: James Friel <jfriel001@dundee.ac.uk>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

10734 of 20259 branches covered (0.0%)

Branch coverage included in aggregate %.

5922 of 5922 new or added lines in 565 files covered. (100.0%)

30687 of 52390 relevant lines covered (58.57%)

7361.8 hits per line

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

0.0
/Rdmp.Core/DataViewing/ViewTableInfoExtractUICollection.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.Curation.Data.Spontaneous;
14
using Rdmp.Core.QueryBuilding;
15
using Rdmp.Core.Repositories;
16
using Rdmp.Core.ReusableLibraryCode.DataAccess;
17

18
namespace Rdmp.Core.DataViewing;
19

20
/// <summary>
21
/// Builds a query to fetch data from a <see cref="TableInfo"/>
22
/// </summary>
23
public class ViewTableInfoExtractUICollection : PersistableObjectCollection, IViewSQLAndResultsCollection
24
{
25
    public ViewType ViewType { get; private set; }
×
26

27
    /// <summary>
28
    /// for persistence, do not use
29
    /// </summary>
30
    public ViewTableInfoExtractUICollection()
×
31
    {
32
    }
×
33

34
    public ViewTableInfoExtractUICollection(ITableInfo t, ViewType viewType, IFilter filter = null)
35
        : this()
×
36
    {
37
        DatabaseObjects.Add(t);
×
38

39
        if (filter != null)
×
40
            DatabaseObjects.Add(filter);
×
41
        ViewType = viewType;
×
42
    }
×
43

44
    public override string SaveExtraText() => PersistStringHelper.SaveDictionaryToString(new Dictionary<string, string>
×
45
        { { "ViewType", ViewType.ToString() } });
×
46

47
    public override void LoadExtraText(string s)
48
    {
49
        var value = PersistStringHelper.GetValueIfExistsFromPersistString("ViewType", s);
×
50
        ViewType = (ViewType)Enum.Parse(typeof(ViewType), value);
×
51
    }
×
52

53
    public object GetDataObject()
54
    {
55
        return DatabaseObjects.Single(o => o is ColumnInfo or Curation.Data.TableInfo);
×
56
    }
57

58
    public IFilter GetFilterIfAny()
59
    {
60
        return (IFilter)DatabaseObjects.SingleOrDefault(o => o is IFilter);
×
61
    }
62

63
    public IEnumerable<DatabaseEntity> GetToolStripObjects()
64
    {
65
        if (GetFilterIfAny() is ConcreteFilter filter)
×
66
            yield return filter;
×
67
    }
×
68

69
    public IDataAccessPoint GetDataAccessPoint() => TableInfo;
×
70

71
    public string GetSql()
72
    {
73
        var qb = new QueryBuilder(null, null);
×
74

75
        if (ViewType == ViewType.TOP_100)
×
76
            qb.TopX = 100;
×
77

78
        var memoryRepository = new MemoryCatalogueRepository();
×
79

80
        qb.AddColumnRange(TableInfo.ColumnInfos.Select(c => new ColumnInfoToIColumn(memoryRepository, c)).ToArray());
×
81

82
        var filter = GetFilterIfAny();
×
83
        if (filter != null)
×
84
            qb.RootFilterContainer = new SpontaneouslyInventedFilterContainer(memoryRepository, null, new[] { filter },
×
85
                FilterContainerOperation.AND);
×
86

87
        var sql = qb.SQL;
×
88

89
        return ViewType == ViewType.Aggregate
×
90
            ? throw new NotSupportedException("ViewType.Aggregate can only be applied to ColumnInfos not TableInfos")
×
91
            : sql;
×
92
    }
93

94
    public string GetTabName() => $"{TableInfo}({ViewType})";
×
95

96
    public void AdjustAutocomplete(IAutoCompleteProvider autoComplete)
97
    {
98
        autoComplete.Add(TableInfo);
×
99
    }
×
100

101
    public TableInfo TableInfo => DatabaseObjects.OfType<TableInfo>().SingleOrDefault();
×
102

103
    public IQuerySyntaxHelper GetQuerySyntaxHelper()
104
    {
105
        var t = TableInfo;
×
106
        return t?.GetQuerySyntaxHelper();
×
107
    }
108
}
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