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

HicServices / RDMP / 7164468116

11 Dec 2023 07:57AM UTC coverage: 56.776% (-0.02%) from 56.794%
7164468116

push

github

web-flow
Implement first pass at platform export tool (#1672)

* Implement first pass at platform export tool

* Remove dead code, add progress report

* Syntax fix

* Note command addition in CHANGELOG

* ignore certain dqe types

---------

Co-authored-by: James A Sutherland <>
Co-authored-by: James Friel <JFriel001@dundee.ac.uk>

10722 of 20351 branches covered (0.0%)

Branch coverage included in aggregate %.

0 of 17 new or added lines in 1 file covered. (0.0%)

30650 of 52518 relevant lines covered (58.36%)

14595.16 hits per line

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

0.0
/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandExportDatabaseToDir.cs
1
// Copyright (c) The University of Dundee 2018-2023
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.IO;
10
using System.Linq;
11
using System.Linq.Expressions;
12
using Rdmp.Core.Curation.Data;
13
using Rdmp.Core.Repositories;
14

15
namespace Rdmp.Core.CommandExecution.AtomicCommands;
16

17
// Dump all compatible objects from the current platform database(s) into a
18
// YAML/JSON directory for SQL-free operation.
19
public class ExecuteCommandExportDatabaseToDir : BasicCommandExecution
20
{
21
    private readonly IBasicActivateItems _activator;
22
    private readonly DirectoryInfo _target;
23

NEW
24
    public ExecuteCommandExportDatabaseToDir(IBasicActivateItems activator, [DemandsInitialization("Where the platform directory should be created")] string target)
×
25
    {
NEW
26
        _target = new DirectoryInfo(target);
×
NEW
27
        _activator = activator;
×
NEW
28
    }
×
29

NEW
30
    private readonly List<string> ignoreList = new() { "Rdmp.Core.DataQualityEngine.Data.DQEGraphAnnotation", "Rdmp.Core.DataQualityEngine.Data.Evaluation" };
×
31

32
    public override void Execute()
33
    {
NEW
34
        base.Execute();
×
NEW
35
        var repo = new YamlRepository(_target);
×
NEW
36
        foreach (var t in repo.GetCompatibleTypes())
×
37
        {
NEW
38
            if (ignoreList.Contains(t.FullName)) continue;
×
39
            try
40
            {
NEW
41
                Console.WriteLine(t.FullName);
×
NEW
42
                foreach (var o in _activator.GetRepositoryFor(t).GetAllObjects(t))
×
NEW
43
                    repo.SaveToDatabase(o);
×
NEW
44
            }
×
NEW
45
            catch(Exception)
×
46
            {
NEW
47
                Console.WriteLine($"Unable to find repo for {t.FullName}");
×
NEW
48
            }
×
49

50
        }
NEW
51
    }
×
52
}
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