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

HicServices / RDMP / 6245535001

20 Sep 2023 07:44AM UTC coverage: 57.013%. First build
6245535001

push

github

web-flow
8.1.0 Release (#1628)

* Bump Newtonsoft.Json from 13.0.1 to 13.0.2

Bumps [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) from 13.0.1 to 13.0.2.
- [Release notes](https://github.com/JamesNK/Newtonsoft.Json/releases)
- [Commits](https://github.com/JamesNK/Newtonsoft.Json/compare/13.0.1...13.0.2)

---
updated-dependencies:
- dependency-name: Newtonsoft.Json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump NLog from 5.0.5 to 5.1.0

Bumps [NLog](https://github.com/NLog/NLog) from 5.0.5 to 5.1.0.
- [Release notes](https://github.com/NLog/NLog/releases)
- [Changelog](https://github.com/NLog/NLog/blob/dev/CHANGELOG.md)
- [Commits](https://github.com/NLog/NLog/compare/v5.0.5...v5.1.0)

---
updated-dependencies:
- dependency-name: NLog
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump NLog from 5.0.5 to 5.1.0

* Fix -r flag - should have been --results-directory all along

* Bump Newtonsoft.Json from 13.0.1 to 13.0.2

* Bump YamlDotNet from 12.0.2 to 12.1.0

Bumps [YamlDotNet](https://github.com/aaubry/YamlDotNet) from 12.0.2 to 12.1.0.
- [Release notes](https://github.com/aaubry/YamlDotNet/releases)
- [Commits](https://github.com/aaubry/YamlDotNet/compare/v12.0.2...v12.1.0)

---
updated-dependencies:
- dependency-name: YamlDotNet
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump Moq from 4.18.2 to 4.18.3

Bumps [Moq](https://github.com/moq/moq4) from 4.18.2 to 4.18.3.
- [Release notes](https://github.com/moq/moq4/releases)
- [Changelog](https://github.com/moq/moq4/blob/main/CHANGELOG.md)
- [Commits](https://github.com/moq/moq4/compare/v4.18.2...v4.18.3)

---
updated-dependencies:
- dependency-name: Moq
... (continued)

10732 of 20257 branches covered (0.0%)

Branch coverage included in aggregate %.

48141 of 48141 new or added lines in 1086 files covered. (100.0%)

30685 of 52388 relevant lines covered (58.57%)

7387.88 hits per line

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

80.49
/Rdmp.Core/Curation/Data/ExtractionFilterParameterSetValue.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.Data.Common;
10
using FAnsi.Discovery.QuerySyntax;
11
using Rdmp.Core.MapsDirectlyToDatabaseTable;
12
using Rdmp.Core.MapsDirectlyToDatabaseTable.Attributes;
13
using Rdmp.Core.MapsDirectlyToDatabaseTable.Injection;
14
using Rdmp.Core.QueryBuilding.SyntaxChecking;
15
using Rdmp.Core.Repositories;
16
using Rdmp.Core.ReusableLibraryCode.Checks;
17

18
namespace Rdmp.Core.Curation.Data;
19

20
/// <summary>
21
/// Stores a known specific useful value for a given ExtractionFilterParameter.  See <see cref="Data.ExtractionFilterParameterSet"/> for a use case for this.
22
/// </summary>
23
public class ExtractionFilterParameterSetValue : DatabaseEntity, ISqlParameter, IInjectKnown<ExtractionFilterParameter>
24
{
25
    #region Database Properties
26

27
    private string _value;
28
    private int _extractionFilterParameterSetID;
29
    private int _extractionFilterParameterID;
30

31
    /// <summary>
32
    /// The 'known good paramter set' (<see cref="ExtractionFilterParameterSet"/>) to which this parameter value belongs
33
    /// </summary>
34
    public int ExtractionFilterParameterSet_ID
35
    {
36
        get => _extractionFilterParameterSetID;
38✔
37
        set => SetField(ref _extractionFilterParameterSetID, value);
30✔
38
    }
39

40
    /// <summary>
41
    /// The specific parameter that this object is providing a 'known value' for in the parent <see cref="ExtractionFilter"/> e.g. @DrugList='123.2,123.2,... etc'.
42
    /// </summary>
43
    public int ExtractionFilterParameter_ID
44
    {
45
        get => _extractionFilterParameterID;
16✔
46
        set => SetField(ref _extractionFilterParameterID, value);
30✔
47
    }
48

49
    /// <inheritdoc/>
50
    [Sql]
51
    public string Value
52
    {
53
        get => _value;
22✔
54
        set => SetField(ref _value, value);
16✔
55
    }
56

57
    #endregion
58

59
    #region cached values stored so we can act like a readonly ISqlParameter but secretly only Value will actually be changeable
60

61
    private Lazy<ExtractionFilterParameter> _knownExtractionFilterParameter;
62

63
    /// <inheritdoc/>
64
    /// <remarks>Readonly, fetched from associated <see cref="ExtractionFilterParameter_ID"/></remarks>
65
    [NoMappingToDatabase]
66
    public string ParameterName => _knownExtractionFilterParameter.Value.ParameterName;
16✔
67

68
    /// <inheritdoc/>
69
    /// <remarks>Readonly, fetched from associated <see cref="ExtractionFilterParameter_ID"/></remarks>
70
    [Sql]
71
    [NoMappingToDatabase]
72
    public string ParameterSQL
73
    {
74
        get => _knownExtractionFilterParameter.Value.ParameterSQL;
10✔
75
        set { }
×
76
    }
77

78
    /// <inheritdoc/>
79
    /// <remarks>Readonly, fetched from associated <see cref="ExtractionFilterParameter_ID"/></remarks>
80
    [NoMappingToDatabase]
81
    public string Comment
82
    {
83
        get => _knownExtractionFilterParameter.Value.Comment;
10✔
84
        set { }
×
85
    }
86

87
    /// <summary>
88
    /// Returns the <see cref="ExtractionFilterParameterSet"/> this known good value belongs to
89
    /// </summary>
90
    /// <returns></returns>
91
    public IMapsDirectlyToDatabaseTable GetOwnerIfAny() => ExtractionFilterParameterSet;
8✔
92

93
    #endregion
94

95
    #region Relationships
96

97
    /// <inheritdoc cref="ExtractionFilterParameterSet_ID"/>
98
    [NoMappingToDatabase]
99
    public ExtractionFilterParameterSet ExtractionFilterParameterSet =>
100
        Repository.GetObjectByID<ExtractionFilterParameterSet>(ExtractionFilterParameterSet_ID);
18✔
101

102
    /// <inheritdoc cref="ExtractionFilterParameter_ID"/>
103
    [NoMappingToDatabase]
104
    public ExtractionFilterParameter ExtractionFilterParameter => _knownExtractionFilterParameter.Value;
2✔
105

106
    #endregion
107

108

109
    public ExtractionFilterParameterSetValue()
×
110
    {
111
        ClearAllInjections();
×
112
    }
×
113

114
    internal ExtractionFilterParameterSetValue(ICatalogueRepository repository, DbDataReader r)
115
        : base(repository, r)
8✔
116
    {
117
        ExtractionFilterParameterSet_ID = Convert.ToInt32(r["ExtractionFilterParameterSet_ID"]);
8✔
118
        ExtractionFilterParameter_ID = Convert.ToInt32(r["ExtractionFilterParameter_ID"]);
8✔
119
        Value = r["Value"] as string;
8✔
120

121
        ClearAllInjections();
8✔
122
    }
8✔
123

124
    /// <summary>
125
    /// Creates a record of what value to use with the given <see cref="ISqlParameter"/> of the <see cref="ExtractionFilterParameterSet"/> <see cref="IFilter"/> to achieve the concept.
126
    /// 
127
    /// <para>For example if there is an <see cref="ExtractionFilter"/> 'Prescribed Drug X' with a parameter @DrugList and you create an <see cref="ExtractionFilterParameterSet"/>
128
    /// 'Diabetic Drugs' then this will create a <see cref="ExtractionFilterParameterSetValue"/> of '@DrugList='123.23,121,2... etc'.</para>
129
    /// 
130
    /// <para>If a filter has more than one parameter then you will need one <see cref="ExtractionFilterParameterSetValue"/> per parameter per <see cref="ExtractionFilterParameterSet"/></para>
131
    /// </summary>
132
    /// <param name="repository"></param>
133
    /// <param name="parent"></param>
134
    /// <param name="valueIsForParameter"></param>
135
    public ExtractionFilterParameterSetValue(ICatalogueRepository repository, ExtractionFilterParameterSet parent,
22✔
136
        ExtractionFilterParameter valueIsForParameter)
22✔
137
    {
138
        repository.InsertAndHydrate(this, new Dictionary<string, object>
22✔
139
        {
22✔
140
            { "ExtractionFilterParameterSet_ID", parent.ID },
22✔
141
            { "ExtractionFilterParameter_ID", valueIsForParameter.ID }
22✔
142
        });
22✔
143

144
        ClearAllInjections();
22✔
145
    }
22✔
146

147
    /// <inheritdoc/>
148
    public IQuerySyntaxHelper GetQuerySyntaxHelper() => ExtractionFilterParameter.GetQuerySyntaxHelper();
×
149

150
    /// <inheritdoc/>
151
    public void Check(ICheckNotifier notifier)
152
    {
153
        new ParameterSyntaxChecker(this).Check(notifier);
×
154
    }
×
155

156
    public override string ToString() => $"{ParameterName} = {Value}";
4✔
157

158
    public void InjectKnown(ExtractionFilterParameter instance)
159
    {
160
        _knownExtractionFilterParameter = new Lazy<ExtractionFilterParameter>(instance);
4✔
161
    }
4✔
162

163
    public void ClearAllInjections()
164
    {
165
        _knownExtractionFilterParameter = new Lazy<ExtractionFilterParameter>(() =>
30✔
166
            Repository.GetObjectByID<ExtractionFilterParameter>(ExtractionFilterParameter_ID));
36✔
167
    }
30✔
168
}
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