Mercurial > hg > orthanc
annotate OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp @ 4839:ee2c35896145
clarified error message
author | Alain Mazy <am@osimis.io> |
---|---|
date | Thu, 02 Dec 2021 14:51:55 +0100 |
parents | 7053502fbf97 |
children | 2e71a08eea15 43e613a7756b |
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
4831
7053502fbf97
added copyright UCLouvain
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4628
diff
changeset
|
6 * Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * 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
|
9 * 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
|
10 * 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
|
11 * License, or (at your option) any later version. |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * In addition, as a special exception, the copyright holders of this |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * program give permission to link the code of its release with the |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * OpenSSL project's "OpenSSL" library (or with modified versions of it |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * that use the same license as the "OpenSSL" library), and distribute |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * the linked executables. You must obey the GNU General Public License |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * in all respects for all of the code used other than "OpenSSL". If you |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * modify file(s) with this exception, you may extend this exception to |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 * your version of the file(s), but you are not obligated to do so. If |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 * you do not wish to do so, delete this exception statement from your |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 * version. If you delete this exception statement from all source files |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 * in the program, then also delete it here. |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 * |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 * 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
|
26 * WITHOUT ANY WARRANTY; without even the implied warranty of |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 * 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
|
28 * General Public License for more details. |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 * |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 * 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
|
31 * 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
|
32 **/ |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 #include "../../Sources/PrecompiledHeadersServer.h" |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 #include "OrthancPluginDatabaseV3.h" |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 #if ORTHANC_ENABLE_PLUGINS != 1 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 # error The plugin support is disabled |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 #endif |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 #include "../../../OrthancFramework/Sources/Logging.h" |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 #include "../../../OrthancFramework/Sources/OrthancException.h" |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
44 #include "../../Sources/Database/ResourcesContent.h" |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 #include "../../Sources/Database/VoidDatabaseListener.h" |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 #include "PluginsEnumerations.h" |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 #include <cassert> |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 |
4601
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
50 |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
51 #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
|
52 if (backend.func == NULL) \ |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
53 { \ |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
54 throw OrthancException( \ |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
55 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
|
56 } |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
57 |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 namespace Orthanc |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 class OrthancPluginDatabaseV3::Transaction : public IDatabaseWrapper::ITransaction |
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 private: |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 OrthancPluginDatabaseV3& that_; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 IDatabaseListener& listener_; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 OrthancPluginDatabaseTransaction* transaction_; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 void CheckSuccess(OrthancPluginErrorCode code) const |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 that_.CheckSuccess(code); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
74 static FileInfo Convert(const OrthancPluginAttachment& attachment) |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
75 { |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
76 return FileInfo(attachment.uuid, |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
77 static_cast<FileContentType>(attachment.contentType), |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
78 attachment.uncompressedSize, |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
79 attachment.uncompressedHash, |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
80 static_cast<CompressionType>(attachment.compressionType), |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
81 attachment.compressedSize, |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
82 attachment.compressedHash); |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
83 } |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
84 |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
85 |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 void ReadStringAnswers(std::list<std::string>& target) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
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.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 for (uint32_t i = 0; i < count; i++) |
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 const char* value = NULL; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 CheckSuccess(that_.backend_.readAnswerString(transaction_, &value, i)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 if (value == NULL) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 throw OrthancException(ErrorCode_DatabasePlugin); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 else |
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 target.push_back(value); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 } |
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 |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
107 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
108 bool ReadSingleStringAnswer(std::string& target) |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
109 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
110 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
111 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
112 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
113 if (count == 0) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
114 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
115 return false; |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
116 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 else if (count == 1) |
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 const char* value = NULL; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 CheckSuccess(that_.backend_.readAnswerString(transaction_, &value, 0)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 if (value == NULL) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 throw OrthancException(ErrorCode_DatabasePlugin); |
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 else |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
126 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
127 target.assign(value); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
128 return true; |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
129 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
130 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
131 else |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
132 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
133 throw OrthancException(ErrorCode_DatabasePlugin); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
135 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 |
4598
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 bool ReadSingleInt64Answer(int64_t& target) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
139 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
140 uint32_t count; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
141 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
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 if (count == 0) |
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 return false; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
146 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
147 else if (count == 1) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
148 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
149 CheckSuccess(that_.backend_.readAnswerInt64(transaction_, &target, 0)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
150 return true; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
151 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
152 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
153 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
154 throw OrthancException(ErrorCode_DatabasePlugin); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
155 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
156 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
157 |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
158 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
159 ExportedResource ReadAnswerExportedResource(uint32_t answerIndex) |
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 OrthancPluginExportedResource exported; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
162 CheckSuccess(that_.backend_.readAnswerExportedResource(transaction_, &exported, answerIndex)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
163 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
164 if (exported.publicId == NULL || |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
165 exported.modality == NULL || |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
166 exported.date == NULL || |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
167 exported.patientId == NULL || |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
168 exported.studyInstanceUid == NULL || |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
169 exported.seriesInstanceUid == NULL || |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
170 exported.sopInstanceUid == NULL) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
171 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
172 throw OrthancException(ErrorCode_DatabasePlugin); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
173 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
174 else |
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 return ExportedResource(exported.seq, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
177 Plugins::Convert(exported.resourceType), |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
178 exported.publicId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
179 exported.modality, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
180 exported.date, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
181 exported.patientId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
182 exported.studyInstanceUid, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
183 exported.seriesInstanceUid, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
184 exported.sopInstanceUid); |
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 } |
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
189 ServerIndexChange ReadAnswerChange(uint32_t answerIndex) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
190 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
191 OrthancPluginChange change; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
192 CheckSuccess(that_.backend_.readAnswerChange(transaction_, &change, answerIndex)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
193 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
194 if (change.publicId == NULL || |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
195 change.date == NULL) |
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 throw OrthancException(ErrorCode_DatabasePlugin); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
198 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
199 else |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
200 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
201 return ServerIndexChange(change.seq, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
202 static_cast<ChangeType>(change.changeType), |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
203 Plugins::Convert(change.resourceType), |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
204 change.publicId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
205 change.date); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
206 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
207 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
208 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
209 |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
210 void CheckNoEvent() |
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 if (count != 0) |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
215 { |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
216 throw OrthancException(ErrorCode_DatabasePlugin); |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
217 } |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
218 } |
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 |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
221 void ProcessEvents(bool isDeletingAttachment) |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
222 { |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
223 uint32_t count; |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
224 CheckSuccess(that_.backend_.readEventsCount(transaction_, &count)); |
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 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
|
227 { |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
228 OrthancPluginDatabaseEvent event; |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
229 CheckSuccess(that_.backend_.readEvent(transaction_, &event, i)); |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
230 |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
231 switch (event.type) |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
232 { |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
233 case OrthancPluginDatabaseEventType_DeletedAttachment: |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
234 listener_.SignalAttachmentDeleted(Convert(event.content.attachment)); |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
235 break; |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
236 |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
237 case OrthancPluginDatabaseEventType_DeletedResource: |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
238 if (isDeletingAttachment) |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
239 { |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
240 // 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
|
241 throw OrthancException(ErrorCode_DatabasePlugin); |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
242 } |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
243 else |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
244 { |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
245 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
|
246 } |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
247 break; |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
248 |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
249 case OrthancPluginDatabaseEventType_RemainingAncestor: |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
250 if (isDeletingAttachment) |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
251 { |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
252 // This event should only triggered by "DeleteResource()" |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
253 throw OrthancException(ErrorCode_DatabasePlugin); |
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 else |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
256 { |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
257 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
|
258 } |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
259 break; |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
260 |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
261 default: |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
262 break; // Unhandled event |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
263 } |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
264 } |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
265 } |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
266 |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
267 |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
268 public: |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
269 Transaction(OrthancPluginDatabaseV3& that, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
270 IDatabaseListener& listener, |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
271 OrthancPluginDatabaseTransactionType type) : |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
272 that_(that), |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
273 listener_(listener) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
274 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
275 CheckSuccess(that.backend_.startTransaction(that.database_, &transaction_, type)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
276 if (transaction_ == NULL) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
277 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
278 throw OrthancException(ErrorCode_DatabasePlugin); |
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
283 virtual ~Transaction() |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
284 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
285 OrthancPluginErrorCode code = that_.backend_.destructTransaction(transaction_); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
286 if (code != OrthancPluginErrorCode_Success) |
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 // Don't throw exception in destructors |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
289 that_.errorDictionary_.LogError(code, true); |
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 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
292 |
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 virtual void Rollback() ORTHANC_OVERRIDE |
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 CheckSuccess(that_.backend_.rollback(transaction_)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
297 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
298 } |
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
301 virtual void Commit(int64_t fileSizeDelta) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
302 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
303 CheckSuccess(that_.backend_.commit(transaction_, fileSizeDelta)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
304 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
305 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
306 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
307 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
308 virtual void AddAttachment(int64_t id, |
4627
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
309 const FileInfo& attachment, |
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
310 int64_t revision) ORTHANC_OVERRIDE |
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 OrthancPluginAttachment tmp; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
313 tmp.uuid = attachment.GetUuid().c_str(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
314 tmp.contentType = static_cast<int32_t>(attachment.GetContentType()); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
315 tmp.uncompressedSize = attachment.GetUncompressedSize(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
316 tmp.uncompressedHash = attachment.GetUncompressedMD5().c_str(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
317 tmp.compressionType = static_cast<int32_t>(attachment.GetCompressionType()); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
318 tmp.compressedSize = attachment.GetCompressedSize(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
319 tmp.compressedHash = attachment.GetCompressedMD5().c_str(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
320 |
4627
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
321 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
|
322 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
323 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
324 |
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 virtual void ClearChanges() ORTHANC_OVERRIDE |
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 CheckSuccess(that_.backend_.clearChanges(transaction_)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
329 CheckNoEvent(); |
4595
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
332 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
333 virtual void ClearExportedResources() ORTHANC_OVERRIDE |
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 CheckSuccess(that_.backend_.clearExportedResources(transaction_)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
336 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
337 } |
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
340 virtual void DeleteAttachment(int64_t id, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
341 FileContentType attachment) ORTHANC_OVERRIDE |
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 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
|
344 ProcessEvents(true); |
4595
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
347 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
348 virtual void DeleteMetadata(int64_t id, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
349 MetadataType type) ORTHANC_OVERRIDE |
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 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
|
352 CheckNoEvent(); |
4595
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
355 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
356 virtual void DeleteResource(int64_t id) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
357 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
358 CheckSuccess(that_.backend_.deleteResource(transaction_, id)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
359 ProcessEvents(false); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
360 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
361 |
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 virtual void GetAllMetadata(std::map<MetadataType, std::string>& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
364 int64_t id) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
365 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
366 CheckSuccess(that_.backend_.getAllMetadata(transaction_, id)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
367 CheckNoEvent(); |
4595
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 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
370 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
371 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
372 target.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
373 for (uint32_t i = 0; i < count; i++) |
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 int32_t metadata; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
376 const char* value = NULL; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
377 CheckSuccess(that_.backend_.readAnswerMetadata(transaction_, &metadata, &value, i)); |
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 if (value == NULL) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
380 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
381 throw OrthancException(ErrorCode_DatabasePlugin); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
382 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
383 else |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
384 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
385 target[static_cast<MetadataType>(metadata)] = value; |
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
390 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
391 virtual void GetAllPublicIds(std::list<std::string>& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
392 ResourceType resourceType) ORTHANC_OVERRIDE |
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_.getAllPublicIds(transaction_, Plugins::Convert(resourceType))); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
395 CheckNoEvent(); |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
396 |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
397 ReadStringAnswers(target); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
398 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
399 |
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 virtual void GetAllPublicIds(std::list<std::string>& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
402 ResourceType resourceType, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
403 size_t since, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
404 size_t limit) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
405 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
406 CheckSuccess(that_.backend_.getAllPublicIdsWithLimit( |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
407 transaction_, Plugins::Convert(resourceType), |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
408 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
|
409 CheckNoEvent(); |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
410 |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
411 ReadStringAnswers(target); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
412 } |
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
415 virtual void GetChanges(std::list<ServerIndexChange>& target /*out*/, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
416 bool& done /*out*/, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
417 int64_t since, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
418 uint32_t maxResults) ORTHANC_OVERRIDE |
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 uint8_t tmpDone = true; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
421 CheckSuccess(that_.backend_.getChanges(transaction_, &tmpDone, since, maxResults)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
422 CheckNoEvent(); |
4595
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 done = (tmpDone != 0); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
425 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
426 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
427 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
428 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
429 target.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
430 for (uint32_t i = 0; i < count; i++) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
431 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
432 target.push_back(ReadAnswerChange(i)); |
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 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
435 |
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 virtual void GetChildrenInternalId(std::list<int64_t>& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
438 int64_t id) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
439 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
440 CheckSuccess(that_.backend_.getChildrenInternalId(transaction_, id)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
441 CheckNoEvent(); |
4595
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 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
444 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
445 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
446 target.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
447 for (uint32_t i = 0; i < count; i++) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
448 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
449 int64_t value; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
450 CheckSuccess(that_.backend_.readAnswerInt64(transaction_, &value, i)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
451 target.push_back(value); |
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
455 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
456 virtual void GetChildrenPublicId(std::list<std::string>& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
457 int64_t id) ORTHANC_OVERRIDE |
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 CheckSuccess(that_.backend_.getChildrenPublicId(transaction_, id)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
460 CheckNoEvent(); |
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
461 |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
462 ReadStringAnswers(target); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
463 } |
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
466 virtual void GetExportedResources(std::list<ExportedResource>& target /*out*/, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
467 bool& done /*out*/, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
468 int64_t since, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
469 uint32_t maxResults) ORTHANC_OVERRIDE |
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 uint8_t tmpDone = true; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
472 CheckSuccess(that_.backend_.getExportedResources(transaction_, &tmpDone, since, maxResults)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
473 CheckNoEvent(); |
4595
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 done = (tmpDone != 0); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
476 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
477 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
478 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
479 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
480 target.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
481 for (uint32_t i = 0; i < count; i++) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
482 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
483 target.push_back(ReadAnswerExportedResource(i)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
484 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
485 } |
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
488 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
|
489 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
490 CheckSuccess(that_.backend_.getLastChange(transaction_)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
491 CheckNoEvent(); |
4595
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 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
494 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
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 target.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
497 if (count == 1) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
498 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
499 target.push_back(ReadAnswerChange(0)); |
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 else if (count > 1) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
502 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
503 throw OrthancException(ErrorCode_DatabasePlugin); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
504 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
505 } |
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
508 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
|
509 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
510 CheckSuccess(that_.backend_.getLastExportedResource(transaction_)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
511 CheckNoEvent(); |
4595
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 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
514 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
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 target.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
517 if (count == 1) |
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 target.push_back(ReadAnswerExportedResource(0)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
520 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
521 else if (count > 1) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
522 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
523 throw OrthancException(ErrorCode_DatabasePlugin); |
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 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
526 |
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 virtual void GetMainDicomTags(DicomMap& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
529 int64_t id) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
530 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
531 CheckSuccess(that_.backend_.getMainDicomTags(transaction_, id)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
532 CheckNoEvent(); |
4595
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 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
535 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
536 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
537 target.Clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
538 for (uint32_t i = 0; i < count; i++) |
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 uint16_t group, element; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
541 const char* value = NULL; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
542 CheckSuccess(that_.backend_.readAnswerDicomTag(transaction_, &group, &element, &value, i)); |
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 if (value == NULL) |
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 throw OrthancException(ErrorCode_DatabasePlugin); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
547 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
548 else |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
549 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
550 target.SetValue(group, element, std::string(value), false); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
551 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
552 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
553 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
554 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
555 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
556 virtual std::string GetPublicId(int64_t resourceId) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
557 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
558 CheckSuccess(that_.backend_.getPublicId(transaction_, resourceId)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
559 CheckNoEvent(); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
560 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
561 std::string s; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
562 if (ReadSingleStringAnswer(s)) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
563 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
564 return s; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
565 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
566 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
567 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
568 throw OrthancException(ErrorCode_InexistentItem); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
569 } |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
570 } |
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
573 virtual uint64_t GetResourcesCount(ResourceType resourceType) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
574 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
575 uint64_t value; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
576 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
|
577 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
578 return value; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
579 } |
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
582 virtual ResourceType GetResourceType(int64_t resourceId) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
583 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
584 OrthancPluginResourceType type; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
585 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
|
586 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
587 return Plugins::Convert(type); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
588 } |
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
591 virtual uint64_t GetTotalCompressedSize() ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
592 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
593 uint64_t s; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
594 CheckSuccess(that_.backend_.getTotalCompressedSize(transaction_, &s)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
595 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
596 return s; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
597 } |
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
600 virtual uint64_t GetTotalUncompressedSize() ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
601 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
602 uint64_t s; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
603 CheckSuccess(that_.backend_.getTotalUncompressedSize(transaction_, &s)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
604 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
605 return s; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
606 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
607 |
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 virtual bool IsExistingResource(int64_t internalId) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
610 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
611 uint8_t b; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
612 CheckSuccess(that_.backend_.isExistingResource(transaction_, &b, internalId)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
613 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
614 return (b != 0); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
615 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
616 |
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 virtual bool IsProtectedPatient(int64_t internalId) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
619 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
620 uint8_t b; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
621 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
|
622 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
623 return (b != 0); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
624 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
625 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
626 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
627 virtual void ListAvailableAttachments(std::set<FileContentType>& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
628 int64_t id) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
629 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
630 CheckSuccess(that_.backend_.listAvailableAttachments(transaction_, id)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
631 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
632 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
633 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
634 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
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 target.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
637 for (uint32_t i = 0; i < count; i++) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
638 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
639 int32_t value; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
640 CheckSuccess(that_.backend_.readAnswerInt32(transaction_, &value, i)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
641 target.insert(static_cast<FileContentType>(value)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
642 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
643 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
644 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
645 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
646 virtual void LogChange(int64_t internalId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
647 const ServerIndexChange& change) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
648 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
649 CheckSuccess(that_.backend_.logChange(transaction_, static_cast<int32_t>(change.GetChangeType()), |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
650 internalId, Plugins::Convert(change.GetResourceType()), |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
651 change.GetDate().c_str())); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
652 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
653 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
654 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
655 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
656 virtual void LogExportedResource(const ExportedResource& resource) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
657 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
658 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
|
659 resource.GetPublicId().c_str(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
660 resource.GetModality().c_str(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
661 resource.GetDate().c_str(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
662 resource.GetPatientId().c_str(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
663 resource.GetStudyInstanceUid().c_str(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
664 resource.GetSeriesInstanceUid().c_str(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
665 resource.GetSopInstanceUid().c_str())); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
666 CheckNoEvent(); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
667 } |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
668 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
669 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
670 virtual bool LookupAttachment(FileInfo& attachment, |
4627
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
671 int64_t& revision, |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
672 int64_t id, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
673 FileContentType contentType) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
674 { |
4627
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
675 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
|
676 CheckNoEvent(); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
677 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
678 uint32_t count; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
679 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
680 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
681 if (count == 0) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
682 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
683 return false; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
684 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
685 else if (count == 1) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
686 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
687 OrthancPluginAttachment tmp; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
688 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
|
689 attachment = Convert(tmp); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
690 return true; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
691 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
692 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
693 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
694 throw OrthancException(ErrorCode_DatabasePlugin); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
695 } |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
696 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
697 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
698 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
699 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
|
700 GlobalProperty property, |
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4604
diff
changeset
|
701 bool shared) ORTHANC_OVERRIDE |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
702 { |
4607
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4604
diff
changeset
|
703 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
|
704 |
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4604
diff
changeset
|
705 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
|
706 CheckNoEvent(); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
707 return ReadSingleStringAnswer(target); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
708 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
709 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
710 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
711 virtual bool LookupMetadata(std::string& target, |
4623
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4615
diff
changeset
|
712 int64_t& revision, |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
713 int64_t id, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
714 MetadataType type) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
715 { |
4623
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4615
diff
changeset
|
716 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
|
717 CheckNoEvent(); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
718 return ReadSingleStringAnswer(target); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
719 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
720 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
721 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
722 virtual bool LookupParent(int64_t& parentId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
723 int64_t resourceId) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
724 { |
4615
b91ed9e7f43c
minor api improvements in OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4607
diff
changeset
|
725 uint8_t existing; |
b91ed9e7f43c
minor api improvements in OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4607
diff
changeset
|
726 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
|
727 CheckNoEvent(); |
4615
b91ed9e7f43c
minor api improvements in OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4607
diff
changeset
|
728 return (existing != 0); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
729 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
730 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
731 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
732 virtual bool LookupResource(int64_t& id, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
733 ResourceType& type, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
734 const std::string& publicId) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
735 { |
4602
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
736 uint8_t existing; |
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
737 OrthancPluginResourceType t; |
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
738 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
|
739 CheckNoEvent(); |
4602
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
740 |
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
741 if (existing == 0) |
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
742 { |
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
743 return false; |
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
744 } |
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
745 else |
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
746 { |
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
747 type = Plugins::Convert(t); |
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
748 return true; |
cfdd1f59ff6f
fix OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4601
diff
changeset
|
749 } |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
750 } |
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 virtual bool SelectPatientToRecycle(int64_t& internalId) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
754 { |
4615
b91ed9e7f43c
minor api improvements in OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4607
diff
changeset
|
755 uint8_t available; |
b91ed9e7f43c
minor api improvements in OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4607
diff
changeset
|
756 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
|
757 CheckNoEvent(); |
4615
b91ed9e7f43c
minor api improvements in OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4607
diff
changeset
|
758 return (available != 0); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
759 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
760 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
761 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
762 virtual bool SelectPatientToRecycle(int64_t& internalId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
763 int64_t patientIdToAvoid) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
764 { |
4615
b91ed9e7f43c
minor api improvements in OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4607
diff
changeset
|
765 uint8_t available; |
b91ed9e7f43c
minor api improvements in OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4607
diff
changeset
|
766 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
|
767 CheckNoEvent(); |
4615
b91ed9e7f43c
minor api improvements in OrthancCDatabasePlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4607
diff
changeset
|
768 return (available != 0); |
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 SetGlobalProperty(GlobalProperty property, |
4607
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4604
diff
changeset
|
773 bool shared, |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
774 const std::string& value) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
775 { |
4607
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4604
diff
changeset
|
776 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
|
777 |
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4604
diff
changeset
|
778 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
|
779 CheckNoEvent(); |
4595
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
783 virtual void ClearMainDicomTags(int64_t id) 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_.clearMainDicomTags(transaction_, id)); |
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 void SetMetadata(int64_t id, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
791 MetadataType type, |
4623
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4615
diff
changeset
|
792 const std::string& value, |
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4615
diff
changeset
|
793 int64_t revision) ORTHANC_OVERRIDE |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
794 { |
4623
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4615
diff
changeset
|
795 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
|
796 CheckNoEvent(); |
4595
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
800 virtual void SetProtectedPatient(int64_t internalId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
801 bool isProtected) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
802 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
803 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
|
804 CheckNoEvent(); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
805 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
806 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
807 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
808 virtual bool IsDiskSizeAbove(uint64_t threshold) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
809 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
810 uint8_t tmp; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
811 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
|
812 CheckNoEvent(); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
813 return (tmp != 0); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
814 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
815 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
816 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
817 virtual void ApplyLookupResources(std::list<std::string>& resourcesId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
818 std::list<std::string>* instancesId, // Can be NULL if not needed |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
819 const std::vector<DatabaseConstraint>& lookup, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
820 ResourceType queryLevel, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
821 size_t limit) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
822 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
823 std::vector<OrthancPluginDatabaseConstraint> constraints; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
824 std::vector< std::vector<const char*> > constraintsValues; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
825 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
826 constraints.resize(lookup.size()); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
827 constraintsValues.resize(lookup.size()); |
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 for (size_t i = 0; i < lookup.size(); i++) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
830 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
831 lookup[i].EncodeForPlugins(constraints[i], constraintsValues[i]); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
832 } |
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 CheckSuccess(that_.backend_.lookupResources(transaction_, lookup.size(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
835 (lookup.empty() ? NULL : &constraints[0]), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
836 Plugins::Convert(queryLevel), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
837 limit, (instancesId == NULL ? 0 : 1))); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
838 CheckNoEvent(); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
839 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
840 uint32_t count; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
841 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
842 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
843 resourcesId.clear(); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
844 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
845 if (instancesId != NULL) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
846 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
847 instancesId->clear(); |
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 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
850 for (uint32_t i = 0; i < count; i++) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
851 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
852 OrthancPluginMatchingResource resource; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
853 CheckSuccess(that_.backend_.readAnswerMatchingResource(transaction_, &resource, i)); |
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 if (resource.resourceId == NULL) |
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 throw OrthancException(ErrorCode_DatabasePlugin); |
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 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
860 resourcesId.push_back(resource.resourceId); |
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 if (instancesId != NULL) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
863 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
864 if (resource.someInstanceId == NULL) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
865 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
866 throw OrthancException(ErrorCode_DatabasePlugin); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
867 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
868 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
869 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
870 instancesId->push_back(resource.someInstanceId); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
871 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
872 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
873 } |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
874 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
875 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
876 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
877 virtual bool CreateInstance(CreateInstanceResult& result, /* out */ |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
878 int64_t& instanceId, /* out */ |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
879 const std::string& patient, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
880 const std::string& study, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
881 const std::string& series, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
882 const std::string& instance) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
883 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
884 OrthancPluginCreateInstanceResult output; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
885 memset(&output, 0, sizeof(output)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
886 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
887 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
|
888 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
|
889 CheckNoEvent(); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
890 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
891 instanceId = output.instanceId; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
892 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
893 if (output.isNewInstance) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
894 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
895 result.isNewPatient_ = output.isNewPatient; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
896 result.isNewStudy_ = output.isNewStudy; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
897 result.isNewSeries_ = output.isNewSeries; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
898 result.patientId_ = output.patientId; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
899 result.studyId_ = output.studyId; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
900 result.seriesId_ = output.seriesId; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
901 return true; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
902 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
903 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
904 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
905 return false; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
906 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
907 |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
908 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
909 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
910 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
911 virtual void SetResourcesContent(const ResourcesContent& content) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
912 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
913 std::vector<OrthancPluginResourcesContentTags> identifierTags; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
914 std::vector<OrthancPluginResourcesContentTags> mainDicomTags; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
915 std::vector<OrthancPluginResourcesContentMetadata> metadata; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
916 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
917 identifierTags.reserve(content.GetListTags().size()); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
918 mainDicomTags.reserve(content.GetListTags().size()); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
919 metadata.reserve(content.GetListMetadata().size()); |
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 for (ResourcesContent::ListTags::const_iterator |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
922 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
|
923 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
924 OrthancPluginResourcesContentTags tmp; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
925 tmp.resource = it->resourceId_; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
926 tmp.group = it->tag_.GetGroup(); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
927 tmp.element = it->tag_.GetElement(); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
928 tmp.value = it->value_.c_str(); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
929 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
930 if (it->isIdentifier_) |
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 identifierTags.push_back(tmp); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
933 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
934 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
935 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
936 mainDicomTags.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 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
940 for (ResourcesContent::ListMetadata::const_iterator |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
941 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
|
942 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
943 OrthancPluginResourcesContentMetadata tmp; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
944 tmp.resource = it->resourceId_; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
945 tmp.metadata = it->metadata_; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
946 tmp.value = it->value_.c_str(); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
947 metadata.push_back(tmp); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
948 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
949 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
950 assert(identifierTags.size() + mainDicomTags.size() == content.GetListTags().size() && |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
951 metadata.size() == content.GetListMetadata().size()); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
952 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
953 CheckSuccess(that_.backend_.setResourcesContent(transaction_, |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
954 identifierTags.size(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
955 (identifierTags.empty() ? NULL : &identifierTags[0]), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
956 mainDicomTags.size(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
957 (mainDicomTags.empty() ? NULL : &mainDicomTags[0]), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
958 metadata.size(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
959 (metadata.empty() ? NULL : &metadata[0]))); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
960 CheckNoEvent(); |
4595
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
964 virtual void GetChildrenMetadata(std::list<std::string>& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
965 int64_t resourceId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
966 MetadataType metadata) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
967 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
968 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
|
969 CheckNoEvent(); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
970 ReadStringAnswers(target); |
4595
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
973 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
974 virtual int64_t GetLastChangeIndex() ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
975 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
976 int64_t tmp; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
977 CheckSuccess(that_.backend_.getLastChangeIndex(transaction_, &tmp)); |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
978 CheckNoEvent(); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
979 return tmp; |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
980 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
981 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
982 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
983 virtual bool LookupResourceAndParent(int64_t& id, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
984 ResourceType& type, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
985 std::string& parentPublicId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
986 const std::string& publicId) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
987 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
988 uint8_t isExisting; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
989 OrthancPluginResourceType tmpType; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
990 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
|
991 CheckNoEvent(); |
4598
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 if (isExisting) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
994 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
995 type = Plugins::Convert(tmpType); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
996 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
997 uint32_t count; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
998 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
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 if (count > 1) |
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 throw OrthancException(ErrorCode_DatabasePlugin); |
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 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1005 switch (type) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1006 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1007 case ResourceType_Patient: |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1008 // A patient has no parent |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1009 if (count == 1) |
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 throw OrthancException(ErrorCode_DatabasePlugin); |
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 break; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1014 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1015 case ResourceType_Study: |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1016 case ResourceType_Series: |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1017 case ResourceType_Instance: |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1018 if (count == 0) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1019 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1020 throw OrthancException(ErrorCode_DatabasePlugin); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1021 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1022 else |
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 const char* value = NULL; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1025 CheckSuccess(that_.backend_.readAnswerString(transaction_, &value, 0)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1026 if (value == NULL) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1027 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1028 throw OrthancException(ErrorCode_DatabasePlugin); |
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 else |
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 parentPublicId.assign(value); |
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 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1035 break; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1036 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1037 default: |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1038 throw OrthancException(ErrorCode_DatabasePlugin); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1039 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1040 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1041 return true; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1042 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1043 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1044 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1045 return false; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
1046 } |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1047 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1048 }; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1049 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1050 |
4628
5fabef29c4ff
added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4627
diff
changeset
|
1051 void OrthancPluginDatabaseV3::CheckSuccess(OrthancPluginErrorCode code) const |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1052 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1053 if (code != OrthancPluginErrorCode_Success) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1054 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1055 errorDictionary_.LogError(code, true); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1056 throw OrthancException(static_cast<ErrorCode>(code)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1057 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1058 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1059 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1060 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1061 OrthancPluginDatabaseV3::OrthancPluginDatabaseV3(SharedLibrary& library, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1062 PluginsErrorDictionary& errorDictionary, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1063 const OrthancPluginDatabaseBackendV3* backend, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1064 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
|
1065 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
|
1066 const std::string& serverIdentifier) : |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1067 library_(library), |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1068 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
|
1069 database_(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
|
1070 serverIdentifier_(serverIdentifier) |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1071 { |
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
|
1072 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
|
1073 << "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
|
1074 |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1075 if (backendSize >= sizeof(backend_)) |
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 memcpy(&backend_, backend, sizeof(backend_)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1078 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1079 else |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1080 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1081 // Not all the primitives are implemented by the plugin |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1082 memset(&backend_, 0, sizeof(backend_)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1083 memcpy(&backend_, backend, backendSize); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1084 } |
4601
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1085 |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1086 // Sanity checks |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1087 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
|
1088 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
|
1089 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
|
1090 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
|
1091 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
|
1092 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
|
1093 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
|
1094 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
|
1095 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
|
1096 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
|
1097 |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1098 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
|
1099 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
|
1100 |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1101 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
|
1102 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
|
1103 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
|
1104 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
|
1105 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
|
1106 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
|
1107 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
|
1108 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
|
1109 |
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_, rollback); |
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_, commit); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1112 |
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_, addAttachment); |
27c07dbf6b4f
check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4600
diff
changeset
|
1114 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
|
1115 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
|
1116 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
|
1117 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
|
1118 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
|
1119 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
|
1120 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
|
1121 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
|
1122 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
|
1123 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
|
1124 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
|
1125 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
|
1126 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
|
1127 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
|
1128 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
|
1129 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
|
1130 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
|
1131 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
|
1132 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
|
1133 CHECK_FUNCTION_EXISTS(backend_, getPublicId); |
4627
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
1134 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
|
1135 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
|
1136 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
|
1137 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
|
1138 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
|
1139 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
|
1140 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
|
1141 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
|
1142 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
|
1143 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
|
1144 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
|
1145 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
|
1146 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
|
1147 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
|
1148 CHECK_FUNCTION_EXISTS(backend_, lookupResource); |
4627
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
1149 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
|
1150 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
|
1151 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
|
1152 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
|
1153 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
|
1154 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
|
1155 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
|
1156 CHECK_FUNCTION_EXISTS(backend_, setResourcesContent); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1157 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1158 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1159 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1160 OrthancPluginDatabaseV3::~OrthancPluginDatabaseV3() |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1161 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1162 if (database_ != NULL) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1163 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1164 OrthancPluginErrorCode code = backend_.destructDatabase(database_); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1165 if (code != OrthancPluginErrorCode_Success) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1166 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1167 // Don't throw exception in destructors |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1168 errorDictionary_.LogError(code, true); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1169 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1170 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1171 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1172 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1173 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1174 void OrthancPluginDatabaseV3::Open() |
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 CheckSuccess(backend_.open(database_)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1177 } |
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1180 void OrthancPluginDatabaseV3::Close() |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1181 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1182 CheckSuccess(backend_.close(database_)); |
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1185 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1186 IDatabaseWrapper::ITransaction* OrthancPluginDatabaseV3::StartTransaction(TransactionType type, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1187 IDatabaseListener& listener) |
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 switch (type) |
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 case TransactionType_ReadOnly: |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
1192 return new Transaction(*this, listener, OrthancPluginDatabaseTransactionType_ReadOnly); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1193 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1194 case TransactionType_ReadWrite: |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
1195 return new Transaction(*this, listener, OrthancPluginDatabaseTransactionType_ReadWrite); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1196 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1197 default: |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1198 throw OrthancException(ErrorCode_InternalError); |
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1203 unsigned int OrthancPluginDatabaseV3::GetDatabaseVersion() |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1204 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1205 uint32_t version = 0; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1206 CheckSuccess(backend_.getDatabaseVersion(database_, &version)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1207 return version; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1208 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1209 |
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 void OrthancPluginDatabaseV3::Upgrade(unsigned int targetVersion, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1212 IStorageArea& storageArea) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1213 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1214 VoidDatabaseListener listener; |
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 if (backend_.upgradeDatabase != NULL) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1217 { |
4600
c02a04e6161d
processing of database events in OrthancPluginDatabaseV3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4598
diff
changeset
|
1218 Transaction transaction(*this, listener, OrthancPluginDatabaseTransactionType_ReadWrite); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1219 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1220 OrthancPluginErrorCode code = backend_.upgradeDatabase( |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1221 database_, reinterpret_cast<OrthancPluginStorageArea*>(&storageArea), |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1222 static_cast<uint32_t>(targetVersion)); |
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 if (code == OrthancPluginErrorCode_Success) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1225 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1226 transaction.Commit(0); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1227 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1228 else |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1229 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1230 transaction.Rollback(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1231 errorDictionary_.LogError(code, true); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1232 throw OrthancException(static_cast<ErrorCode>(code)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1233 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1234 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1235 } |
4628
5fabef29c4ff
added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4627
diff
changeset
|
1236 |
5fabef29c4ff
added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4627
diff
changeset
|
1237 |
5fabef29c4ff
added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4627
diff
changeset
|
1238 bool OrthancPluginDatabaseV3::HasRevisionsSupport() const |
5fabef29c4ff
added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4627
diff
changeset
|
1239 { |
5fabef29c4ff
added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4627
diff
changeset
|
1240 // WARNING: This method requires "Open()" to have been called |
5fabef29c4ff
added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4627
diff
changeset
|
1241 uint8_t hasRevisions; |
5fabef29c4ff
added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4627
diff
changeset
|
1242 CheckSuccess(backend_.hasRevisionsSupport(database_, &hasRevisions)); |
5fabef29c4ff
added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4627
diff
changeset
|
1243 return (hasRevisions != 0); |
5fabef29c4ff
added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4627
diff
changeset
|
1244 } |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1245 } |