Mercurial > hg > orthanc
annotate OrthancServer/Sources/ServerToolbox.h @ 5464:38f1d06875ad pg-transactions
delete attachment in case of same instance being uploaded multiple times at the same time
author | Alain Mazy <am@osimis.io> |
---|---|
date | Tue, 12 Dec 2023 17:20:10 +0100 |
parents | 72dfa0ac84eb |
children | 48b8dae6dc77 |
rev | line source |
---|---|
213
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
5185
0ea402b4d901
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4988
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
0ea402b4d901
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4988
diff
changeset
|
6 * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
213
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * |
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * This program is free software: you can redistribute it and/or |
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * modify it under the terms of the GNU General Public License as |
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * published by the Free Software Foundation, either version 3 of the |
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * License, or (at your option) any later version. |
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * |
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, but |
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * General Public License for more details. |
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * |
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 **/ |
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 #pragma once |
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
25 #include "Database/IDatabaseWrapper.h" |
3083
683d572424b6
IDatabaseWrapper::SetResourcesContent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
26 #include "ServerEnumerations.h" |
730
309e686b41e7
better logging about nonexistent tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
27 |
3083
683d572424b6
IDatabaseWrapper::SetResourcesContent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
28 #include <boost/noncopyable.hpp> |
683d572424b6
IDatabaseWrapper::SetResourcesContent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
29 #include <list> |
213
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 |
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 namespace Orthanc |
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 { |
3083
683d572424b6
IDatabaseWrapper::SetResourcesContent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
33 class ServerContext; |
683d572424b6
IDatabaseWrapper::SetResourcesContent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
34 class IStorageArea; |
683d572424b6
IDatabaseWrapper::SetResourcesContent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
35 |
2120 | 36 namespace ServerToolbox |
1668
de1413733c97
reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
37 { |
de1413733c97
reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
38 bool FindOneChildInstance(int64_t& result, |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
39 IDatabaseWrapper::ITransaction& transaction, |
1668
de1413733c97
reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
40 int64_t resource, |
de1413733c97
reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
41 ResourceType type); |
de1413733c97
reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
42 |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
43 void ReconstructMainDicomTags(IDatabaseWrapper::ITransaction& transaction, |
1668
de1413733c97
reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
44 IStorageArea& storageArea, |
de1413733c97
reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
45 ResourceType level); |
2121 | 46 |
47 void LoadIdentifiers(const DicomTag*& tags, | |
48 size_t& size, | |
49 ResourceType level); | |
50 | |
51 bool IsIdentifier(const DicomTag& tag, | |
52 ResourceType level); | |
53 | |
54 std::string NormalizeIdentifier(const std::string& value); | |
2209
e3fd5bc429a2
URI to reconstruct the main DICOM tags, the JSON summary and the metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2123
diff
changeset
|
55 |
e3fd5bc429a2
URI to reconstruct the main DICOM tags, the JSON summary and the metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2123
diff
changeset
|
56 void ReconstructResource(ServerContext& context, |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
57 const std::string& resource, |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
58 bool reconstructFiles); |
5244
72dfa0ac84eb
lookup for labels in orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
59 |
72dfa0ac84eb
lookup for labels in orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
60 bool IsValidLabel(const std::string& label); |
72dfa0ac84eb
lookup for labels in orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
61 |
72dfa0ac84eb
lookup for labels in orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
62 void CheckValidLabel(const std::string& label); |
1668
de1413733c97
reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
63 } |
213
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 } |