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

HicServices / RDMP / 9988359965

18 Jul 2024 08:42AM UTC coverage: 57.299% (+0.6%) from 56.679%
9988359965

push

github

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

11072 of 20790 branches covered (53.26%)

Branch coverage included in aggregate %.

31313 of 53181 relevant lines covered (58.88%)

7885.96 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 Rdmp.Core.Curation.Data;
11
using Rdmp.Core.Repositories;
12

13
namespace Rdmp.Core.CommandExecution.AtomicCommands;
14

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

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

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

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

48
        }
49
    }
×
50
}
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