Mercurial > hg > orthanc
annotate OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp @ 4598:da2e0a457eae db-changes
OrthancPluginDatabaseV3::Transaction is fully implemented
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 18 Mar 2021 11:26:10 +0100 |
parents | cc64385593ef |
children | c02a04e6161d |
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * 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
|
8 * 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
|
9 * 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
|
10 * License, or (at your option) any later version. |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * 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
|
13 * 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
|
14 * 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
|
15 * 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
|
16 * 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
|
17 * 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
|
18 * 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
|
19 * 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
|
20 * 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
|
21 * 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
|
22 * in the program, then also delete it here. |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 * |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 * 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
|
25 * WITHOUT ANY WARRANTY; without even the implied warranty of |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 * 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
|
27 * General Public License for more details. |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 * |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 * 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
|
30 * 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
|
31 **/ |
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 #include "../../Sources/PrecompiledHeadersServer.h" |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 #include "OrthancPluginDatabaseV3.h" |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 #if ORTHANC_ENABLE_PLUGINS != 1 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 # error The plugin support is disabled |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 #endif |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 #include "../../../OrthancFramework/Sources/Logging.h" |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 #include "../../../OrthancFramework/Sources/OrthancException.h" |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
43 #include "../../Sources/Database/ResourcesContent.h" |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 #include "../../Sources/Database/VoidDatabaseListener.h" |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 #include "PluginsEnumerations.h" |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 #include <cassert> |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 namespace Orthanc |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 class OrthancPluginDatabaseV3::Transaction : public IDatabaseWrapper::ITransaction |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 private: |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 OrthancPluginDatabaseV3& that_; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 IDatabaseListener& listener_; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 OrthancPluginDatabaseTransaction* transaction_; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 void CheckSuccess(OrthancPluginErrorCode code) const |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 that_.CheckSuccess(code); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 void ReadStringAnswers(std::list<std::string>& target) |
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 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
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 target.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 for (uint32_t i = 0; i < count; i++) |
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 const char* value = NULL; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 CheckSuccess(that_.backend_.readAnswerString(transaction_, &value, i)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 if (value == NULL) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 throw OrthancException(ErrorCode_DatabasePlugin); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 else |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 target.push_back(value); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
86 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
87 bool ReadSingleStringAnswer(std::string& target) |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 if (count == 0) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
94 return false; |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 else if (count == 1) |
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 const char* value = NULL; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 CheckSuccess(that_.backend_.readAnswerString(transaction_, &value, 0)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 if (value == NULL) |
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 throw OrthancException(ErrorCode_DatabasePlugin); |
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 else |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
105 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
106 target.assign(value); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
107 return true; |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 } |
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 else |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
111 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
112 throw OrthancException(ErrorCode_DatabasePlugin); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
113 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
114 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
115 |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
116 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
117 bool ReadSingleInt64Answer(int64_t& target) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
118 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
119 uint32_t count; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
120 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
121 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
122 if (count == 0) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
123 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
124 return false; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
125 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
126 else if (count == 1) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
127 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
128 CheckSuccess(that_.backend_.readAnswerInt64(transaction_, &target, 0)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
129 return true; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
130 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
131 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
132 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
133 throw OrthancException(ErrorCode_DatabasePlugin); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
134 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
135 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
136 |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
137 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
138 ExportedResource ReadAnswerExportedResource(uint32_t answerIndex) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
140 OrthancPluginExportedResource exported; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
141 CheckSuccess(that_.backend_.readAnswerExportedResource(transaction_, &exported, answerIndex)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
142 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
143 if (exported.publicId == NULL || |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
144 exported.modality == NULL || |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 exported.date == NULL || |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
146 exported.patientId == NULL || |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
147 exported.studyInstanceUid == NULL || |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
148 exported.seriesInstanceUid == NULL || |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
149 exported.sopInstanceUid == NULL) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
150 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
151 throw OrthancException(ErrorCode_DatabasePlugin); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
152 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
153 else |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
154 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
155 return ExportedResource(exported.seq, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
156 Plugins::Convert(exported.resourceType), |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 exported.publicId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
158 exported.modality, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
159 exported.date, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
160 exported.patientId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
161 exported.studyInstanceUid, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
162 exported.seriesInstanceUid, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
163 exported.sopInstanceUid); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
164 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
165 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
166 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
167 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
168 ServerIndexChange ReadAnswerChange(uint32_t answerIndex) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
169 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
170 OrthancPluginChange change; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
171 CheckSuccess(that_.backend_.readAnswerChange(transaction_, &change, answerIndex)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
172 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
173 if (change.publicId == NULL || |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
174 change.date == NULL) |
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 throw OrthancException(ErrorCode_DatabasePlugin); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
177 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
178 else |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
179 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
180 return ServerIndexChange(change.seq, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
181 static_cast<ChangeType>(change.changeType), |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
182 Plugins::Convert(change.resourceType), |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
183 change.publicId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
184 change.date); |
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 public: |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
190 Transaction(OrthancPluginDatabaseV3& that, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
191 IDatabaseListener& listener, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
192 _OrthancPluginDatabaseTransactionType type) : |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
193 that_(that), |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
194 listener_(listener) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
195 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
196 CheckSuccess(that.backend_.startTransaction(that.database_, &transaction_, type)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
197 if (transaction_ == NULL) |
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 throw OrthancException(ErrorCode_DatabasePlugin); |
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 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
202 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
203 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
204 virtual ~Transaction() |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
205 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
206 OrthancPluginErrorCode code = that_.backend_.destructTransaction(transaction_); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
207 if (code != OrthancPluginErrorCode_Success) |
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 // Don't throw exception in destructors |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
210 that_.errorDictionary_.LogError(code, true); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
211 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
212 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
213 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
214 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
215 virtual void Rollback() ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
216 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
217 CheckSuccess(that_.backend_.rollback(transaction_)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
218 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
219 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
220 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
221 virtual void Commit(int64_t fileSizeDelta) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
222 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
223 CheckSuccess(that_.backend_.commit(transaction_, fileSizeDelta)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
224 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
225 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
226 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
227 virtual void AddAttachment(int64_t id, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
228 const FileInfo& attachment) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
229 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
230 OrthancPluginAttachment tmp; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
231 tmp.uuid = attachment.GetUuid().c_str(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
232 tmp.contentType = static_cast<int32_t>(attachment.GetContentType()); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
233 tmp.uncompressedSize = attachment.GetUncompressedSize(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
234 tmp.uncompressedHash = attachment.GetUncompressedMD5().c_str(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
235 tmp.compressionType = static_cast<int32_t>(attachment.GetCompressionType()); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
236 tmp.compressedSize = attachment.GetCompressedSize(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
237 tmp.compressedHash = attachment.GetCompressedMD5().c_str(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
238 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
239 CheckSuccess(that_.backend_.addAttachment(transaction_, id, &tmp)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
240 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
241 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
242 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
243 virtual void ClearChanges() ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
244 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
245 CheckSuccess(that_.backend_.clearChanges(transaction_)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
246 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
247 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
248 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
249 virtual void ClearExportedResources() ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
250 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
251 CheckSuccess(that_.backend_.clearExportedResources(transaction_)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
252 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
253 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
254 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
255 virtual void DeleteAttachment(int64_t id, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
256 FileContentType attachment) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
257 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
258 CheckSuccess(that_.backend_.deleteAttachment(transaction_, id, static_cast<int32_t>(attachment))); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
259 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
260 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
261 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
262 virtual void DeleteMetadata(int64_t id, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
263 MetadataType type) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
264 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
265 CheckSuccess(that_.backend_.deleteMetadata(transaction_, id, static_cast<int32_t>(type))); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
266 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
267 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
268 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
269 virtual void DeleteResource(int64_t id) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
270 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
271 CheckSuccess(that_.backend_.deleteResource(transaction_, id)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
272 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
273 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
274 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
275 virtual void GetAllMetadata(std::map<MetadataType, std::string>& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
276 int64_t id) ORTHANC_OVERRIDE |
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 CheckSuccess(that_.backend_.getAllMetadata(transaction_, id)); |
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 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
281 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
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 target.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
284 for (uint32_t i = 0; i < count; i++) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
285 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
286 int32_t metadata; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
287 const char* value = NULL; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
288 CheckSuccess(that_.backend_.readAnswerMetadata(transaction_, &metadata, &value, i)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
289 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
290 if (value == NULL) |
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 throw OrthancException(ErrorCode_DatabasePlugin); |
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 else |
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 target[static_cast<MetadataType>(metadata)] = value; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
297 } |
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
302 virtual void GetAllPublicIds(std::list<std::string>& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
303 ResourceType resourceType) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
304 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
305 CheckSuccess(that_.backend_.getAllPublicIds(transaction_, Plugins::Convert(resourceType))); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
306 ReadStringAnswers(target); |
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
309 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
310 virtual void GetAllPublicIds(std::list<std::string>& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
311 ResourceType resourceType, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
312 size_t since, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
313 size_t limit) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
314 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
315 CheckSuccess(that_.backend_.getAllPublicIdsWithLimit( |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
316 transaction_, Plugins::Convert(resourceType), |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
317 static_cast<uint64_t>(since), static_cast<uint64_t>(limit))); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
318 ReadStringAnswers(target); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
319 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
320 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
321 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
322 virtual void GetChanges(std::list<ServerIndexChange>& target /*out*/, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
323 bool& done /*out*/, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
324 int64_t since, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
325 uint32_t maxResults) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
326 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
327 uint8_t tmpDone = true; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
328 CheckSuccess(that_.backend_.getChanges(transaction_, &tmpDone, since, maxResults)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
329 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
330 done = (tmpDone != 0); |
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 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
333 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
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 target.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
336 for (uint32_t i = 0; i < count; i++) |
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 target.push_back(ReadAnswerChange(i)); |
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 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
341 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
342 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
343 virtual void GetChildrenInternalId(std::list<int64_t>& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
344 int64_t id) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
345 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
346 CheckSuccess(that_.backend_.getChildrenInternalId(transaction_, id)); |
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 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
349 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
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 target.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
352 for (uint32_t i = 0; i < count; i++) |
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 int64_t value; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
355 CheckSuccess(that_.backend_.readAnswerInt64(transaction_, &value, i)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
356 target.push_back(value); |
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 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
359 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
360 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
361 virtual void GetChildrenPublicId(std::list<std::string>& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
362 int64_t id) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
363 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
364 CheckSuccess(that_.backend_.getChildrenPublicId(transaction_, id)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
365 ReadStringAnswers(target); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
366 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
367 |
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 virtual void GetExportedResources(std::list<ExportedResource>& target /*out*/, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
370 bool& done /*out*/, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
371 int64_t since, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
372 uint32_t maxResults) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
373 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
374 uint8_t tmpDone = true; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
375 CheckSuccess(that_.backend_.getExportedResources(transaction_, &tmpDone, since, maxResults)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
376 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
377 done = (tmpDone != 0); |
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 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
380 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
381 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
382 target.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
383 for (uint32_t i = 0; i < count; i++) |
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.push_back(ReadAnswerExportedResource(i)); |
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 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
|
391 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
392 CheckSuccess(that_.backend_.getLastChange(transaction_)); |
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 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
395 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
396 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
397 target.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
398 if (count == 1) |
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 target.push_back(ReadAnswerChange(0)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
401 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
402 else if (count > 1) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
403 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
404 throw OrthancException(ErrorCode_DatabasePlugin); |
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 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
407 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
408 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
409 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
|
410 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
411 CheckSuccess(that_.backend_.getLastExportedResource(transaction_)); |
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 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
414 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
415 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
416 target.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
417 if (count == 1) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
418 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
419 target.push_back(ReadAnswerExportedResource(0)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
420 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
421 else if (count > 1) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
422 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
423 throw OrthancException(ErrorCode_DatabasePlugin); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
424 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
425 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
426 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
427 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
428 virtual void GetMainDicomTags(DicomMap& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
429 int64_t id) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
430 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
431 CheckSuccess(that_.backend_.getMainDicomTags(transaction_, id)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
432 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
433 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
434 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
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 target.Clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
437 for (uint32_t i = 0; i < count; i++) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
438 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
439 uint16_t group, element; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
440 const char* value = NULL; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
441 CheckSuccess(that_.backend_.readAnswerDicomTag(transaction_, &group, &element, &value, i)); |
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 if (value == NULL) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
444 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
445 throw OrthancException(ErrorCode_DatabasePlugin); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
446 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
447 else |
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 target.SetValue(group, element, std::string(value), false); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
450 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
451 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
452 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
453 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
454 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
455 virtual std::string GetPublicId(int64_t resourceId) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
456 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
457 CheckSuccess(that_.backend_.getPublicId(transaction_, resourceId)); |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
458 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
459 std::string s; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
460 if (ReadSingleStringAnswer(s)) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
461 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
462 return s; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
463 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
464 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
465 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
466 throw OrthancException(ErrorCode_InexistentItem); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
467 } |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
468 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
469 |
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 virtual uint64_t GetResourcesCount(ResourceType resourceType) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
472 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
473 uint64_t value; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
474 CheckSuccess(that_.backend_.getResourcesCount(transaction_, &value, Plugins::Convert(resourceType))); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
475 return value; |
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
478 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
479 virtual ResourceType GetResourceType(int64_t resourceId) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
480 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
481 OrthancPluginResourceType type; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
482 CheckSuccess(that_.backend_.getResourceType(transaction_, &type, resourceId)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
483 return Plugins::Convert(type); |
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 virtual uint64_t GetTotalCompressedSize() ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
488 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
489 uint64_t s; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
490 CheckSuccess(that_.backend_.getTotalCompressedSize(transaction_, &s)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
491 return s; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
492 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
493 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
494 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
495 virtual uint64_t GetTotalUncompressedSize() ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
496 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
497 uint64_t s; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
498 CheckSuccess(that_.backend_.getTotalUncompressedSize(transaction_, &s)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
499 return s; |
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 |
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 virtual bool IsExistingResource(int64_t internalId) ORTHANC_OVERRIDE |
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 uint8_t b; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
506 CheckSuccess(that_.backend_.isExistingResource(transaction_, &b, internalId)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
507 return (b != 0); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
508 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
509 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
510 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
511 virtual bool IsProtectedPatient(int64_t internalId) ORTHANC_OVERRIDE |
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 uint8_t b; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
514 CheckSuccess(that_.backend_.isProtectedPatient(transaction_, &b, internalId)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
515 return (b != 0); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
516 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
517 |
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 virtual void ListAvailableAttachments(std::set<FileContentType>& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
520 int64_t id) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
521 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
522 CheckSuccess(that_.backend_.listAvailableAttachments(transaction_, id)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
523 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
524 uint32_t count; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
525 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
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 target.clear(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
528 for (uint32_t i = 0; i < count; i++) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
529 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
530 int32_t value; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
531 CheckSuccess(that_.backend_.readAnswerInt32(transaction_, &value, i)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
532 target.insert(static_cast<FileContentType>(value)); |
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 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
535 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
536 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
537 virtual void LogChange(int64_t internalId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
538 const ServerIndexChange& change) ORTHANC_OVERRIDE |
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 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
|
541 internalId, Plugins::Convert(change.GetResourceType()), |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
542 change.GetDate().c_str())); |
4595
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 |
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 virtual void LogExportedResource(const ExportedResource& resource) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
547 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
548 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
|
549 resource.GetPublicId().c_str(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
550 resource.GetModality().c_str(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
551 resource.GetDate().c_str(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
552 resource.GetPatientId().c_str(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
553 resource.GetStudyInstanceUid().c_str(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
554 resource.GetSeriesInstanceUid().c_str(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
555 resource.GetSopInstanceUid().c_str())); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
556 } |
4595
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
559 virtual bool LookupAttachment(FileInfo& attachment, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
560 int64_t id, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
561 FileContentType contentType) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
562 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
563 CheckSuccess(that_.backend_.lookupAttachment(transaction_, id, static_cast<int32_t>(contentType))); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
564 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
565 uint32_t count; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
566 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
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 if (count == 0) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
569 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
570 return false; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
571 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
572 else if (count == 1) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
573 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
574 OrthancPluginAttachment tmp; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
575 CheckSuccess(that_.backend_.readAnswerAttachment(transaction_, &tmp, 0)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
576 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
577 attachment = FileInfo(tmp.uuid, |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
578 static_cast<FileContentType>(tmp.contentType), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
579 tmp.uncompressedSize, |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
580 tmp.uncompressedHash, |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
581 static_cast<CompressionType>(tmp.compressionType), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
582 tmp.compressedSize, |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
583 tmp.compressedHash); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
584 return true; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
585 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
586 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
587 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
588 throw OrthancException(ErrorCode_DatabasePlugin); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
589 } |
4595
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 |
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 virtual bool LookupGlobalProperty(std::string& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
594 GlobalProperty property) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
595 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
596 CheckSuccess(that_.backend_.lookupGlobalProperty(transaction_, static_cast<int32_t>(property))); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
597 return ReadSingleStringAnswer(target); |
4595
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
601 virtual bool LookupMetadata(std::string& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
602 int64_t id, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
603 MetadataType type) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
604 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
605 CheckSuccess(that_.backend_.lookupMetadata(transaction_, id, static_cast<int32_t>(type))); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
606 return ReadSingleStringAnswer(target); |
4595
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
610 virtual bool LookupParent(int64_t& parentId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
611 int64_t resourceId) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
612 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
613 CheckSuccess(that_.backend_.lookupParent(transaction_, resourceId)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
614 return ReadSingleInt64Answer(parentId); |
4595
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 LookupResource(int64_t& id, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
619 ResourceType& type, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
620 const std::string& publicId) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
621 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
622 CheckSuccess(that_.backend_.lookupResource(transaction_, Plugins::Convert(type), publicId.c_str())); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
623 return ReadSingleInt64Answer(id); |
4595
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 bool SelectPatientToRecycle(int64_t& internalId) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
628 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
629 CheckSuccess(that_.backend_.selectPatientToRecycle(transaction_)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
630 return ReadSingleInt64Answer(internalId); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
631 } |
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 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
634 virtual bool SelectPatientToRecycle(int64_t& internalId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
635 int64_t patientIdToAvoid) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
636 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
637 CheckSuccess(that_.backend_.selectPatientToRecycle2(transaction_, patientIdToAvoid)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
638 return ReadSingleInt64Answer(internalId); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
639 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
640 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
641 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
642 virtual void SetGlobalProperty(GlobalProperty property, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
643 const std::string& value) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
644 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
645 CheckSuccess(that_.backend_.setGlobalProperty(transaction_, static_cast<int32_t>(property), value.c_str())); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
646 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
647 |
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 virtual void ClearMainDicomTags(int64_t id) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
650 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
651 CheckSuccess(that_.backend_.clearMainDicomTags(transaction_, id)); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
652 } |
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 virtual void SetMetadata(int64_t id, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
656 MetadataType type, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
657 const std::string& value) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
658 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
659 CheckSuccess(that_.backend_.setMetadata(transaction_, id, static_cast<int32_t>(type), value.c_str())); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
660 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
661 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
662 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
663 virtual void SetProtectedPatient(int64_t internalId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
664 bool isProtected) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
665 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
666 CheckSuccess(that_.backend_.setProtectedPatient(transaction_, internalId, (isProtected ? 1 : 0))); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
667 } |
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 IsDiskSizeAbove(uint64_t threshold) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
671 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
672 uint8_t tmp; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
673 CheckSuccess(that_.backend_.isDiskSizeAbove(transaction_, &tmp, threshold)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
674 return (tmp != 0); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
675 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
676 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
677 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
678 virtual void ApplyLookupResources(std::list<std::string>& resourcesId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
679 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
|
680 const std::vector<DatabaseConstraint>& lookup, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
681 ResourceType queryLevel, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
682 size_t limit) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
683 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
684 std::vector<OrthancPluginDatabaseConstraint> constraints; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
685 std::vector< std::vector<const char*> > constraintsValues; |
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 constraints.resize(lookup.size()); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
688 constraintsValues.resize(lookup.size()); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
689 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
690 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
|
691 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
692 lookup[i].EncodeForPlugins(constraints[i], constraintsValues[i]); |
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 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
695 CheckSuccess(that_.backend_.lookupResources(transaction_, lookup.size(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
696 (lookup.empty() ? NULL : &constraints[0]), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
697 Plugins::Convert(queryLevel), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
698 limit, (instancesId == NULL ? 0 : 1))); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
699 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
700 uint32_t count; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
701 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
702 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
703 resourcesId.clear(); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
704 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
705 if (instancesId != NULL) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
706 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
707 instancesId->clear(); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
708 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
709 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
710 for (uint32_t i = 0; i < count; i++) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
711 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
712 OrthancPluginMatchingResource resource; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
713 CheckSuccess(that_.backend_.readAnswerMatchingResource(transaction_, &resource, i)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
714 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
715 if (resource.resourceId == NULL) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
716 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
717 throw OrthancException(ErrorCode_DatabasePlugin); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
718 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
719 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
720 resourcesId.push_back(resource.resourceId); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
721 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
722 if (instancesId != NULL) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
723 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
724 if (resource.someInstanceId == NULL) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
725 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
726 throw OrthancException(ErrorCode_DatabasePlugin); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
727 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
728 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
729 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
730 instancesId->push_back(resource.someInstanceId); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
731 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
732 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
733 } |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
734 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
735 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
736 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
737 virtual bool CreateInstance(CreateInstanceResult& result, /* out */ |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
738 int64_t& instanceId, /* out */ |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
739 const std::string& patient, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
740 const std::string& study, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
741 const std::string& series, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
742 const std::string& instance) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
743 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
744 OrthancPluginCreateInstanceResult output; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
745 memset(&output, 0, sizeof(output)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
746 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
747 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
|
748 study.c_str(), series.c_str(), instance.c_str())); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
749 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
750 instanceId = output.instanceId; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
751 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
752 if (output.isNewInstance) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
753 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
754 result.isNewPatient_ = output.isNewPatient; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
755 result.isNewStudy_ = output.isNewStudy; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
756 result.isNewSeries_ = output.isNewSeries; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
757 result.patientId_ = output.patientId; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
758 result.studyId_ = output.studyId; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
759 result.seriesId_ = output.seriesId; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
760 return true; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
761 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
762 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
763 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
764 return false; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
765 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
766 |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
767 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
768 |
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 virtual void SetResourcesContent(const ResourcesContent& content) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
771 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
772 std::vector<OrthancPluginResourcesContentTags> identifierTags; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
773 std::vector<OrthancPluginResourcesContentTags> mainDicomTags; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
774 std::vector<OrthancPluginResourcesContentMetadata> metadata; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
775 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
776 identifierTags.reserve(content.GetListTags().size()); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
777 mainDicomTags.reserve(content.GetListTags().size()); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
778 metadata.reserve(content.GetListMetadata().size()); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
779 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
780 for (ResourcesContent::ListTags::const_iterator |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
781 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
|
782 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
783 OrthancPluginResourcesContentTags tmp; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
784 tmp.resource = it->resourceId_; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
785 tmp.group = it->tag_.GetGroup(); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
786 tmp.element = it->tag_.GetElement(); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
787 tmp.value = it->value_.c_str(); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
788 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
789 if (it->isIdentifier_) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
790 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
791 identifierTags.push_back(tmp); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
792 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
793 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
794 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
795 mainDicomTags.push_back(tmp); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
796 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
797 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
798 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
799 for (ResourcesContent::ListMetadata::const_iterator |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
800 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
|
801 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
802 OrthancPluginResourcesContentMetadata tmp; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
803 tmp.resource = it->resourceId_; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
804 tmp.metadata = it->metadata_; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
805 tmp.value = it->value_.c_str(); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
806 metadata.push_back(tmp); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
807 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
808 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
809 assert(identifierTags.size() + mainDicomTags.size() == content.GetListTags().size() && |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
810 metadata.size() == content.GetListMetadata().size()); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
811 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
812 CheckSuccess(that_.backend_.setResourcesContent(transaction_, |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
813 identifierTags.size(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
814 (identifierTags.empty() ? NULL : &identifierTags[0]), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
815 mainDicomTags.size(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
816 (mainDicomTags.empty() ? NULL : &mainDicomTags[0]), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
817 metadata.size(), |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
818 (metadata.empty() ? NULL : &metadata[0]))); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
819 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
820 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
821 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
822 virtual void GetChildrenMetadata(std::list<std::string>& target, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
823 int64_t resourceId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
824 MetadataType metadata) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
825 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
826 CheckSuccess(that_.backend_.getChildrenMetadata(transaction_, resourceId, static_cast<int32_t>(metadata))); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
827 ReadStringAnswers(target); |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
828 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
829 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
830 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
831 virtual int64_t GetLastChangeIndex() ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
832 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
833 int64_t tmp; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
834 CheckSuccess(that_.backend_.getLastChangeIndex(transaction_, &tmp)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
835 return tmp; |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
836 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
837 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
838 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
839 virtual bool LookupResourceAndParent(int64_t& id, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
840 ResourceType& type, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
841 std::string& parentPublicId, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
842 const std::string& publicId) ORTHANC_OVERRIDE |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
843 { |
4598
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
844 uint8_t isExisting; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
845 OrthancPluginResourceType tmpType; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
846 CheckSuccess(that_.backend_.lookupResourceAndParent(transaction_, &isExisting, &id, &tmpType, publicId.c_str())); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
847 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
848 if (isExisting) |
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 type = Plugins::Convert(tmpType); |
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 uint32_t count; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
853 CheckSuccess(that_.backend_.readAnswersCount(transaction_, &count)); |
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 (count > 1) |
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 switch (type) |
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 case ResourceType_Patient: |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
863 // A patient has no parent |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
864 if (count == 1) |
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 break; |
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 case ResourceType_Study: |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
871 case ResourceType_Series: |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
872 case ResourceType_Instance: |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
873 if (count == 0) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
874 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
875 throw OrthancException(ErrorCode_DatabasePlugin); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
876 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
877 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
878 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
879 const char* value = NULL; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
880 CheckSuccess(that_.backend_.readAnswerString(transaction_, &value, 0)); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
881 if (value == NULL) |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
882 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
883 throw OrthancException(ErrorCode_DatabasePlugin); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
884 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
885 else |
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 parentPublicId.assign(value); |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
888 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
889 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
890 break; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
891 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
892 default: |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
893 throw OrthancException(ErrorCode_DatabasePlugin); |
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 |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
896 return true; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
897 } |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
898 else |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
899 { |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
900 return false; |
da2e0a457eae
OrthancPluginDatabaseV3::Transaction is fully implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
901 } |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
902 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
903 }; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
904 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
905 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
906 void OrthancPluginDatabaseV3::CheckSuccess(OrthancPluginErrorCode code) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
907 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
908 if (code != OrthancPluginErrorCode_Success) |
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 errorDictionary_.LogError(code, true); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
911 throw OrthancException(static_cast<ErrorCode>(code)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
912 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
913 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
914 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
915 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
916 OrthancPluginDatabaseV3::OrthancPluginDatabaseV3(SharedLibrary& library, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
917 PluginsErrorDictionary& errorDictionary, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
918 const OrthancPluginDatabaseBackendV3* backend, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
919 size_t backendSize, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
920 OrthancPluginDatabaseContext* database) : |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
921 library_(library), |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
922 errorDictionary_(errorDictionary), |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
923 database_(database) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
924 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
925 if (backendSize >= sizeof(backend_)) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
926 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
927 memcpy(&backend_, backend, sizeof(backend_)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
928 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
929 else |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
930 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
931 // Not all the primitives are implemented by the plugin |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
932 memset(&backend_, 0, sizeof(backend_)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
933 memcpy(&backend_, backend, backendSize); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
934 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
935 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
936 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
937 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
938 OrthancPluginDatabaseV3::~OrthancPluginDatabaseV3() |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
939 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
940 if (database_ != NULL) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
941 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
942 OrthancPluginErrorCode code = backend_.destructDatabase(database_); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
943 if (code != OrthancPluginErrorCode_Success) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
944 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
945 // Don't throw exception in destructors |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
946 errorDictionary_.LogError(code, true); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
947 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
948 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
949 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
950 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
951 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
952 void OrthancPluginDatabaseV3::Open() |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
953 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
954 CheckSuccess(backend_.open(database_)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
955 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
956 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
957 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
958 void OrthancPluginDatabaseV3::Close() |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
959 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
960 CheckSuccess(backend_.close(database_)); |
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 IDatabaseWrapper::ITransaction* OrthancPluginDatabaseV3::StartTransaction(TransactionType type, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
965 IDatabaseListener& listener) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
966 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
967 switch (type) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
968 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
969 case TransactionType_ReadOnly: |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
970 return new Transaction(*this, listener, _OrthancPluginDatabaseTransactionType_ReadOnly); |
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 case TransactionType_ReadWrite: |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
973 return new Transaction(*this, listener, _OrthancPluginDatabaseTransactionType_ReadWrite); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
974 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
975 default: |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
976 throw OrthancException(ErrorCode_InternalError); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
977 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
978 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
979 |
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 unsigned int OrthancPluginDatabaseV3::GetDatabaseVersion() |
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 uint32_t version = 0; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
984 CheckSuccess(backend_.getDatabaseVersion(database_, &version)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
985 return version; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
986 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
987 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
988 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
989 void OrthancPluginDatabaseV3::Upgrade(unsigned int targetVersion, |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
990 IStorageArea& storageArea) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
991 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
992 VoidDatabaseListener listener; |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
993 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
994 if (backend_.upgradeDatabase != NULL) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
995 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
996 Transaction transaction(*this, listener, _OrthancPluginDatabaseTransactionType_ReadWrite); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
997 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
998 OrthancPluginErrorCode code = backend_.upgradeDatabase( |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
999 database_, reinterpret_cast<OrthancPluginStorageArea*>(&storageArea), |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1000 static_cast<uint32_t>(targetVersion)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1001 |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1002 if (code == OrthancPluginErrorCode_Success) |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1003 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1004 transaction.Commit(0); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1005 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1006 else |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1007 { |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1008 transaction.Rollback(); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1009 errorDictionary_.LogError(code, true); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1010 throw OrthancException(static_cast<ErrorCode>(code)); |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1011 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1012 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1013 } |
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1014 } |