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

HicServices / RDMP / 12136273647

03 Dec 2024 09:03AM UTC coverage: 57.448% (+0.07%) from 57.382%
12136273647

push

github

JFriel
Merge branch 'develop' of https://github.com/HicServices/RDMP

11297 of 21215 branches covered (53.25%)

Branch coverage included in aggregate %.

439 of 673 new or added lines in 30 files covered. (65.23%)

5 existing lines in 4 files now uncovered.

32146 of 54407 relevant lines covered (59.08%)

17095.94 hits per line

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

87.88
/Rdmp.Core/Curation/DataHelper/RegexRedaction/RegexRedaction.cs
1
// Copyright (c) The University of Dundee 2024-2024
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 Rdmp.Core.Curation.Data;
8
using Rdmp.Core.MapsDirectlyToDatabaseTable;
9
using Rdmp.Core.MapsDirectlyToDatabaseTable.Attributes;
10
using Rdmp.Core.Repositories;
11
using Rdmp.Core.ReusableLibraryCode.Annotations;
12
using System;
13
using System.Collections.Generic;
14
using System.Data.Common;
15

16
namespace Rdmp.Core.Curation.DataHelper.RegexRedaction;
17

18

19
/// <summary>
20
/// Stores a redaction
21
/// </summary>
22
public class RegexRedaction : DatabaseEntity, IRegexRedaction
23

24
{
25
    private int _redactionConfigurationID;
26
    private int _startingIndex;
27
    private string _redactedValue;
28
    private string _replacementValue;
29
    private int _columnInfoID;
30

31
    #region Database Properties
32

33
    public int RedactionConfiguration_ID
34
    {
35
        get => _redactionConfigurationID;
8✔
36
        set => SetField(ref _redactionConfigurationID, value);
16✔
37
    }
38

39
    [UsefulProperty]
40
    [NotNull]
41
    public string RedactedValue
42
    {
43
        get => _redactedValue;
20✔
44
        set => SetField(ref _redactedValue, value.ToString());
16✔
45
    }
46

47
    [UsefulProperty]
48
    [NotNull]
49
    public string ReplacementValue
50
    {
51
        get => _replacementValue;
40✔
52
        set => SetField(ref _replacementValue, value.ToString());
16✔
53
    }
54

55
    [NotNull]
56
    public int StartingIndex
57
    {
58
        get => _startingIndex;
58✔
59
        set => SetField(ref _startingIndex, value);
16✔
60
    }
61

62
    public int ColumnInfo_ID
63
    {
64
        get => _columnInfoID;
14✔
65
        set => SetField(ref _columnInfoID, value);
16✔
66
    }
67
    #endregion
68

69
    #region Relationships
70
    [NoMappingToDatabase]
71
    public List<RegexRedactionKey> RedactionKeys => [.. CatalogueRepository.GetAllObjectsWhere<RegexRedactionKey>("RegexRedaction_ID", this.ID)];
22✔
72
    #endregion
73

74

NEW
75
    public RegexRedaction() { }
×
76

77
    public RegexRedaction(ICatalogueRepository repository, int redactionConfigurationID, int startingIndex, string redactionValue, string replacementValue, int columnInfoID, Dictionary<ColumnInfo,string> pkValues)
16✔
78
    {
79
        repository.InsertAndHydrate(this, new Dictionary<string, object> {
16✔
80
            {"RedactionConfiguration_ID",redactionConfigurationID},
16✔
81
            {"StartingIndex",startingIndex},
16✔
82
            {"RedactedValue", redactionValue },
16✔
83
            {"ReplacementValue", replacementValue },
16✔
84
            {"ColumnInfo_ID", columnInfoID }
16✔
85
        });
16✔
86
        foreach (var tuple in pkValues)
32!
87
        {
NEW
88
            var key = new RegexRedactionKey(repository, this, tuple.Key, tuple.Value);
×
NEW
89
            key.SaveToDatabase();
×
90
        }
91
    }
16✔
92

93
    internal RegexRedaction(ICatalogueRepository repository, DbDataReader r) : base(repository, r)
24✔
94
    {
95
        _redactionConfigurationID = Int32.Parse(r["RedactionConfiguration_ID"].ToString());
24✔
96
        _startingIndex = Int32.Parse(r["StartingIndex"].ToString());
24✔
97
        _replacementValue = r["ReplacementValue"].ToString();
24✔
98
        _redactedValue = r["RedactedValue"].ToString();
24✔
99
        _columnInfoID = Int32.Parse(r["ColumnInfo_ID"].ToString());
24✔
100
    }
24✔
101
}
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