Mercurial > hg > orthanc
annotate OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp @ 5853:4d932683049d get-scu tip
very first implementation of C-Get SCU
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Tue, 29 Oct 2024 17:25:49 +0100 |
parents | 68fc5af30c03 |
children | 77875b51cf95 8279eaab0d1d |
rev | line source |
---|---|
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
5640
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5519
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5519
diff
changeset
|
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
5485
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5249
diff
changeset
|
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * This program is free software: you can redistribute it and/or |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * modify it under the terms of the GNU General Public License as |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * published by the Free Software Foundation, either version 3 of the |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * License, or (at your option) any later version. |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * This program is distributed in the hope that it will be useful, but |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * WITHOUT ANY WARRANTY; without even the implied warranty of |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * General Public License for more details. |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * You should have received a copy of the GNU General Public License |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 **/ |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #include "../../Sources/PrecompiledHeadersServer.h" |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 #include "OrthancPluginDatabaseV3.h" |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 #if ORTHANC_ENABLE_PLUGINS != 1 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 # error The plugin support is disabled |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 #endif |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 #include "../../../OrthancFramework/Sources/Logging.h" |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 #include "../../../OrthancFramework/Sources/OrthancException.h" |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
33 #include "../../Sources/Database/ResourcesContent.h" |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 #include "../../Sources/Database/VoidDatabaseListener.h" |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 #include "PluginsEnumerations.h" |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 #include <cassert> |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 |
4601
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
39 |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
40 #define CHECK_FUNCTION_EXISTS(backend, func) \ |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
41 if (backend.func == NULL) \ |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
42 { \ |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
43 throw OrthancException( \ |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
44 ErrorCode_DatabasePlugin, "Missing primitive: " #func "()"); \ |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
45 } |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
46 |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 namespace Orthanc |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 { |
5455
176bc05f85f4
DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents:
5249
diff
changeset
|
49 class OrthancPluginDatabaseV3::Transaction : public BaseDatabaseWrapper::BaseTransaction |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 private: |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 OrthancPluginDatabaseV3& that_; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 IDatabaseListener& listener_; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 OrthancPluginDatabaseTransaction* transaction_; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 void CheckSuccess(OrthancPluginErrorCode code) const |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 that_.CheckSuccess(code); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
63 static FileInfo Convert(const OrthancPluginAttachment& attachment) |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
64 { |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
65 return FileInfo(attachment.uuid, |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
66 static_cast<FileContentType>(attachment.contentType), |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
67 attachment.uncompressedSize, |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
68 attachment.uncompressedHash, |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
69 static_cast<CompressionType>(attachment.compressionType), |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
70 attachment.compressedSize, |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
71 attachment.compressedHash); |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
72 } |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
73 |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
74 |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 void ReadStringAnswers(std::list<std::string>& target) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 target.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 for (uint32_t i = 0; i < count; i++) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 const char* value = NULL; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 CheckSuccess(that_.backend_.readAnswerString(transaction_, &value, i)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 if (value == NULL) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 throw OrthancException(ErrorCode_DatabasePlugin); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 else |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 target.push_back(value); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
96 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
97 bool ReadSingleStringAnswer(std::string& target) |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 if (count == 0) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
104 return false; |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
105 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
106 else if (count == 1) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
107 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 const char* value = NULL; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
109 CheckSuccess(that_.backend_.readAnswerString(transaction_, &value, 0)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
110 if (value == NULL) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
111 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
112 throw OrthancException(ErrorCode_DatabasePlugin); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
113 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
114 else |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
115 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
116 target.assign(value); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
117 return true; |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 else |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 throw OrthancException(ErrorCode_DatabasePlugin); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
124 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
125 |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
126 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
127 bool ReadSingleInt64Answer(int64_t& target) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
128 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
129 uint32_t count; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
130 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
131 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
132 if (count == 0) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
133 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
134 return false; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
135 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
136 else if (count == 1) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
137 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
138 CheckSuccess(that_.backend_.readAnswerInt64(transaction_, &target, 0)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
139 return true; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
140 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
141 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
142 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
143 throw OrthancException(ErrorCode_DatabasePlugin); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
144 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
145 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
146 |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
147 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
148 ExportedResource ReadAnswerExportedResource(uint32_t answerIndex) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
149 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
150 OrthancPluginExportedResource exported; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
151 CheckSuccess(that_.backend_.readAnswerExportedResource(transaction_, &exported, answerIndex)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
152 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
153 if (exported.publicId == NULL || |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
154 exported.modality == NULL || |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
155 exported.date == NULL || |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
156 exported.patientId == NULL || |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 exported.studyInstanceUid == NULL || |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
158 exported.seriesInstanceUid == NULL || |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
159 exported.sopInstanceUid == NULL) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
160 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
161 throw OrthancException(ErrorCode_DatabasePlugin); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
162 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
163 else |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
164 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
165 return ExportedResource(exported.seq, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
166 Plugins::Convert(exported.resourceType), |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
167 exported.publicId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
168 exported.modality, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
169 exported.date, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
170 exported.patientId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
171 exported.studyInstanceUid, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
172 exported.seriesInstanceUid, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
173 exported.sopInstanceUid); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
174 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
175 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
176 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
177 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
178 ServerIndexChange ReadAnswerChange(uint32_t answerIndex) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
179 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
180 OrthancPluginChange change; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
181 CheckSuccess(that_.backend_.readAnswerChange(transaction_, &change, answerIndex)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
182 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
183 if (change.publicId == NULL || |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
184 change.date == NULL) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
185 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
186 throw OrthancException(ErrorCode_DatabasePlugin); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
187 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
188 else |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
189 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
190 return ServerIndexChange(change.seq, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
191 static_cast<ChangeType>(change.changeType), |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
192 Plugins::Convert(change.resourceType), |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
193 change.publicId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
194 change.date); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
195 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
196 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
197 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
198 |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
199 void CheckNoEvent() |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
200 { |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
201 uint32_t count; |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
202 CheckSuccess(that_.backend_.readEventsCount(transaction_, &count)); |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
203 if (count != 0) |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
204 { |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
205 throw OrthancException(ErrorCode_DatabasePlugin); |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
206 } |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
207 } |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
208 |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
209 |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
210 void ProcessEvents(bool isDeletingAttachment) |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
211 { |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
212 uint32_t count; |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
213 CheckSuccess(that_.backend_.readEventsCount(transaction_, &count)); |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
214 |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
215 for (uint32_t i = 0; i < count; i++) |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
216 { |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
217 OrthancPluginDatabaseEvent event; |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
218 CheckSuccess(that_.backend_.readEvent(transaction_, &event, i)); |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
219 |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
220 switch (event.type) |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
221 { |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
222 case OrthancPluginDatabaseEventType_DeletedAttachment: |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
223 listener_.SignalAttachmentDeleted(Convert(event.content.attachment)); |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
224 break; |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
225 |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
226 case OrthancPluginDatabaseEventType_DeletedResource: |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
227 if (isDeletingAttachment) |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
228 { |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
229 // This event should only be triggered by "DeleteResource()" |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
230 throw OrthancException(ErrorCode_DatabasePlugin); |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
231 } |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
232 else |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
233 { |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
234 listener_.SignalResourceDeleted(Plugins::Convert(event.content.resource.level), event.content.resource.publicId); |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
235 } |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
236 break; |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
237 |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
238 case OrthancPluginDatabaseEventType_RemainingAncestor: |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
239 if (isDeletingAttachment) |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
240 { |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
241 // This event should only triggered by "DeleteResource()" |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
242 throw OrthancException(ErrorCode_DatabasePlugin); |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
243 } |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
244 else |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
245 { |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
246 listener_.SignalRemainingAncestor(Plugins::Convert(event.content.resource.level), event.content.resource.publicId); |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
247 } |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
248 break; |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
249 |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
250 default: |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
251 break; // Unhandled event |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
252 } |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
253 } |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
254 } |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
255 |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
256 |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
257 public: |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
258 Transaction(OrthancPluginDatabaseV3& that, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
259 IDatabaseListener& listener, |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
260 OrthancPluginDatabaseTransactionType type) : |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
261 that_(that), |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
262 listener_(listener) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
263 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
264 CheckSuccess(that.backend_.startTransaction(that.database_, &transaction_, type)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
265 if (transaction_ == NULL) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
266 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
267 throw OrthancException(ErrorCode_DatabasePlugin); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
268 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
269 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
270 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
271 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
272 virtual ~Transaction() |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
273 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
274 OrthancPluginErrorCode code = that_.backend_.destructTransaction(transaction_); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
275 if (code != OrthancPluginErrorCode_Success) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
276 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
277 // Don't throw exception in destructors |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
278 that_.errorDictionary_.LogError(code, true); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
279 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
280 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
281 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
282 virtual void Rollback() ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
283 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
284 CheckSuccess(that_.backend_.rollback(transaction_)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
285 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
286 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
287 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
288 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
289 virtual void Commit(int64_t fileSizeDelta) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
290 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
291 CheckSuccess(that_.backend_.commit(transaction_, fileSizeDelta)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
292 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
293 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
294 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
295 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
296 virtual void AddAttachment(int64_t id, |
4627
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
297 const FileInfo& attachment, |
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
298 int64_t revision) ORTHANC_OVERRIDE |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
299 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
300 OrthancPluginAttachment tmp; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
301 tmp.uuid = attachment.GetUuid().c_str(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
302 tmp.contentType = static_cast<int32_t>(attachment.GetContentType()); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
303 tmp.uncompressedSize = attachment.GetUncompressedSize(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
304 tmp.uncompressedHash = attachment.GetUncompressedMD5().c_str(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
305 tmp.compressionType = static_cast<int32_t>(attachment.GetCompressionType()); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
306 tmp.compressedSize = attachment.GetCompressedSize(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
307 tmp.compressedHash = attachment.GetCompressedMD5().c_str(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
308 |
4627
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
309 CheckSuccess(that_.backend_.addAttachment(transaction_, id, &tmp, revision)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
310 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
311 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
312 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
313 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
314 virtual void ClearChanges() ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
315 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
316 CheckSuccess(that_.backend_.clearChanges(transaction_)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
317 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
318 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
319 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
320 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
321 virtual void ClearExportedResources() ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
322 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
323 CheckSuccess(that_.backend_.clearExportedResources(transaction_)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
324 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
325 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
326 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
327 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
328 virtual void DeleteAttachment(int64_t id, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
329 FileContentType attachment) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
330 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
331 CheckSuccess(that_.backend_.deleteAttachment(transaction_, id, static_cast<int32_t>(attachment))); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
332 ProcessEvents(true); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
333 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
334 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
335 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
336 virtual void DeleteMetadata(int64_t id, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
337 MetadataType type) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
338 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
339 CheckSuccess(that_.backend_.deleteMetadata(transaction_, id, static_cast<int32_t>(type))); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
340 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
341 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
342 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
343 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
344 virtual void DeleteResource(int64_t id) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
345 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
346 CheckSuccess(that_.backend_.deleteResource(transaction_, id)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
347 ProcessEvents(false); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
348 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
349 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
350 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
351 virtual void GetAllMetadata(std::map<MetadataType, std::string>& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
352 int64_t id) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
353 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
354 CheckSuccess(that_.backend_.getAllMetadata(transaction_, id)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
355 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
356 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
357 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
358 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
359 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
360 target.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
361 for (uint32_t i = 0; i < count; i++) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
362 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
363 int32_t metadata; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
364 const char* value = NULL; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
365 CheckSuccess(that_.backend_.readAnswerMetadata(transaction_, &metadata, &value, i)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
366 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
367 if (value == NULL) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
368 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
369 throw OrthancException(ErrorCode_DatabasePlugin); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
370 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
371 else |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
372 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
373 target[static_cast<MetadataType>(metadata)] = value; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
374 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
375 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
376 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
377 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
378 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
379 virtual void GetAllPublicIds(std::list<std::string>& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
380 ResourceType resourceType) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
381 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
382 CheckSuccess(that_.backend_.getAllPublicIds(transaction_, Plugins::Convert(resourceType))); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
383 CheckNoEvent(); |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
384 |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
385 ReadStringAnswers(target); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
386 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
387 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
388 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
389 virtual void GetAllPublicIds(std::list<std::string>& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
390 ResourceType resourceType, |
5213
055428d92772
clarifying types of since/limit in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5193
diff
changeset
|
391 int64_t since, |
055428d92772
clarifying types of since/limit in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5193
diff
changeset
|
392 uint32_t limit) ORTHANC_OVERRIDE |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
393 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
394 CheckSuccess(that_.backend_.getAllPublicIdsWithLimit( |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
395 transaction_, Plugins::Convert(resourceType), |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
396 static_cast<uint64_t>(since), static_cast<uint64_t>(limit))); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
397 CheckNoEvent(); |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
398 |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
399 ReadStringAnswers(target); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
400 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
401 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
402 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
403 virtual void GetChanges(std::list<ServerIndexChange>& target /*out*/, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
404 bool& done /*out*/, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
405 int64_t since, |
5213
055428d92772
clarifying types of since/limit in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5193
diff
changeset
|
406 uint32_t limit) ORTHANC_OVERRIDE |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
407 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
408 uint8_t tmpDone = true; |
5213
055428d92772
clarifying types of since/limit in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5193
diff
changeset
|
409 CheckSuccess(that_.backend_.getChanges(transaction_, &tmpDone, since, limit)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
410 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
411 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
412 done = (tmpDone != 0); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
413 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
414 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
415 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
416 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
417 target.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
418 for (uint32_t i = 0; i < count; i++) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
419 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
420 target.push_back(ReadAnswerChange(i)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
421 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
422 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
423 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
424 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
425 virtual void GetChildrenInternalId(std::list<int64_t>& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
426 int64_t id) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
427 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
428 CheckSuccess(that_.backend_.getChildrenInternalId(transaction_, id)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
429 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
430 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
431 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
432 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
433 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
434 target.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
435 for (uint32_t i = 0; i < count; i++) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
436 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
437 int64_t value; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
438 CheckSuccess(that_.backend_.readAnswerInt64(transaction_, &value, i)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
439 target.push_back(value); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
440 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
441 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
442 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
443 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
444 virtual void GetChildrenPublicId(std::list<std::string>& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
445 int64_t id) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
446 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
447 CheckSuccess(that_.backend_.getChildrenPublicId(transaction_, id)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
448 CheckNoEvent(); |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
449 |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
450 ReadStringAnswers(target); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
451 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
452 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
453 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
454 virtual void GetExportedResources(std::list<ExportedResource>& target /*out*/, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
455 bool& done /*out*/, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
456 int64_t since, |
5213
055428d92772
clarifying types of since/limit in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5193
diff
changeset
|
457 uint32_t limit) ORTHANC_OVERRIDE |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
458 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
459 uint8_t tmpDone = true; |
5213
055428d92772
clarifying types of since/limit in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5193
diff
changeset
|
460 CheckSuccess(that_.backend_.getExportedResources(transaction_, &tmpDone, since, limit)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
461 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
462 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
463 done = (tmpDone != 0); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
464 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
465 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
466 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
467 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
468 target.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
469 for (uint32_t i = 0; i < count; i++) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
470 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
471 target.push_back(ReadAnswerExportedResource(i)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
472 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
473 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
474 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
475 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
476 virtual void GetLastChange(std::list<ServerIndexChange>& target /*out*/) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
477 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
478 CheckSuccess(that_.backend_.getLastChange(transaction_)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
479 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
480 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
481 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
482 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
483 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
484 target.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
485 if (count == 1) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
486 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
487 target.push_back(ReadAnswerChange(0)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
488 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
489 else if (count > 1) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
490 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
491 throw OrthancException(ErrorCode_DatabasePlugin); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
492 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
493 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
494 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
495 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
496 virtual void GetLastExportedResource(std::list<ExportedResource>& target /*out*/) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
497 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
498 CheckSuccess(that_.backend_.getLastExportedResource(transaction_)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
499 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
500 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
501 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
502 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
503 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
504 target.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
505 if (count == 1) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
506 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
507 target.push_back(ReadAnswerExportedResource(0)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
508 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
509 else if (count > 1) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
510 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
511 throw OrthancException(ErrorCode_DatabasePlugin); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
512 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
513 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
514 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
515 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
516 virtual void GetMainDicomTags(DicomMap& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
517 int64_t id) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
518 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
519 CheckSuccess(that_.backend_.getMainDicomTags(transaction_, id)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
520 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
521 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
522 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
523 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
524 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
525 target.Clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
526 for (uint32_t i = 0; i < count; i++) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
527 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
528 uint16_t group, element; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
529 const char* value = NULL; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
530 CheckSuccess(that_.backend_.readAnswerDicomTag(transaction_, &group, &element, &value, i)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
531 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
532 if (value == NULL) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
533 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
534 throw OrthancException(ErrorCode_DatabasePlugin); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
535 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
536 else |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
537 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
538 target.SetValue(group, element, std::string(value), false); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
539 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
540 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
541 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
542 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
543 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
544 virtual std::string GetPublicId(int64_t resourceId) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
545 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
546 CheckSuccess(that_.backend_.getPublicId(transaction_, resourceId)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
547 CheckNoEvent(); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
548 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
549 std::string s; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
550 if (ReadSingleStringAnswer(s)) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
551 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
552 return s; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
553 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
554 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
555 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
556 throw OrthancException(ErrorCode_InexistentItem); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
557 } |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
558 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
559 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
560 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
561 virtual uint64_t GetResourcesCount(ResourceType resourceType) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
562 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
563 uint64_t value; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
564 CheckSuccess(that_.backend_.getResourcesCount(transaction_, &value, Plugins::Convert(resourceType))); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
565 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
566 return value; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
567 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
568 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
569 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
570 virtual ResourceType GetResourceType(int64_t resourceId) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
571 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
572 OrthancPluginResourceType type; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
573 CheckSuccess(that_.backend_.getResourceType(transaction_, &type, resourceId)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
574 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
575 return Plugins::Convert(type); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
576 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
577 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
578 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
579 virtual uint64_t GetTotalCompressedSize() ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
580 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
581 uint64_t s; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
582 CheckSuccess(that_.backend_.getTotalCompressedSize(transaction_, &s)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
583 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
584 return s; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
585 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
586 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
587 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
588 virtual uint64_t GetTotalUncompressedSize() ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
589 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
590 uint64_t s; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
591 CheckSuccess(that_.backend_.getTotalUncompressedSize(transaction_, &s)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
592 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
593 return s; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
594 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
595 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
596 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
597 virtual bool IsProtectedPatient(int64_t internalId) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
598 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
599 uint8_t b; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
600 CheckSuccess(that_.backend_.isProtectedPatient(transaction_, &b, internalId)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
601 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
602 return (b != 0); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
603 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
604 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
605 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
606 virtual void ListAvailableAttachments(std::set<FileContentType>& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
607 int64_t id) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
608 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
609 CheckSuccess(that_.backend_.listAvailableAttachments(transaction_, id)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
610 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
611 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
612 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
613 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
614 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
615 target.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
616 for (uint32_t i = 0; i < count; i++) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
617 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
618 int32_t value; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
619 CheckSuccess(that_.backend_.readAnswerInt32(transaction_, &value, i)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
620 target.insert(static_cast<FileContentType>(value)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
621 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
622 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
623 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
624 |
5216
450ac804d3af
simplifying IDatabaseWrapper::LogChange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5215
diff
changeset
|
625 virtual void LogChange(ChangeType changeType, |
450ac804d3af
simplifying IDatabaseWrapper::LogChange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5215
diff
changeset
|
626 ResourceType resourceType, |
450ac804d3af
simplifying IDatabaseWrapper::LogChange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5215
diff
changeset
|
627 int64_t internalId, |
450ac804d3af
simplifying IDatabaseWrapper::LogChange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5215
diff
changeset
|
628 const std::string& /* publicId - unused */, |
450ac804d3af
simplifying IDatabaseWrapper::LogChange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5215
diff
changeset
|
629 const std::string& date) ORTHANC_OVERRIDE |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
630 { |
5216
450ac804d3af
simplifying IDatabaseWrapper::LogChange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5215
diff
changeset
|
631 CheckSuccess(that_.backend_.logChange(transaction_, static_cast<int32_t>(changeType), |
450ac804d3af
simplifying IDatabaseWrapper::LogChange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5215
diff
changeset
|
632 internalId, Plugins::Convert(resourceType), |
450ac804d3af
simplifying IDatabaseWrapper::LogChange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5215
diff
changeset
|
633 date.c_str())); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
634 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
635 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
636 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
637 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
638 virtual void LogExportedResource(const ExportedResource& resource) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
639 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
640 CheckSuccess(that_.backend_.logExportedResource(transaction_, Plugins::Convert(resource.GetResourceType()), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
641 resource.GetPublicId().c_str(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
642 resource.GetModality().c_str(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
643 resource.GetDate().c_str(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
644 resource.GetPatientId().c_str(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
645 resource.GetStudyInstanceUid().c_str(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
646 resource.GetSeriesInstanceUid().c_str(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
647 resource.GetSopInstanceUid().c_str())); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
648 CheckNoEvent(); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
649 } |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
650 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
651 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
652 virtual bool LookupAttachment(FileInfo& attachment, |
4627
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
653 int64_t& revision, |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
654 int64_t id, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
655 FileContentType contentType) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
656 { |
4627
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
657 CheckSuccess(that_.backend_.lookupAttachment(transaction_, &revision, id, static_cast<int32_t>(contentType))); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
658 CheckNoEvent(); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
659 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
660 uint32_t count; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
661 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
662 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
663 if (count == 0) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
664 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
665 return false; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
666 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
667 else if (count == 1) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
668 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
669 OrthancPluginAttachment tmp; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
670 CheckSuccess(that_.backend_.readAnswerAttachment(transaction_, &tmp, 0)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
671 attachment = Convert(tmp); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
672 return true; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
673 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
674 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
675 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
676 throw OrthancException(ErrorCode_DatabasePlugin); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
677 } |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
678 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
679 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
680 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
681 virtual bool LookupGlobalProperty(std::string& target, |
4607
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4604
diff
changeset
|
682 GlobalProperty property, |
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4604
diff
changeset
|
683 bool shared) ORTHANC_OVERRIDE |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
684 { |
4607
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4604
diff
changeset
|
685 const char* id = (shared ? "" : that_.serverIdentifier_.c_str()); |
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4604
diff
changeset
|
686 |
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4604
diff
changeset
|
687 CheckSuccess(that_.backend_.lookupGlobalProperty(transaction_, id, static_cast<int32_t>(property))); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
688 CheckNoEvent(); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
689 return ReadSingleStringAnswer(target); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
690 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
691 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
692 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
693 virtual bool LookupMetadata(std::string& target, |
4623
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4615
diff
changeset
|
694 int64_t& revision, |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
695 int64_t id, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
696 MetadataType type) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
697 { |
4623
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4615
diff
changeset
|
698 CheckSuccess(that_.backend_.lookupMetadata(transaction_, &revision, id, static_cast<int32_t>(type))); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
699 CheckNoEvent(); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
700 return ReadSingleStringAnswer(target); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
701 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
702 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
703 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
704 virtual bool LookupParent(int64_t& parentId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
705 int64_t resourceId) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
706 { |
4615
b91ed9e7f43c
minor api improvements in OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4607
diff
changeset
|
707 uint8_t existing; |
b91ed9e7f43c
minor api improvements in OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4607
diff
changeset
|
708 CheckSuccess(that_.backend_.lookupParent(transaction_, &existing, &parentId, resourceId)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
709 CheckNoEvent(); |
4615
b91ed9e7f43c
minor api improvements in OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4607
diff
changeset
|
710 return (existing != 0); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
711 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
712 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
713 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
714 virtual bool LookupResource(int64_t& id, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
715 ResourceType& type, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
716 const std::string& publicId) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
717 { |
4602
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
718 uint8_t existing; |
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
719 OrthancPluginResourceType t; |
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
720 CheckSuccess(that_.backend_.lookupResource(transaction_, &existing, &id, &t, publicId.c_str())); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
721 CheckNoEvent(); |
4602
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
722 |
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
723 if (existing == 0) |
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
724 { |
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
725 return false; |
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
726 } |
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
727 else |
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
728 { |
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
729 type = Plugins::Convert(t); |
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
730 return true; |
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
731 } |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
732 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
733 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
734 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
735 virtual bool SelectPatientToRecycle(int64_t& internalId) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
736 { |
4615
b91ed9e7f43c
minor api improvements in OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4607
diff
changeset
|
737 uint8_t available; |
b91ed9e7f43c
minor api improvements in OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4607
diff
changeset
|
738 CheckSuccess(that_.backend_.selectPatientToRecycle(transaction_, &available, &internalId)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
739 CheckNoEvent(); |
4615
b91ed9e7f43c
minor api improvements in OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4607
diff
changeset
|
740 return (available != 0); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
741 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
742 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
743 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
744 virtual bool SelectPatientToRecycle(int64_t& internalId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
745 int64_t patientIdToAvoid) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
746 { |
4615
b91ed9e7f43c
minor api improvements in OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4607
diff
changeset
|
747 uint8_t available; |
b91ed9e7f43c
minor api improvements in OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4607
diff
changeset
|
748 CheckSuccess(that_.backend_.selectPatientToRecycle2(transaction_, &available, &internalId, patientIdToAvoid)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
749 CheckNoEvent(); |
4615
b91ed9e7f43c
minor api improvements in OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4607
diff
changeset
|
750 return (available != 0); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
751 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
752 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
753 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
754 virtual void SetGlobalProperty(GlobalProperty property, |
4607
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4604
diff
changeset
|
755 bool shared, |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
756 const std::string& value) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
757 { |
4607
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4604
diff
changeset
|
758 const char* id = (shared ? "" : that_.serverIdentifier_.c_str()); |
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4604
diff
changeset
|
759 |
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4604
diff
changeset
|
760 CheckSuccess(that_.backend_.setGlobalProperty(transaction_, id, static_cast<int32_t>(property), value.c_str())); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
761 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
762 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
763 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
764 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
765 virtual void ClearMainDicomTags(int64_t id) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
766 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
767 CheckSuccess(that_.backend_.clearMainDicomTags(transaction_, id)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
768 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
769 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
770 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
771 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
772 virtual void SetMetadata(int64_t id, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
773 MetadataType type, |
4623
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4615
diff
changeset
|
774 const std::string& value, |
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4615
diff
changeset
|
775 int64_t revision) ORTHANC_OVERRIDE |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
776 { |
4623
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4615
diff
changeset
|
777 CheckSuccess(that_.backend_.setMetadata(transaction_, id, static_cast<int32_t>(type), value.c_str(), revision)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
778 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
779 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
780 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
781 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
782 virtual void SetProtectedPatient(int64_t internalId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
783 bool isProtected) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
784 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
785 CheckSuccess(that_.backend_.setProtectedPatient(transaction_, internalId, (isProtected ? 1 : 0))); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
786 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
787 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
788 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
789 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
790 virtual bool IsDiskSizeAbove(uint64_t threshold) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
791 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
792 uint8_t tmp; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
793 CheckSuccess(that_.backend_.isDiskSizeAbove(transaction_, &tmp, threshold)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
794 CheckNoEvent(); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
795 return (tmp != 0); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
796 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
797 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
798 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
799 virtual void ApplyLookupResources(std::list<std::string>& resourcesId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
800 std::list<std::string>* instancesId, // Can be NULL if not needed |
5680
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
801 const DatabaseConstraints& lookup, |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
802 ResourceType queryLevel, |
5248
a7d95f951f8a
replaced "WithLabels" and "WithoutLabels", by "Labels" and "LabelsConstraint"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5221
diff
changeset
|
803 const std::set<std::string>& labels, |
a7d95f951f8a
replaced "WithLabels" and "WithoutLabels", by "Labels" and "LabelsConstraint"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5221
diff
changeset
|
804 LabelsConstraint labelsConstraint, |
5213
055428d92772
clarifying types of since/limit in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5193
diff
changeset
|
805 uint32_t limit) ORTHANC_OVERRIDE |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
806 { |
5248
a7d95f951f8a
replaced "WithLabels" and "WithoutLabels", by "Labels" and "LabelsConstraint"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5221
diff
changeset
|
807 if (!labels.empty()) |
5220
df39c7583a49
preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5216
diff
changeset
|
808 { |
df39c7583a49
preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5216
diff
changeset
|
809 throw OrthancException(ErrorCode_InternalError); // "HasLabelsSupport()" has returned "false" |
df39c7583a49
preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5216
diff
changeset
|
810 } |
df39c7583a49
preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5216
diff
changeset
|
811 |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
812 std::vector<OrthancPluginDatabaseConstraint> constraints; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
813 std::vector< std::vector<const char*> > constraintsValues; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
814 |
5680
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
815 constraints.resize(lookup.GetSize()); |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
816 constraintsValues.resize(lookup.GetSize()); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
817 |
5680
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
818 for (size_t i = 0; i < lookup.GetSize(); i++) |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
819 { |
5680
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
820 lookup.GetConstraint(i).EncodeForPlugins(constraints[i], constraintsValues[i]); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
821 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
822 |
5680
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
823 CheckSuccess(that_.backend_.lookupResources(transaction_, lookup.GetSize(), |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
824 (lookup.IsEmpty() ? NULL : &constraints[0]), |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
825 Plugins::Convert(queryLevel), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
826 limit, (instancesId == NULL ? 0 : 1))); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
827 CheckNoEvent(); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
828 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
829 uint32_t count; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
830 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
831 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
832 resourcesId.clear(); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
833 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
834 if (instancesId != NULL) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
835 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
836 instancesId->clear(); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
837 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
838 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
839 for (uint32_t i = 0; i < count; i++) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
840 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
841 OrthancPluginMatchingResource resource; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
842 CheckSuccess(that_.backend_.readAnswerMatchingResource(transaction_, &resource, i)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
843 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
844 if (resource.resourceId == NULL) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
845 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
846 throw OrthancException(ErrorCode_DatabasePlugin); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
847 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
848 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
849 resourcesId.push_back(resource.resourceId); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
850 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
851 if (instancesId != NULL) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
852 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
853 if (resource.someInstanceId == NULL) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
854 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
855 throw OrthancException(ErrorCode_DatabasePlugin); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
856 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
857 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
858 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
859 instancesId->push_back(resource.someInstanceId); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
860 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
861 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
862 } |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
863 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
864 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
865 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
866 virtual bool CreateInstance(CreateInstanceResult& result, /* out */ |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
867 int64_t& instanceId, /* out */ |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
868 const std::string& patient, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
869 const std::string& study, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
870 const std::string& series, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
871 const std::string& instance) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
872 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
873 OrthancPluginCreateInstanceResult output; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
874 memset(&output, 0, sizeof(output)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
875 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
876 CheckSuccess(that_.backend_.createInstance(transaction_, &output, patient.c_str(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
877 study.c_str(), series.c_str(), instance.c_str())); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
878 CheckNoEvent(); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
879 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
880 instanceId = output.instanceId; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
881 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
882 if (output.isNewInstance) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
883 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
884 result.isNewPatient_ = output.isNewPatient; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
885 result.isNewStudy_ = output.isNewStudy; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
886 result.isNewSeries_ = output.isNewSeries; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
887 result.patientId_ = output.patientId; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
888 result.studyId_ = output.studyId; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
889 result.seriesId_ = output.seriesId; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
890 return true; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
891 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
892 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
893 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
894 return false; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
895 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
896 |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
897 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
898 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
899 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
900 virtual void SetResourcesContent(const ResourcesContent& content) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
901 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
902 std::vector<OrthancPluginResourcesContentTags> identifierTags; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
903 std::vector<OrthancPluginResourcesContentTags> mainDicomTags; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
904 std::vector<OrthancPluginResourcesContentMetadata> metadata; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
905 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
906 identifierTags.reserve(content.GetListTags().size()); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
907 mainDicomTags.reserve(content.GetListTags().size()); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
908 metadata.reserve(content.GetListMetadata().size()); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
909 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
910 for (ResourcesContent::ListTags::const_iterator |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
911 it = content.GetListTags().begin(); it != content.GetListTags().end(); ++it) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
912 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
913 OrthancPluginResourcesContentTags tmp; |
5215
8b6da4fdf9fe
cleaning ResourcesContent::TagValue and ResourcesContent::Metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5213
diff
changeset
|
914 tmp.resource = it->GetResourceId(); |
8b6da4fdf9fe
cleaning ResourcesContent::TagValue and ResourcesContent::Metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5213
diff
changeset
|
915 tmp.group = it->GetTag().GetGroup(); |
8b6da4fdf9fe
cleaning ResourcesContent::TagValue and ResourcesContent::Metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5213
diff
changeset
|
916 tmp.element = it->GetTag().GetElement(); |
8b6da4fdf9fe
cleaning ResourcesContent::TagValue and ResourcesContent::Metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5213
diff
changeset
|
917 tmp.value = it->GetValue().c_str(); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
918 |
5215
8b6da4fdf9fe
cleaning ResourcesContent::TagValue and ResourcesContent::Metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5213
diff
changeset
|
919 if (it->IsIdentifier()) |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
920 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
921 identifierTags.push_back(tmp); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
922 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
923 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
924 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
925 mainDicomTags.push_back(tmp); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
926 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
927 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
928 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
929 for (ResourcesContent::ListMetadata::const_iterator |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
930 it = content.GetListMetadata().begin(); it != content.GetListMetadata().end(); ++it) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
931 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
932 OrthancPluginResourcesContentMetadata tmp; |
5215
8b6da4fdf9fe
cleaning ResourcesContent::TagValue and ResourcesContent::Metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5213
diff
changeset
|
933 tmp.resource = it->GetResourceId(); |
8b6da4fdf9fe
cleaning ResourcesContent::TagValue and ResourcesContent::Metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5213
diff
changeset
|
934 tmp.metadata = it->GetType(); |
8b6da4fdf9fe
cleaning ResourcesContent::TagValue and ResourcesContent::Metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5213
diff
changeset
|
935 tmp.value = it->GetValue().c_str(); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
936 metadata.push_back(tmp); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
937 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
938 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
939 assert(identifierTags.size() + mainDicomTags.size() == content.GetListTags().size() && |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
940 metadata.size() == content.GetListMetadata().size()); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
941 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
942 CheckSuccess(that_.backend_.setResourcesContent(transaction_, |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
943 identifierTags.size(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
944 (identifierTags.empty() ? NULL : &identifierTags[0]), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
945 mainDicomTags.size(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
946 (mainDicomTags.empty() ? NULL : &mainDicomTags[0]), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
947 metadata.size(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
948 (metadata.empty() ? NULL : &metadata[0]))); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
949 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
950 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
951 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
952 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
953 virtual void GetChildrenMetadata(std::list<std::string>& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
954 int64_t resourceId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
955 MetadataType metadata) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
956 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
957 CheckSuccess(that_.backend_.getChildrenMetadata(transaction_, resourceId, static_cast<int32_t>(metadata))); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
958 CheckNoEvent(); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
959 ReadStringAnswers(target); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
960 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
961 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
962 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
963 virtual int64_t GetLastChangeIndex() ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
964 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
965 int64_t tmp; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
966 CheckSuccess(that_.backend_.getLastChangeIndex(transaction_, &tmp)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
967 CheckNoEvent(); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
968 return tmp; |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
969 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
970 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
971 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
972 virtual bool LookupResourceAndParent(int64_t& id, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
973 ResourceType& type, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
974 std::string& parentPublicId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
975 const std::string& publicId) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
976 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
977 uint8_t isExisting; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
978 OrthancPluginResourceType tmpType; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
979 CheckSuccess(that_.backend_.lookupResourceAndParent(transaction_, &isExisting, &id, &tmpType, publicId.c_str())); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
980 CheckNoEvent(); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
981 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
982 if (isExisting) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
983 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
984 type = Plugins::Convert(tmpType); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
985 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
986 uint32_t count; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
987 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
988 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
989 if (count > 1) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
990 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
991 throw OrthancException(ErrorCode_DatabasePlugin); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
992 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
993 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
994 switch (type) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
995 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
996 case ResourceType_Patient: |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
997 // A patient has no parent |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
998 if (count == 1) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
999 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1000 throw OrthancException(ErrorCode_DatabasePlugin); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1001 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1002 break; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1003 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1004 case ResourceType_Study: |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1005 case ResourceType_Series: |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1006 case ResourceType_Instance: |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1007 if (count == 0) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1008 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1009 throw OrthancException(ErrorCode_DatabasePlugin); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1010 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1011 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1012 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1013 const char* value = NULL; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1014 CheckSuccess(that_.backend_.readAnswerString(transaction_, &value, 0)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1015 if (value == NULL) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1016 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1017 throw OrthancException(ErrorCode_DatabasePlugin); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1018 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1019 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1020 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1021 parentPublicId.assign(value); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1022 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1023 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1024 break; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1025 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1026 default: |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1027 throw OrthancException(ErrorCode_DatabasePlugin); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1028 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1029 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1030 return true; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1031 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1032 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1033 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1034 return false; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1035 } |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1036 } |
5220
df39c7583a49
preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5216
diff
changeset
|
1037 |
df39c7583a49
preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5216
diff
changeset
|
1038 |
df39c7583a49
preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5216
diff
changeset
|
1039 virtual void AddLabel(int64_t resource, |
df39c7583a49
preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5216
diff
changeset
|
1040 const std::string& label) ORTHANC_OVERRIDE |
df39c7583a49
preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5216
diff
changeset
|
1041 { |
df39c7583a49
preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5216
diff
changeset
|
1042 throw OrthancException(ErrorCode_InternalError); // Not supported |
df39c7583a49
preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5216
diff
changeset
|
1043 } |
df39c7583a49
preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5216
diff
changeset
|
1044 |
df39c7583a49
preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5216
diff
changeset
|
1045 |
df39c7583a49
preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5216
diff
changeset
|
1046 virtual void RemoveLabel(int64_t resource, |
df39c7583a49
preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5216
diff
changeset
|
1047 const std::string& label) ORTHANC_OVERRIDE |
df39c7583a49
preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5216
diff
changeset
|
1048 { |
df39c7583a49
preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5216
diff
changeset
|
1049 throw OrthancException(ErrorCode_InternalError); // Not supported |
df39c7583a49
preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5216
diff
changeset
|
1050 } |
df39c7583a49
preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5216
diff
changeset
|
1051 |
df39c7583a49
preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5216
diff
changeset
|
1052 |
5221
d0f7c742d397
started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5220
diff
changeset
|
1053 virtual void ListLabels(std::set<std::string>& target, |
d0f7c742d397
started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5220
diff
changeset
|
1054 int64_t resource) ORTHANC_OVERRIDE |
5220
df39c7583a49
preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5216
diff
changeset
|
1055 { |
df39c7583a49
preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5216
diff
changeset
|
1056 throw OrthancException(ErrorCode_InternalError); // Not supported |
df39c7583a49
preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5216
diff
changeset
|
1057 } |
5249
f22c8fac764b
added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5248
diff
changeset
|
1058 |
f22c8fac764b
added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5248
diff
changeset
|
1059 |
f22c8fac764b
added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5248
diff
changeset
|
1060 virtual void ListAllLabels(std::set<std::string>& target) ORTHANC_OVERRIDE |
f22c8fac764b
added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5248
diff
changeset
|
1061 { |
f22c8fac764b
added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5248
diff
changeset
|
1062 throw OrthancException(ErrorCode_InternalError); // Not supported |
f22c8fac764b
added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5248
diff
changeset
|
1063 } |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1064 }; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1065 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1066 |
4628
5fabef29c4ff
added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4627
diff
changeset
|
1067 void OrthancPluginDatabaseV3::CheckSuccess(OrthancPluginErrorCode code) const |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1068 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1069 if (code != OrthancPluginErrorCode_Success) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1070 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1071 errorDictionary_.LogError(code, true); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1072 throw OrthancException(static_cast<ErrorCode>(code)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1073 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1074 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1075 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1076 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1077 OrthancPluginDatabaseV3::OrthancPluginDatabaseV3(SharedLibrary& library, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1078 PluginsErrorDictionary& errorDictionary, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1079 const OrthancPluginDatabaseBackendV3* backend, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1080 size_t backendSize, |
4604
2c702cfae274
New option "DatabaseServerIdentifier" to identify the server among a pool of Orthanc servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4602
diff
changeset
|
1081 void* database, |
2c702cfae274
New option "DatabaseServerIdentifier" to identify the server among a pool of Orthanc servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4602
diff
changeset
|
1082 const std::string& serverIdentifier) : |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1083 library_(library), |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1084 errorDictionary_(errorDictionary), |
4604
2c702cfae274
New option "DatabaseServerIdentifier" to identify the server among a pool of Orthanc servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4602
diff
changeset
|
1085 database_(database), |
5517
0d433132b249
refactoring IDatabaseWrapper::Capabilities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5497
diff
changeset
|
1086 serverIdentifier_(serverIdentifier) |
5493
b3ebe249ed5b
At startup, when using a database plugin, display the latency to access the DB
Alain Mazy <am@osimis.io>
parents:
5466
diff
changeset
|
1087 |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1088 { |
4604
2c702cfae274
New option "DatabaseServerIdentifier" to identify the server among a pool of Orthanc servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4602
diff
changeset
|
1089 CLOG(INFO, PLUGINS) << "Identifier of this Orthanc server for the global properties " |
2c702cfae274
New option "DatabaseServerIdentifier" to identify the server among a pool of Orthanc servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4602
diff
changeset
|
1090 << "of the custom database: \"" << serverIdentifier << "\""; |
2c702cfae274
New option "DatabaseServerIdentifier" to identify the server among a pool of Orthanc servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4602
diff
changeset
|
1091 |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1092 if (backendSize >= sizeof(backend_)) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1093 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1094 memcpy(&backend_, backend, sizeof(backend_)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1095 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1096 else |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1097 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1098 // Not all the primitives are implemented by the plugin |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1099 memset(&backend_, 0, sizeof(backend_)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1100 memcpy(&backend_, backend, backendSize); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1101 } |
4601
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1102 |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1103 // Sanity checks |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1104 CHECK_FUNCTION_EXISTS(backend_, readAnswersCount); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1105 CHECK_FUNCTION_EXISTS(backend_, readAnswerAttachment); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1106 CHECK_FUNCTION_EXISTS(backend_, readAnswerChange); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1107 CHECK_FUNCTION_EXISTS(backend_, readAnswerDicomTag); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1108 CHECK_FUNCTION_EXISTS(backend_, readAnswerExportedResource); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1109 CHECK_FUNCTION_EXISTS(backend_, readAnswerInt32); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1110 CHECK_FUNCTION_EXISTS(backend_, readAnswerInt64); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1111 CHECK_FUNCTION_EXISTS(backend_, readAnswerMatchingResource); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1112 CHECK_FUNCTION_EXISTS(backend_, readAnswerMetadata); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1113 CHECK_FUNCTION_EXISTS(backend_, readAnswerString); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1114 |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1115 CHECK_FUNCTION_EXISTS(backend_, readEventsCount); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1116 CHECK_FUNCTION_EXISTS(backend_, readEvent); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1117 |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1118 CHECK_FUNCTION_EXISTS(backend_, open); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1119 CHECK_FUNCTION_EXISTS(backend_, close); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1120 CHECK_FUNCTION_EXISTS(backend_, destructDatabase); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1121 CHECK_FUNCTION_EXISTS(backend_, getDatabaseVersion); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1122 CHECK_FUNCTION_EXISTS(backend_, upgradeDatabase); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1123 CHECK_FUNCTION_EXISTS(backend_, startTransaction); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1124 CHECK_FUNCTION_EXISTS(backend_, destructTransaction); |
4628
5fabef29c4ff
added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4627
diff
changeset
|
1125 CHECK_FUNCTION_EXISTS(backend_, hasRevisionsSupport); |
4601
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1126 |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1127 CHECK_FUNCTION_EXISTS(backend_, rollback); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1128 CHECK_FUNCTION_EXISTS(backend_, commit); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1129 |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1130 CHECK_FUNCTION_EXISTS(backend_, addAttachment); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1131 CHECK_FUNCTION_EXISTS(backend_, clearChanges); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1132 CHECK_FUNCTION_EXISTS(backend_, clearExportedResources); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1133 CHECK_FUNCTION_EXISTS(backend_, clearMainDicomTags); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1134 CHECK_FUNCTION_EXISTS(backend_, createInstance); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1135 CHECK_FUNCTION_EXISTS(backend_, deleteAttachment); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1136 CHECK_FUNCTION_EXISTS(backend_, deleteMetadata); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1137 CHECK_FUNCTION_EXISTS(backend_, deleteResource); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1138 CHECK_FUNCTION_EXISTS(backend_, getAllMetadata); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1139 CHECK_FUNCTION_EXISTS(backend_, getAllPublicIds); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1140 CHECK_FUNCTION_EXISTS(backend_, getAllPublicIdsWithLimit); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1141 CHECK_FUNCTION_EXISTS(backend_, getChanges); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1142 CHECK_FUNCTION_EXISTS(backend_, getChildrenInternalId); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1143 CHECK_FUNCTION_EXISTS(backend_, getChildrenMetadata); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1144 CHECK_FUNCTION_EXISTS(backend_, getChildrenPublicId); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1145 CHECK_FUNCTION_EXISTS(backend_, getExportedResources); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1146 CHECK_FUNCTION_EXISTS(backend_, getLastChange); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1147 CHECK_FUNCTION_EXISTS(backend_, getLastChangeIndex); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1148 CHECK_FUNCTION_EXISTS(backend_, getLastExportedResource); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1149 CHECK_FUNCTION_EXISTS(backend_, getMainDicomTags); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1150 CHECK_FUNCTION_EXISTS(backend_, getPublicId); |
4627
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
1151 CHECK_FUNCTION_EXISTS(backend_, getResourceType); |
4601
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1152 CHECK_FUNCTION_EXISTS(backend_, getResourcesCount); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1153 CHECK_FUNCTION_EXISTS(backend_, getTotalCompressedSize); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1154 CHECK_FUNCTION_EXISTS(backend_, getTotalUncompressedSize); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1155 CHECK_FUNCTION_EXISTS(backend_, isDiskSizeAbove); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1156 CHECK_FUNCTION_EXISTS(backend_, isExistingResource); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1157 CHECK_FUNCTION_EXISTS(backend_, isProtectedPatient); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1158 CHECK_FUNCTION_EXISTS(backend_, listAvailableAttachments); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1159 CHECK_FUNCTION_EXISTS(backend_, logChange); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1160 CHECK_FUNCTION_EXISTS(backend_, logExportedResource); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1161 CHECK_FUNCTION_EXISTS(backend_, lookupAttachment); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1162 CHECK_FUNCTION_EXISTS(backend_, lookupGlobalProperty); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1163 CHECK_FUNCTION_EXISTS(backend_, lookupMetadata); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1164 CHECK_FUNCTION_EXISTS(backend_, lookupParent); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1165 CHECK_FUNCTION_EXISTS(backend_, lookupResource); |
4627
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
1166 CHECK_FUNCTION_EXISTS(backend_, lookupResourceAndParent); |
4601
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1167 CHECK_FUNCTION_EXISTS(backend_, lookupResources); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1168 CHECK_FUNCTION_EXISTS(backend_, selectPatientToRecycle); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1169 CHECK_FUNCTION_EXISTS(backend_, selectPatientToRecycle2); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1170 CHECK_FUNCTION_EXISTS(backend_, setGlobalProperty); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1171 CHECK_FUNCTION_EXISTS(backend_, setMetadata); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1172 CHECK_FUNCTION_EXISTS(backend_, setProtectedPatient); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1173 CHECK_FUNCTION_EXISTS(backend_, setResourcesContent); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1174 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1175 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1176 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1177 OrthancPluginDatabaseV3::~OrthancPluginDatabaseV3() |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1178 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1179 if (database_ != NULL) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1180 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1181 OrthancPluginErrorCode code = backend_.destructDatabase(database_); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1182 if (code != OrthancPluginErrorCode_Success) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1183 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1184 // Don't throw exception in destructors |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1185 errorDictionary_.LogError(code, true); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1186 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1187 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1188 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1189 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1190 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1191 void OrthancPluginDatabaseV3::Open() |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1192 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1193 CheckSuccess(backend_.open(database_)); |
5455
176bc05f85f4
DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents:
5249
diff
changeset
|
1194 |
176bc05f85f4
DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents:
5249
diff
changeset
|
1195 // update the db capabilities |
176bc05f85f4
DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents:
5249
diff
changeset
|
1196 uint8_t hasRevisions; |
176bc05f85f4
DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents:
5249
diff
changeset
|
1197 CheckSuccess(backend_.hasRevisionsSupport(database_, &hasRevisions)); |
5517
0d433132b249
refactoring IDatabaseWrapper::Capabilities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5497
diff
changeset
|
1198 dbCapabilities_.SetRevisionsSupport(hasRevisions != 0); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1199 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1200 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1201 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1202 void OrthancPluginDatabaseV3::Close() |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1203 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1204 CheckSuccess(backend_.close(database_)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1205 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1206 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1207 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1208 IDatabaseWrapper::ITransaction* OrthancPluginDatabaseV3::StartTransaction(TransactionType type, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1209 IDatabaseListener& listener) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1210 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1211 switch (type) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1212 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1213 case TransactionType_ReadOnly: |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
1214 return new Transaction(*this, listener, OrthancPluginDatabaseTransactionType_ReadOnly); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1215 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1216 case TransactionType_ReadWrite: |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
1217 return new Transaction(*this, listener, OrthancPluginDatabaseTransactionType_ReadWrite); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1218 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1219 default: |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1220 throw OrthancException(ErrorCode_InternalError); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1221 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1222 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1223 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1224 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1225 unsigned int OrthancPluginDatabaseV3::GetDatabaseVersion() |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1226 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1227 uint32_t version = 0; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1228 CheckSuccess(backend_.getDatabaseVersion(database_, &version)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1229 return version; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1230 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1231 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1232 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1233 void OrthancPluginDatabaseV3::Upgrade(unsigned int targetVersion, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1234 IStorageArea& storageArea) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1235 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1236 VoidDatabaseListener listener; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1237 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1238 if (backend_.upgradeDatabase != NULL) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1239 { |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
1240 Transaction transaction(*this, listener, OrthancPluginDatabaseTransactionType_ReadWrite); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1241 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1242 OrthancPluginErrorCode code = backend_.upgradeDatabase( |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1243 database_, reinterpret_cast<OrthancPluginStorageArea*>(&storageArea), |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1244 static_cast<uint32_t>(targetVersion)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1245 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1246 if (code == OrthancPluginErrorCode_Success) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1247 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1248 transaction.Commit(0); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1249 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1250 else |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1251 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1252 transaction.Rollback(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1253 errorDictionary_.LogError(code, true); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1254 throw OrthancException(static_cast<ErrorCode>(code)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1255 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1256 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1257 } |
4628
5fabef29c4ff
added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4627
diff
changeset
|
1258 |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1259 } |