• 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

0.0
/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandAddNewRegexRedactionConfiguration.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.Icons.IconProvision;
8
using Rdmp.Core.ReusableLibraryCode.Icons.IconProvision;
9
using SixLabors.ImageSharp.PixelFormats;
10
using SixLabors.ImageSharp;
11
using Rdmp.Core.Curation.DataHelper.RegexRedaction;
12
using System.Text.RegularExpressions;
13
using Rdmp.Core.Curation.Data;
14

15
namespace Rdmp.Core.CommandExecution.AtomicCommands;
16

17
public class ExecuteCommandAddNewRegexRedactionConfiguration : BasicCommandExecution, IAtomicCommand
18
{
19

20
    private readonly string _name;
21
    private readonly string _redactionPattern;
22
    private readonly string _redactionString;
23
    private readonly string _description;
24
    private readonly IBasicActivateItems _activator;
25

26

NEW
27
    public ExecuteCommandAddNewRegexRedactionConfiguration(IBasicActivateItems activator, [DemandsInitialization("Name")] string name, [DemandsInitialization("Redaction Pattern")] string redactionPattern, [DemandsInitialization("Replacement String")] string redactionString, string description = null) : base(activator)
×
28
    {
NEW
29
        _activator = activator;
×
NEW
30
        _name = name;
×
NEW
31
        _redactionPattern = redactionPattern;
×
NEW
32
        _redactionString = redactionString;
×
NEW
33
        _description = description;
×
NEW
34
    }
×
35

36
    public override void Execute()
37
    {
NEW
38
        base.Execute();
×
NEW
39
        var config = new RegexRedactionConfiguration(_activator.RepositoryLocator.CatalogueRepository, _name, new Regex(_redactionPattern), _redactionString, _description);
×
NEW
40
        config.SaveToDatabase();
×
NEW
41
        _activator.Publish(config);
×
NEW
42
    }
×
43

44
    public override Image<Rgba32> GetImage(IIconProvider iconProvider) =>
NEW
45
      iconProvider.GetImage(RDMPConcept.RegexRedaction, OverlayKind.Add);
×
46
}
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