Mercurial > hg > orthanc
annotate OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp @ 4591:ff8170d17d90 db-changes
moving all accesses to databases from IDatabaseWrapper to ITransaction
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 15 Mar 2021 15:30:42 +0100 |
parents | bec74e29f86b |
children | 36bbf3169a27 |
rev | line source |
---|---|
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
4437
d9473bd5ed43
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4271
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU General Public License as |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * published by the Free Software Foundation, either version 3 of the |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * License, or (at your option) any later version. |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * In addition, as a special exception, the copyright holders of this |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * program give permission to link the code of its release with the |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * that use the same license as the "OpenSSL" library), and distribute |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * the linked executables. You must obey the GNU General Public License |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * in all respects for all of the code used other than "OpenSSL". If you |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * modify file(s) with this exception, you may extend this exception to |
8f4487d8f79e
new files for custom database back-end
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 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 * you do not wish to do so, delete this exception statement from your |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 * version. If you delete this exception statement from all source files |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 * in the program, then also delete it here. |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 * |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 * This program is distributed in the hope that it will be useful, but |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 * WITHOUT ANY WARRANTY; without even the implied warranty of |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 * General Public License for more details. |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 * |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 * You should have received a copy of the GNU General Public License |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 **/ |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 |
4045 | 34 #include "../../Sources/PrecompiledHeadersServer.h" |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 #include "OrthancPluginDatabase.h" |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 |
2136
dd609a99d39a
uniformization of the macro naming
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
37 #if ORTHANC_ENABLE_PLUGINS != 1 |
1632
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
38 #error The plugin support is disabled |
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
39 #endif |
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
40 |
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
41 |
4045 | 42 #include "../../../OrthancFramework/Sources/Logging.h" |
43 #include "../../../OrthancFramework/Sources/OrthancException.h" | |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
44 #include "../../Sources/Database/VoidDatabaseListener.h" |
1629
bad4772b605c
OrthancPluginErrorCode in database plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
45 #include "PluginsEnumerations.h" |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 #include <cassert> |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 namespace Orthanc |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
51 class OrthancPluginDatabase::Transaction : |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
52 public IDatabaseWrapper::ITransaction, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
53 public Compatibility::ICreateInstance, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
54 public Compatibility::IGetChildrenMetadata, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
55 public Compatibility::ILookupResources, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
56 public Compatibility::ILookupResourceAndParent, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
57 public Compatibility::ISetResourcesContent |
3019
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
58 { |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
59 private: |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
60 OrthancPluginDatabase& that_; |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
61 |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
62 void CheckSuccess(OrthancPluginErrorCode code) const |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
63 { |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
64 if (code != OrthancPluginErrorCode_Success) |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
65 { |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
66 that_.errorDictionary_.LogError(code, true); |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
67 throw OrthancException(static_cast<ErrorCode>(code)); |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
68 } |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
69 } |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
70 |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
71 public: |
4589
bec74e29f86b
attaching the listener to transactions in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4571
diff
changeset
|
72 explicit Transaction(OrthancPluginDatabase& that, |
bec74e29f86b
attaching the listener to transactions in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4571
diff
changeset
|
73 IDatabaseListener& listener) : |
4204 | 74 that_(that) |
3019
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
75 { |
4589
bec74e29f86b
attaching the listener to transactions in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4571
diff
changeset
|
76 assert(that_.listener_ == NULL); |
bec74e29f86b
attaching the listener to transactions in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4571
diff
changeset
|
77 that_.listener_ = &listener; // TODO - STORE IN TRANSACTION |
bec74e29f86b
attaching the listener to transactions in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4571
diff
changeset
|
78 } |
bec74e29f86b
attaching the listener to transactions in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4571
diff
changeset
|
79 |
bec74e29f86b
attaching the listener to transactions in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4571
diff
changeset
|
80 virtual ~Transaction() |
bec74e29f86b
attaching the listener to transactions in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4571
diff
changeset
|
81 { |
bec74e29f86b
attaching the listener to transactions in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4571
diff
changeset
|
82 assert(that_.listener_ != NULL); |
bec74e29f86b
attaching the listener to transactions in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4571
diff
changeset
|
83 that_.listener_ = NULL; // TODO - STORE IN TRANSACTION |
3019
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
84 } |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
85 |
4556
2a0f8031fb93
removed abstraction IDatabaseWrapper::ITransaction::Begin(), must be done by IDatabaseWrapper::StartTransaction()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
86 void Begin() |
3019
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
87 { |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
88 CheckSuccess(that_.backend_.startTransaction(that_.payload_)); |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
89 } |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
90 |
4204 | 91 virtual void Rollback() ORTHANC_OVERRIDE |
3019
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
92 { |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
93 CheckSuccess(that_.backend_.rollbackTransaction(that_.payload_)); |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
94 } |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
95 |
4204 | 96 virtual void Commit(int64_t diskSizeDelta) ORTHANC_OVERRIDE |
3019
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
97 { |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
98 if (that_.fastGetTotalSize_) |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
99 { |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
100 CheckSuccess(that_.backend_.commitTransaction(that_.payload_)); |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
101 } |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
102 else |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
103 { |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
104 if (static_cast<int64_t>(that_.currentDiskSize_) + diskSizeDelta < 0) |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
105 { |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
106 throw OrthancException(ErrorCode_DatabasePlugin); |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
107 } |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
108 |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
109 uint64_t newDiskSize = (that_.currentDiskSize_ + diskSizeDelta); |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
110 |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
111 assert(newDiskSize == GetTotalCompressedSize()); |
3019
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
112 |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
113 CheckSuccess(that_.backend_.commitTransaction(that_.payload_)); |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
114 |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
115 // The transaction has succeeded, we can commit the new disk size |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
116 that_.currentDiskSize_ = newDiskSize; |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
117 } |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
118 } |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
119 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
120 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
121 // From the "ILookupResources" interface |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
122 void GetAllInternalIds(std::list<int64_t>& target, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
123 ResourceType resourceType) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
124 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
125 if (that_.extensions_.getAllInternalIds == NULL) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
126 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
127 throw OrthancException(ErrorCode_DatabasePlugin, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
128 "The database plugin does not implement the mandatory GetAllInternalIds() extension"); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
129 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
130 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
131 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
132 CheckSuccess(that_.extensions_.getAllInternalIds(that_.GetContext(), that_.payload_, Plugins::Convert(resourceType))); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
133 that_.ForwardAnswers(target); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
134 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
135 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
136 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
137 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
138 // From the "ILookupResources" interface |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
139 void LookupIdentifier(std::list<int64_t>& result, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
140 ResourceType level, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
141 const DicomTag& tag, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
142 Compatibility::IdentifierConstraintType type, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
143 const std::string& value) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
144 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
145 if (that_.extensions_.lookupIdentifier3 == NULL) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
146 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
147 throw OrthancException(ErrorCode_DatabasePlugin, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
148 "The database plugin does not implement the mandatory LookupIdentifier3() extension"); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
149 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
150 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
151 OrthancPluginDicomTag tmp; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
152 tmp.group = tag.GetGroup(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
153 tmp.element = tag.GetElement(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
154 tmp.value = value.c_str(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
155 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
156 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
157 CheckSuccess(that_.extensions_.lookupIdentifier3(that_.GetContext(), that_.payload_, Plugins::Convert(level), |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
158 &tmp, Compatibility::Convert(type))); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
159 that_.ForwardAnswers(result); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
160 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
161 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
162 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
163 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
164 /** |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
165 * Implementation of "ITransaction" |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
166 **/ |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
167 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
168 virtual void ApplyLookupResources(std::list<std::string>& resourcesId, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
169 std::list<std::string>* instancesId, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
170 const std::vector<DatabaseConstraint>& lookup, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
171 ResourceType queryLevel, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
172 size_t limit) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
173 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
174 if (that_.extensions_.lookupResources == NULL) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
175 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
176 // Fallback to compatibility mode |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
177 ILookupResources::Apply |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
178 (*this, *this, resourcesId, instancesId, lookup, queryLevel, limit); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
179 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
180 else |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
181 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
182 std::vector<OrthancPluginDatabaseConstraint> constraints; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
183 std::vector< std::vector<const char*> > constraintsValues; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
184 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
185 constraints.resize(lookup.size()); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
186 constraintsValues.resize(lookup.size()); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
187 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
188 for (size_t i = 0; i < lookup.size(); i++) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
189 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
190 lookup[i].EncodeForPlugins(constraints[i], constraintsValues[i]); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
191 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
192 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
193 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
194 that_.answerMatchingResources_ = &resourcesId; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
195 that_.answerMatchingInstances_ = instancesId; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
196 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
197 CheckSuccess(that_.extensions_.lookupResources(that_.GetContext(), that_.payload_, lookup.size(), |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
198 (lookup.empty() ? NULL : &constraints[0]), |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
199 Plugins::Convert(queryLevel), |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
200 limit, (instancesId == NULL ? 0 : 1))); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
201 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
202 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
203 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
204 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
205 bool CreateInstance(IDatabaseWrapper::CreateInstanceResult& result, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
206 int64_t& instanceId, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
207 const std::string& patient, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
208 const std::string& study, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
209 const std::string& series, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
210 const std::string& instance) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
211 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
212 if (that_.extensions_.createInstance == NULL) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
213 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
214 // Fallback to compatibility mode |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
215 return ICreateInstance::Apply |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
216 (*this, result, instanceId, patient, study, series, instance); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
217 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
218 else |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
219 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
220 OrthancPluginCreateInstanceResult output; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
221 memset(&output, 0, sizeof(output)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
222 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
223 CheckSuccess(that_.extensions_.createInstance(&output, that_.payload_, patient.c_str(), |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
224 study.c_str(), series.c_str(), instance.c_str())); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
225 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
226 instanceId = output.instanceId; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
227 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
228 if (output.isNewInstance) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
229 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
230 result.isNewPatient_ = output.isNewPatient; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
231 result.isNewStudy_ = output.isNewStudy; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
232 result.isNewSeries_ = output.isNewSeries; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
233 result.patientId_ = output.patientId; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
234 result.studyId_ = output.studyId; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
235 result.seriesId_ = output.seriesId; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
236 return true; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
237 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
238 else |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
239 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
240 return false; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
241 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
242 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
243 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
244 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
245 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
246 virtual int64_t CreateResource(const std::string& publicId, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
247 ResourceType type) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
248 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
249 int64_t id; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
250 CheckSuccess(that_.backend_.createResource(&id, that_.payload_, publicId.c_str(), Plugins::Convert(type))); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
251 return id; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
252 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
253 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
254 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
255 virtual void AddAttachment(int64_t id, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
256 const FileInfo& attachment) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
257 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
258 OrthancPluginAttachment tmp; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
259 tmp.uuid = attachment.GetUuid().c_str(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
260 tmp.contentType = static_cast<int32_t>(attachment.GetContentType()); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
261 tmp.uncompressedSize = attachment.GetUncompressedSize(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
262 tmp.uncompressedHash = attachment.GetUncompressedMD5().c_str(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
263 tmp.compressionType = static_cast<int32_t>(attachment.GetCompressionType()); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
264 tmp.compressedSize = attachment.GetCompressedSize(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
265 tmp.compressedHash = attachment.GetCompressedMD5().c_str(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
266 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
267 CheckSuccess(that_.backend_.addAttachment(that_.payload_, id, &tmp)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
268 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
269 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
270 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
271 virtual void AttachChild(int64_t parent, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
272 int64_t child) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
273 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
274 CheckSuccess(that_.backend_.attachChild(that_.payload_, parent, child)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
275 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
276 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
277 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
278 virtual void ClearChanges() ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
279 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
280 CheckSuccess(that_.backend_.clearChanges(that_.payload_)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
281 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
282 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
283 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
284 virtual void ClearExportedResources() ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
285 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
286 CheckSuccess(that_.backend_.clearExportedResources(that_.payload_)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
287 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
288 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
289 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
290 virtual void ClearMainDicomTags(int64_t id) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
291 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
292 if (that_.extensions_.clearMainDicomTags == NULL) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
293 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
294 throw OrthancException(ErrorCode_DatabasePlugin, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
295 "Your custom index plugin does not implement the mandatory ClearMainDicomTags() extension"); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
296 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
297 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
298 CheckSuccess(that_.extensions_.clearMainDicomTags(that_.payload_, id)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
299 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
300 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
301 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
302 virtual void DeleteAttachment(int64_t id, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
303 FileContentType attachment) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
304 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
305 CheckSuccess(that_.backend_.deleteAttachment(that_.payload_, id, static_cast<int32_t>(attachment))); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
306 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
307 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
308 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
309 virtual void DeleteMetadata(int64_t id, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
310 MetadataType type) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
311 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
312 CheckSuccess(that_.backend_.deleteMetadata(that_.payload_, id, static_cast<int32_t>(type))); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
313 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
314 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
315 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
316 virtual void DeleteResource(int64_t id) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
317 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
318 CheckSuccess(that_.backend_.deleteResource(that_.payload_, id)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
319 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
320 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
321 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
322 virtual void GetAllMetadata(std::map<MetadataType, std::string>& target, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
323 int64_t id) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
324 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
325 if (that_.extensions_.getAllMetadata == NULL) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
326 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
327 // Fallback implementation if extension is missing |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
328 target.clear(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
329 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
330 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
331 CheckSuccess(that_.backend_.listAvailableMetadata(that_.GetContext(), that_.payload_, id)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
332 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
333 if (that_.type_ != _OrthancPluginDatabaseAnswerType_None && |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
334 that_.type_ != _OrthancPluginDatabaseAnswerType_Int32) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
335 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
336 throw OrthancException(ErrorCode_DatabasePlugin); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
337 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
338 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
339 target.clear(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
340 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
341 if (that_.type_ == _OrthancPluginDatabaseAnswerType_Int32) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
342 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
343 for (std::list<int32_t>::const_iterator |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
344 it = that_.answerInt32_.begin(); it != that_.answerInt32_.end(); ++it) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
345 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
346 MetadataType type = static_cast<MetadataType>(*it); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
347 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
348 std::string value; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
349 if (LookupMetadata(value, id, type)) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
350 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
351 target[type] = value; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
352 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
353 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
354 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
355 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
356 else |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
357 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
358 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
359 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
360 that_.answerMetadata_ = ⌖ |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
361 target.clear(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
362 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
363 CheckSuccess(that_.extensions_.getAllMetadata(that_.GetContext(), that_.payload_, id)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
364 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
365 if (that_.type_ != _OrthancPluginDatabaseAnswerType_None && |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
366 that_.type_ != _OrthancPluginDatabaseAnswerType_Metadata) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
367 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
368 throw OrthancException(ErrorCode_DatabasePlugin); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
369 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
370 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
371 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
372 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
373 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
374 virtual void GetAllPublicIds(std::list<std::string>& target, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
375 ResourceType resourceType) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
376 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
377 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
378 CheckSuccess(that_.backend_.getAllPublicIds(that_.GetContext(), that_.payload_, Plugins::Convert(resourceType))); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
379 that_.ForwardAnswers(target); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
380 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
381 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
382 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
383 virtual void GetAllPublicIds(std::list<std::string>& target, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
384 ResourceType resourceType, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
385 size_t since, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
386 size_t limit) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
387 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
388 if (that_.extensions_.getAllPublicIdsWithLimit != NULL) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
389 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
390 // This extension is available since Orthanc 0.9.4 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
391 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
392 CheckSuccess(that_.extensions_.getAllPublicIdsWithLimit |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
393 (that_.GetContext(), that_.payload_, Plugins::Convert(resourceType), since, limit)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
394 that_.ForwardAnswers(target); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
395 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
396 else |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
397 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
398 // The extension is not available in the database plugin, use a |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
399 // fallback implementation |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
400 target.clear(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
401 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
402 if (limit == 0) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
403 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
404 return; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
405 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
406 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
407 std::list<std::string> tmp; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
408 GetAllPublicIds(tmp, resourceType); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
409 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
410 if (tmp.size() <= since) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
411 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
412 // Not enough results => empty answer |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
413 return; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
414 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
415 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
416 std::list<std::string>::iterator current = tmp.begin(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
417 std::advance(current, since); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
418 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
419 while (limit > 0 && current != tmp.end()) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
420 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
421 target.push_back(*current); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
422 --limit; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
423 ++current; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
424 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
425 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
426 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
427 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
428 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
429 virtual void GetChanges(std::list<ServerIndexChange>& target /*out*/, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
430 bool& done /*out*/, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
431 int64_t since, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
432 uint32_t maxResults) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
433 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
434 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
435 that_.answerChanges_ = ⌖ |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
436 that_.answerDone_ = &done; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
437 done = false; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
438 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
439 CheckSuccess(that_.backend_.getChanges(that_.GetContext(), that_.payload_, since, maxResults)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
440 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
441 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
442 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
443 virtual void GetChildrenInternalId(std::list<int64_t>& target, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
444 int64_t id) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
445 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
446 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
447 CheckSuccess(that_.backend_.getChildrenInternalId(that_.GetContext(), that_.payload_, id)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
448 that_.ForwardAnswers(target); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
449 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
450 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
451 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
452 virtual void GetChildrenMetadata(std::list<std::string>& target, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
453 int64_t resourceId, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
454 MetadataType metadata) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
455 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
456 if (that_.extensions_.getChildrenMetadata == NULL) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
457 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
458 IGetChildrenMetadata::Apply(*this, target, resourceId, metadata); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
459 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
460 else |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
461 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
462 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
463 CheckSuccess(that_.extensions_.getChildrenMetadata |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
464 (that_.GetContext(), that_.payload_, resourceId, static_cast<int32_t>(metadata))); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
465 that_.ForwardAnswers(target); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
466 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
467 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
468 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
469 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
470 virtual void GetChildrenPublicId(std::list<std::string>& target, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
471 int64_t id) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
472 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
473 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
474 CheckSuccess(that_.backend_.getChildrenPublicId(that_.GetContext(), that_.payload_, id)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
475 that_.ForwardAnswers(target); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
476 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
477 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
478 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
479 virtual void GetExportedResources(std::list<ExportedResource>& target /*out*/, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
480 bool& done /*out*/, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
481 int64_t since, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
482 uint32_t maxResults) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
483 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
484 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
485 that_.answerExportedResources_ = ⌖ |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
486 that_.answerDone_ = &done; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
487 done = false; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
488 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
489 CheckSuccess(that_.backend_.getExportedResources(that_.GetContext(), that_.payload_, since, maxResults)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
490 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
491 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
492 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
493 virtual void GetLastChange(std::list<ServerIndexChange>& target /*out*/) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
494 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
495 that_.answerDoneIgnored_ = false; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
496 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
497 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
498 that_.answerChanges_ = ⌖ |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
499 that_.answerDone_ = &that_.answerDoneIgnored_; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
500 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
501 CheckSuccess(that_.backend_.getLastChange(that_.GetContext(), that_.payload_)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
502 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
503 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
504 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
505 int64_t GetLastChangeIndex() ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
506 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
507 if (that_.extensions_.getLastChangeIndex == NULL) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
508 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
509 // This was the default behavior in Orthanc <= 1.5.1 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
510 // https://groups.google.com/d/msg/orthanc-users/QhzB6vxYeZ0/YxabgqpfBAAJ |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
511 return 0; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
512 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
513 else |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
514 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
515 int64_t result = 0; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
516 CheckSuccess(that_.extensions_.getLastChangeIndex(&result, that_.payload_)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
517 return result; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
518 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
519 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
520 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
521 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
522 virtual void GetLastExportedResource(std::list<ExportedResource>& target /*out*/) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
523 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
524 that_.answerDoneIgnored_ = false; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
525 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
526 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
527 that_.answerExportedResources_ = ⌖ |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
528 that_.answerDone_ = &that_.answerDoneIgnored_; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
529 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
530 CheckSuccess(that_.backend_.getLastExportedResource(that_.GetContext(), that_.payload_)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
531 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
532 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
533 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
534 virtual void GetMainDicomTags(DicomMap& map, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
535 int64_t id) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
536 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
537 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
538 that_.answerDicomMap_ = ↦ |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
539 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
540 CheckSuccess(that_.backend_.getMainDicomTags(that_.GetContext(), that_.payload_, id)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
541 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
542 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
543 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
544 virtual std::string GetPublicId(int64_t resourceId) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
545 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
546 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
547 std::string s; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
548 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
549 CheckSuccess(that_.backend_.getPublicId(that_.GetContext(), that_.payload_, resourceId)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
550 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
551 if (!that_.ForwardSingleAnswer(s)) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
552 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
553 throw OrthancException(ErrorCode_DatabasePlugin); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
554 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
555 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
556 return s; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
557 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
558 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
559 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
560 virtual uint64_t GetResourceCount(ResourceType resourceType) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
561 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
562 uint64_t count; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
563 CheckSuccess(that_.backend_.getResourceCount(&count, that_.payload_, Plugins::Convert(resourceType))); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
564 return count; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
565 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
566 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
567 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
568 virtual ResourceType GetResourceType(int64_t resourceId) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
569 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
570 OrthancPluginResourceType type; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
571 CheckSuccess(that_.backend_.getResourceType(&type, that_.payload_, resourceId)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
572 return Plugins::Convert(type); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
573 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
574 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
575 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
576 virtual uint64_t GetTotalCompressedSize() ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
577 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
578 uint64_t size; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
579 CheckSuccess(that_.backend_.getTotalCompressedSize(&size, that_.payload_)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
580 return size; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
581 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
582 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
583 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
584 virtual uint64_t GetTotalUncompressedSize() ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
585 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
586 uint64_t size; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
587 CheckSuccess(that_.backend_.getTotalUncompressedSize(&size, that_.payload_)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
588 return size; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
589 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
590 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
591 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
592 virtual bool IsDiskSizeAbove(uint64_t threshold) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
593 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
594 if (that_.fastGetTotalSize_) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
595 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
596 return GetTotalCompressedSize() > threshold; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
597 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
598 else |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
599 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
600 assert(GetTotalCompressedSize() == that_.currentDiskSize_); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
601 return that_.currentDiskSize_ > threshold; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
602 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
603 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
604 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
605 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
606 virtual bool IsExistingResource(int64_t internalId) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
607 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
608 int32_t existing; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
609 CheckSuccess(that_.backend_.isExistingResource(&existing, that_.payload_, internalId)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
610 return (existing != 0); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
611 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
612 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
613 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
614 virtual bool IsProtectedPatient(int64_t internalId) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
615 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
616 int32_t isProtected; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
617 CheckSuccess(that_.backend_.isProtectedPatient(&isProtected, that_.payload_, internalId)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
618 return (isProtected != 0); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
619 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
620 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
621 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
622 virtual void ListAvailableAttachments(std::set<FileContentType>& target, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
623 int64_t id) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
624 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
625 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
626 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
627 CheckSuccess(that_.backend_.listAvailableAttachments(that_.GetContext(), that_.payload_, id)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
628 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
629 if (that_.type_ != _OrthancPluginDatabaseAnswerType_None && |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
630 that_.type_ != _OrthancPluginDatabaseAnswerType_Int32) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
631 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
632 throw OrthancException(ErrorCode_DatabasePlugin); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
633 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
634 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
635 target.clear(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
636 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
637 if (that_.type_ == _OrthancPluginDatabaseAnswerType_Int32) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
638 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
639 for (std::list<int32_t>::const_iterator |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
640 it = that_.answerInt32_.begin(); it != that_.answerInt32_.end(); ++it) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
641 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
642 target.insert(static_cast<FileContentType>(*it)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
643 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
644 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
645 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
646 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
647 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
648 virtual void LogChange(int64_t internalId, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
649 const ServerIndexChange& change) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
650 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
651 OrthancPluginChange tmp; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
652 tmp.seq = change.GetSeq(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
653 tmp.changeType = static_cast<int32_t>(change.GetChangeType()); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
654 tmp.resourceType = Plugins::Convert(change.GetResourceType()); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
655 tmp.publicId = change.GetPublicId().c_str(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
656 tmp.date = change.GetDate().c_str(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
657 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
658 CheckSuccess(that_.backend_.logChange(that_.payload_, &tmp)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
659 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
660 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
661 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
662 virtual void LogExportedResource(const ExportedResource& resource) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
663 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
664 OrthancPluginExportedResource tmp; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
665 tmp.seq = resource.GetSeq(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
666 tmp.resourceType = Plugins::Convert(resource.GetResourceType()); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
667 tmp.publicId = resource.GetPublicId().c_str(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
668 tmp.modality = resource.GetModality().c_str(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
669 tmp.date = resource.GetDate().c_str(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
670 tmp.patientId = resource.GetPatientId().c_str(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
671 tmp.studyInstanceUid = resource.GetStudyInstanceUid().c_str(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
672 tmp.seriesInstanceUid = resource.GetSeriesInstanceUid().c_str(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
673 tmp.sopInstanceUid = resource.GetSopInstanceUid().c_str(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
674 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
675 CheckSuccess(that_.backend_.logExportedResource(that_.payload_, &tmp)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
676 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
677 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
678 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
679 virtual bool LookupAttachment(FileInfo& attachment, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
680 int64_t id, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
681 FileContentType contentType) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
682 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
683 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
684 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
685 CheckSuccess(that_.backend_.lookupAttachment |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
686 (that_.GetContext(), that_.payload_, id, static_cast<int32_t>(contentType))); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
687 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
688 if (that_.type_ == _OrthancPluginDatabaseAnswerType_None) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
689 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
690 return false; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
691 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
692 else if (that_.type_ == _OrthancPluginDatabaseAnswerType_Attachment && |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
693 that_.answerAttachments_.size() == 1) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
694 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
695 attachment = that_.answerAttachments_.front(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
696 return true; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
697 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
698 else |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
699 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
700 throw OrthancException(ErrorCode_DatabasePlugin); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
701 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
702 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
703 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
704 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
705 virtual bool LookupGlobalProperty(std::string& target, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
706 GlobalProperty property) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
707 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
708 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
709 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
710 CheckSuccess(that_.backend_.lookupGlobalProperty |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
711 (that_.GetContext(), that_.payload_, static_cast<int32_t>(property))); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
712 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
713 return that_.ForwardSingleAnswer(target); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
714 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
715 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
716 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
717 virtual void LookupIdentifierRange(std::list<int64_t>& result, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
718 ResourceType level, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
719 const DicomTag& tag, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
720 const std::string& start, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
721 const std::string& end) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
722 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
723 if (that_.extensions_.lookupIdentifierRange == NULL) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
724 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
725 // Default implementation, for plugins using Orthanc SDK <= 1.3.2 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
726 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
727 LookupIdentifier(result, level, tag, Compatibility::IdentifierConstraintType_GreaterOrEqual, start); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
728 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
729 std::list<int64_t> b; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
730 LookupIdentifier(result, level, tag, Compatibility::IdentifierConstraintType_SmallerOrEqual, end); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
731 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
732 result.splice(result.end(), b); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
733 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
734 else |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
735 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
736 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
737 CheckSuccess(that_.extensions_.lookupIdentifierRange(that_.GetContext(), that_.payload_, Plugins::Convert(level), |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
738 tag.GetGroup(), tag.GetElement(), |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
739 start.c_str(), end.c_str())); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
740 that_.ForwardAnswers(result); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
741 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
742 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
743 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
744 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
745 virtual bool LookupMetadata(std::string& target, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
746 int64_t id, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
747 MetadataType type) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
748 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
749 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
750 CheckSuccess(that_.backend_.lookupMetadata(that_.GetContext(), that_.payload_, id, static_cast<int32_t>(type))); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
751 return that_.ForwardSingleAnswer(target); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
752 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
753 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
754 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
755 virtual bool LookupParent(int64_t& parentId, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
756 int64_t resourceId) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
757 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
758 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
759 CheckSuccess(that_.backend_.lookupParent(that_.GetContext(), that_.payload_, resourceId)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
760 return that_.ForwardSingleAnswer(parentId); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
761 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
762 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
763 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
764 virtual bool LookupResource(int64_t& id, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
765 ResourceType& type, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
766 const std::string& publicId) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
767 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
768 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
769 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
770 CheckSuccess(that_.backend_.lookupResource(that_.GetContext(), that_.payload_, publicId.c_str())); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
771 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
772 if (that_.type_ == _OrthancPluginDatabaseAnswerType_None) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
773 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
774 return false; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
775 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
776 else if (that_.type_ == _OrthancPluginDatabaseAnswerType_Resource && |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
777 that_.answerResources_.size() == 1) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
778 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
779 id = that_.answerResources_.front().first; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
780 type = that_.answerResources_.front().second; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
781 return true; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
782 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
783 else |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
784 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
785 throw OrthancException(ErrorCode_DatabasePlugin); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
786 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
787 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
788 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
789 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
790 virtual bool LookupResourceAndParent(int64_t& id, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
791 ResourceType& type, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
792 std::string& parentPublicId, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
793 const std::string& publicId) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
794 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
795 if (that_.extensions_.lookupResourceAndParent == NULL) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
796 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
797 return ILookupResourceAndParent::Apply(*this, id, type, parentPublicId, publicId); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
798 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
799 else |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
800 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
801 std::list<std::string> parent; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
802 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
803 uint8_t isExisting; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
804 OrthancPluginResourceType pluginType = OrthancPluginResourceType_Patient; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
805 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
806 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
807 CheckSuccess(that_.extensions_.lookupResourceAndParent |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
808 (that_.GetContext(), &isExisting, &id, &pluginType, that_.payload_, publicId.c_str())); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
809 that_.ForwardAnswers(parent); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
810 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
811 if (isExisting) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
812 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
813 type = Plugins::Convert(pluginType); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
814 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
815 if (parent.empty()) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
816 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
817 if (type != ResourceType_Patient) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
818 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
819 throw OrthancException(ErrorCode_DatabasePlugin); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
820 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
821 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
822 else if (parent.size() == 1) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
823 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
824 if ((type != ResourceType_Study && |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
825 type != ResourceType_Series && |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
826 type != ResourceType_Instance) || |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
827 parent.front().empty()) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
828 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
829 throw OrthancException(ErrorCode_DatabasePlugin); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
830 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
831 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
832 parentPublicId = parent.front(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
833 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
834 else |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
835 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
836 throw OrthancException(ErrorCode_DatabasePlugin); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
837 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
838 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
839 return true; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
840 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
841 else |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
842 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
843 return false; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
844 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
845 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
846 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
847 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
848 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
849 virtual bool SelectPatientToRecycle(int64_t& internalId) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
850 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
851 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
852 CheckSuccess(that_.backend_.selectPatientToRecycle(that_.GetContext(), that_.payload_)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
853 return that_.ForwardSingleAnswer(internalId); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
854 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
855 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
856 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
857 virtual bool SelectPatientToRecycle(int64_t& internalId, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
858 int64_t patientIdToAvoid) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
859 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
860 that_.ResetAnswers(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
861 CheckSuccess(that_.backend_.selectPatientToRecycle2(that_.GetContext(), that_.payload_, patientIdToAvoid)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
862 return that_.ForwardSingleAnswer(internalId); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
863 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
864 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
865 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
866 virtual void SetGlobalProperty(GlobalProperty property, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
867 const std::string& value) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
868 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
869 CheckSuccess(that_.backend_.setGlobalProperty |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
870 (that_.payload_, static_cast<int32_t>(property), value.c_str())); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
871 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
872 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
873 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
874 virtual void SetIdentifierTag(int64_t id, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
875 const DicomTag& tag, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
876 const std::string& value) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
877 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
878 OrthancPluginDicomTag tmp; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
879 tmp.group = tag.GetGroup(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
880 tmp.element = tag.GetElement(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
881 tmp.value = value.c_str(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
882 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
883 CheckSuccess(that_.backend_.setIdentifierTag(that_.payload_, id, &tmp)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
884 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
885 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
886 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
887 virtual void SetMainDicomTag(int64_t id, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
888 const DicomTag& tag, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
889 const std::string& value) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
890 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
891 OrthancPluginDicomTag tmp; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
892 tmp.group = tag.GetGroup(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
893 tmp.element = tag.GetElement(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
894 tmp.value = value.c_str(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
895 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
896 CheckSuccess(that_.backend_.setMainDicomTag(that_.payload_, id, &tmp)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
897 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
898 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
899 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
900 virtual void SetMetadata(int64_t id, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
901 MetadataType type, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
902 const std::string& value) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
903 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
904 CheckSuccess(that_.backend_.setMetadata |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
905 (that_.payload_, id, static_cast<int32_t>(type), value.c_str())); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
906 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
907 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
908 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
909 virtual void SetProtectedPatient(int64_t internalId, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
910 bool isProtected) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
911 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
912 CheckSuccess(that_.backend_.setProtectedPatient(that_.payload_, internalId, isProtected)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
913 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
914 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
915 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
916 virtual void SetResourcesContent(const Orthanc::ResourcesContent& content) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
917 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
918 if (that_.extensions_.setResourcesContent == NULL) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
919 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
920 ISetResourcesContent::Apply(*this, content); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
921 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
922 else |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
923 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
924 std::vector<OrthancPluginResourcesContentTags> identifierTags; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
925 std::vector<OrthancPluginResourcesContentTags> mainDicomTags; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
926 std::vector<OrthancPluginResourcesContentMetadata> metadata; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
927 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
928 identifierTags.reserve(content.GetListTags().size()); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
929 mainDicomTags.reserve(content.GetListTags().size()); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
930 metadata.reserve(content.GetListMetadata().size()); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
931 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
932 for (ResourcesContent::ListTags::const_iterator |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
933 it = content.GetListTags().begin(); it != content.GetListTags().end(); ++it) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
934 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
935 OrthancPluginResourcesContentTags tmp; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
936 tmp.resource = it->resourceId_; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
937 tmp.group = it->tag_.GetGroup(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
938 tmp.element = it->tag_.GetElement(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
939 tmp.value = it->value_.c_str(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
940 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
941 if (it->isIdentifier_) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
942 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
943 identifierTags.push_back(tmp); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
944 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
945 else |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
946 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
947 mainDicomTags.push_back(tmp); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
948 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
949 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
950 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
951 for (ResourcesContent::ListMetadata::const_iterator |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
952 it = content.GetListMetadata().begin(); it != content.GetListMetadata().end(); ++it) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
953 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
954 OrthancPluginResourcesContentMetadata tmp; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
955 tmp.resource = it->resourceId_; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
956 tmp.metadata = it->metadata_; |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
957 tmp.value = it->value_.c_str(); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
958 metadata.push_back(tmp); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
959 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
960 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
961 assert(identifierTags.size() + mainDicomTags.size() == content.GetListTags().size() && |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
962 metadata.size() == content.GetListMetadata().size()); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
963 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
964 CheckSuccess(that_.extensions_.setResourcesContent( |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
965 that_.payload_, |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
966 identifierTags.size(), |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
967 (identifierTags.empty() ? NULL : &identifierTags[0]), |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
968 mainDicomTags.size(), |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
969 (mainDicomTags.empty() ? NULL : &mainDicomTags[0]), |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
970 metadata.size(), |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
971 (metadata.empty() ? NULL : &metadata[0]))); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
972 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
973 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
974 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
975 |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
976 virtual void TagMostRecentPatient(int64_t patient) ORTHANC_OVERRIDE |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
977 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
978 if (that_.extensions_.tagMostRecentPatient != NULL) |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
979 { |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
980 CheckSuccess(that_.extensions_.tagMostRecentPatient(that_.payload_, patient)); |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
981 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
982 } |
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
983 |
3019
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
984 }; |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
985 |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
986 |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
987 static FileInfo Convert(const OrthancPluginAttachment& attachment) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
988 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
989 return FileInfo(attachment.uuid, |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
990 static_cast<FileContentType>(attachment.contentType), |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
991 attachment.uncompressedSize, |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
992 attachment.uncompressedHash, |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
993 static_cast<CompressionType>(attachment.compressionType), |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
994 attachment.compressedSize, |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
995 attachment.compressedHash); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
996 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
997 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
998 |
1672
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
999 void OrthancPluginDatabase::CheckSuccess(OrthancPluginErrorCode code) |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1000 { |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1001 if (code != OrthancPluginErrorCode_Success) |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1002 { |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1003 errorDictionary_.LogError(code, true); |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1004 throw OrthancException(static_cast<ErrorCode>(code)); |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1005 } |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1006 } |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1007 |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1008 |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1009 void OrthancPluginDatabase::ResetAnswers() |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1010 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1011 type_ = _OrthancPluginDatabaseAnswerType_None; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1012 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1013 answerDicomMap_ = NULL; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1014 answerChanges_ = NULL; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1015 answerExportedResources_ = NULL; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1016 answerDone_ = NULL; |
3076
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1017 answerMatchingResources_ = NULL; |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1018 answerMatchingInstances_ = NULL; |
3189
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1019 answerMetadata_ = NULL; |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1020 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1021 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1022 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1023 void OrthancPluginDatabase::ForwardAnswers(std::list<int64_t>& target) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1024 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1025 if (type_ != _OrthancPluginDatabaseAnswerType_None && |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1026 type_ != _OrthancPluginDatabaseAnswerType_Int64) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1027 { |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1629
diff
changeset
|
1028 throw OrthancException(ErrorCode_DatabasePlugin); |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1029 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1030 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1031 target.clear(); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1032 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1033 if (type_ == _OrthancPluginDatabaseAnswerType_Int64) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1034 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1035 for (std::list<int64_t>::const_iterator |
1314 | 1036 it = answerInt64_.begin(); it != answerInt64_.end(); ++it) |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1037 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1038 target.push_back(*it); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1039 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1040 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1041 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1042 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1043 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1044 void OrthancPluginDatabase::ForwardAnswers(std::list<std::string>& target) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1045 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1046 if (type_ != _OrthancPluginDatabaseAnswerType_None && |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1047 type_ != _OrthancPluginDatabaseAnswerType_String) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1048 { |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1629
diff
changeset
|
1049 throw OrthancException(ErrorCode_DatabasePlugin); |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1050 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1051 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1052 target.clear(); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1053 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1054 if (type_ == _OrthancPluginDatabaseAnswerType_String) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1055 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1056 for (std::list<std::string>::const_iterator |
1314 | 1057 it = answerStrings_.begin(); it != answerStrings_.end(); ++it) |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1058 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1059 target.push_back(*it); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1060 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1061 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1062 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1063 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1064 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1065 bool OrthancPluginDatabase::ForwardSingleAnswer(std::string& target) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1066 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1067 if (type_ == _OrthancPluginDatabaseAnswerType_None) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1068 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1069 return false; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1070 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1071 else if (type_ == _OrthancPluginDatabaseAnswerType_String && |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1072 answerStrings_.size() == 1) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1073 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1074 target = answerStrings_.front(); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1075 return true; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1076 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1077 else |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1078 { |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1629
diff
changeset
|
1079 throw OrthancException(ErrorCode_DatabasePlugin); |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1080 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1081 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1082 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1083 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1084 bool OrthancPluginDatabase::ForwardSingleAnswer(int64_t& target) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1085 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1086 if (type_ == _OrthancPluginDatabaseAnswerType_None) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1087 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1088 return false; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1089 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1090 else if (type_ == _OrthancPluginDatabaseAnswerType_Int64 && |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1091 answerInt64_.size() == 1) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1092 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1093 target = answerInt64_.front(); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1094 return true; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1095 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1096 else |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1097 { |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1629
diff
changeset
|
1098 throw OrthancException(ErrorCode_DatabasePlugin); |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1099 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1100 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1101 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1102 |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1629
diff
changeset
|
1103 OrthancPluginDatabase::OrthancPluginDatabase(SharedLibrary& library, |
1651
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
1104 PluginsErrorDictionary& errorDictionary, |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1629
diff
changeset
|
1105 const OrthancPluginDatabaseBackend& backend, |
1609
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1545
diff
changeset
|
1106 const OrthancPluginDatabaseExtensions* extensions, |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1545
diff
changeset
|
1107 size_t extensionsSize, |
1314 | 1108 void *payload) : |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1629
diff
changeset
|
1109 library_(library), |
1651
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
1110 errorDictionary_(errorDictionary), |
1314 | 1111 backend_(backend), |
1112 payload_(payload), | |
4204 | 1113 listener_(NULL), |
1114 fastGetTotalSize_(false), | |
1115 currentDiskSize_(0), | |
1116 answerDoneIgnored_(false) | |
1314 | 1117 { |
3101
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1118 static const char* const MISSING = " Missing extension in database index plugin: "; |
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1119 |
3076
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1120 ResetAnswers(); |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1121 |
1609
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1545
diff
changeset
|
1122 memset(&extensions_, 0, sizeof(extensions_)); |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1545
diff
changeset
|
1123 |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1545
diff
changeset
|
1124 size_t size = sizeof(extensions_); |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1545
diff
changeset
|
1125 if (extensionsSize < size) |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1545
diff
changeset
|
1126 { |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1545
diff
changeset
|
1127 size = extensionsSize; // Not all the extensions are available |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1545
diff
changeset
|
1128 } |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1545
diff
changeset
|
1129 |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1545
diff
changeset
|
1130 memcpy(&extensions_, extensions, size); |
3076
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1131 |
3101
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1132 bool isOptimal = true; |
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1133 |
3076
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1134 if (extensions_.lookupResources == NULL) |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1135 { |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
1136 CLOG(INFO, PLUGINS) << MISSING << "LookupIdentifierRange()"; |
3101
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1137 isOptimal = false; |
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1138 } |
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1139 |
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1140 if (extensions_.createInstance == NULL) |
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1141 { |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
1142 CLOG(INFO, PLUGINS) << MISSING << "CreateInstance()"; |
3101
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1143 isOptimal = false; |
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1144 } |
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1145 |
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1146 if (extensions_.setResourcesContent == NULL) |
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1147 { |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
1148 CLOG(INFO, PLUGINS) << MISSING << "SetResourcesContent()"; |
3101
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1149 isOptimal = false; |
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1150 } |
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1151 |
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1152 if (extensions_.getChildrenMetadata == NULL) |
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1153 { |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
1154 CLOG(INFO, PLUGINS) << MISSING << "GetChildrenMetadata()"; |
3101
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1155 isOptimal = false; |
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1156 } |
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1157 |
3190 | 1158 if (extensions_.getAllMetadata == NULL) |
1159 { | |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
1160 CLOG(INFO, PLUGINS) << MISSING << "GetAllMetadata()"; |
3190 | 1161 isOptimal = false; |
1162 } | |
1163 | |
1164 if (extensions_.lookupResourceAndParent == NULL) | |
1165 { | |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
1166 CLOG(INFO, PLUGINS) << MISSING << "LookupResourceAndParent()"; |
3190 | 1167 isOptimal = false; |
1168 } | |
1169 | |
3101
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1170 if (isOptimal) |
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1171 { |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
1172 CLOG(INFO, PLUGINS) << "The performance of the database index plugin " |
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
1173 << "is optimal for this version of Orthanc"; |
3101
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1174 } |
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1175 else |
b2b6db5ad9a5
warn about missing extensions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3099
diff
changeset
|
1176 { |
3124
c0d7aee8c3f8
Fix issue #58 (Patient recycling order should be defined by their received last instance)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3121
diff
changeset
|
1177 LOG(WARNING) << "Performance warning in the database index: " |
c0d7aee8c3f8
Fix issue #58 (Patient recycling order should be defined by their received last instance)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3121
diff
changeset
|
1178 << "Some extensions are missing in the plugin"; |
3076
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1179 } |
3105
2e1711f80f74
More consistent handling of the "Last" field returned by the "/changes" URI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3101
diff
changeset
|
1180 |
2e1711f80f74
More consistent handling of the "Last" field returned by the "/changes" URI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3101
diff
changeset
|
1181 if (extensions_.getLastChangeIndex == NULL) |
2e1711f80f74
More consistent handling of the "Last" field returned by the "/changes" URI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3101
diff
changeset
|
1182 { |
2e1711f80f74
More consistent handling of the "Last" field returned by the "/changes" URI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3101
diff
changeset
|
1183 LOG(WARNING) << "The database extension GetLastChangeIndex() is missing"; |
2e1711f80f74
More consistent handling of the "Last" field returned by the "/changes" URI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3101
diff
changeset
|
1184 } |
3124
c0d7aee8c3f8
Fix issue #58 (Patient recycling order should be defined by their received last instance)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3121
diff
changeset
|
1185 |
c0d7aee8c3f8
Fix issue #58 (Patient recycling order should be defined by their received last instance)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3121
diff
changeset
|
1186 if (extensions_.tagMostRecentPatient == NULL) |
c0d7aee8c3f8
Fix issue #58 (Patient recycling order should be defined by their received last instance)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3121
diff
changeset
|
1187 { |
c0d7aee8c3f8
Fix issue #58 (Patient recycling order should be defined by their received last instance)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3121
diff
changeset
|
1188 LOG(WARNING) << "The database extension TagMostRecentPatient() is missing " |
c0d7aee8c3f8
Fix issue #58 (Patient recycling order should be defined by their received last instance)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3121
diff
changeset
|
1189 << "(affected by issue 58)"; |
c0d7aee8c3f8
Fix issue #58 (Patient recycling order should be defined by their received last instance)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3121
diff
changeset
|
1190 } |
1314 | 1191 } |
1192 | |
1193 | |
3019
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1194 void OrthancPluginDatabase::Open() |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1195 { |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1196 CheckSuccess(backend_.open(payload_)); |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1197 |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
1198 VoidDatabaseListener listener; |
4589
bec74e29f86b
attaching the listener to transactions in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4571
diff
changeset
|
1199 |
3019
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1200 { |
4589
bec74e29f86b
attaching the listener to transactions in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4571
diff
changeset
|
1201 Transaction transaction(*this, listener); |
3019
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1202 transaction.Begin(); |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1203 |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1204 std::string tmp; |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1205 fastGetTotalSize_ = |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
1206 (transaction.LookupGlobalProperty(tmp, GlobalProperty_GetTotalSizeIsFast) && |
3019
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1207 tmp == "1"); |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1208 |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1209 if (fastGetTotalSize_) |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1210 { |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1211 currentDiskSize_ = 0; // Unused |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1212 } |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1213 else |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1214 { |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1215 // This is the case of database plugins using Orthanc SDK <= 1.5.2 |
3020
d207f6ac1f86
tracking disk size by the database engine to ensure consistency across transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3019
diff
changeset
|
1216 LOG(WARNING) << "Your database index plugin is not compatible with multiple Orthanc writers"; |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
1217 currentDiskSize_ = transaction.GetTotalCompressedSize(); |
3019
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1218 } |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1219 |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1220 transaction.Commit(0); |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1221 } |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1222 } |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1223 |
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1224 |
4589
bec74e29f86b
attaching the listener to transactions in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4571
diff
changeset
|
1225 IDatabaseWrapper::ITransaction* OrthancPluginDatabase::StartTransaction(TransactionType type, |
bec74e29f86b
attaching the listener to transactions in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4571
diff
changeset
|
1226 IDatabaseListener& listener) |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1227 { |
4570
648defffc8cc
new enum: TransactionType
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4556
diff
changeset
|
1228 // TODO - Take advantage of "type" |
4589
bec74e29f86b
attaching the listener to transactions in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4571
diff
changeset
|
1229 |
bec74e29f86b
attaching the listener to transactions in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4571
diff
changeset
|
1230 std::unique_ptr<Transaction> transaction(new Transaction(*this, listener)); |
4556
2a0f8031fb93
removed abstraction IDatabaseWrapper::ITransaction::Begin(), must be done by IDatabaseWrapper::StartTransaction()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
1231 transaction->Begin(); |
2a0f8031fb93
removed abstraction IDatabaseWrapper::ITransaction::Begin(), must be done by IDatabaseWrapper::StartTransaction()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
1232 return transaction.release(); |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1233 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1234 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1235 |
1432
0ac74fa21db8
rename IServerIndexListener as IDatabaseListener
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1314
diff
changeset
|
1236 static void ProcessEvent(IDatabaseListener& listener, |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1237 const _OrthancPluginDatabaseAnswer& answer) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1238 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1239 switch (answer.type) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1240 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1241 case _OrthancPluginDatabaseAnswerType_DeletedAttachment: |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1242 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1243 const OrthancPluginAttachment& attachment = |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1244 *reinterpret_cast<const OrthancPluginAttachment*>(answer.valueGeneric); |
4571
9224e107d613
simplifying IDatabaseListener::SignalChange() as IDatabaseListener::SignalResourceDeleted()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4570
diff
changeset
|
1245 listener.SignalAttachmentDeleted(Convert(attachment)); |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1246 break; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1247 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1248 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1249 case _OrthancPluginDatabaseAnswerType_RemainingAncestor: |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1250 { |
1672
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1251 ResourceType type = Plugins::Convert(static_cast<OrthancPluginResourceType>(answer.valueInt32)); |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1252 listener.SignalRemainingAncestor(type, answer.valueString); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1253 break; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1254 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1255 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1256 case _OrthancPluginDatabaseAnswerType_DeletedResource: |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1257 { |
1672
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1258 ResourceType type = Plugins::Convert(static_cast<OrthancPluginResourceType>(answer.valueInt32)); |
4571
9224e107d613
simplifying IDatabaseListener::SignalChange() as IDatabaseListener::SignalResourceDeleted()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4570
diff
changeset
|
1259 listener.SignalResourceDeleted(type, answer.valueString); |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1260 break; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1261 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1262 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1263 default: |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1629
diff
changeset
|
1264 throw OrthancException(ErrorCode_DatabasePlugin); |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1265 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1266 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1267 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1268 |
1615
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1269 unsigned int OrthancPluginDatabase::GetDatabaseVersion() |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1270 { |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1271 if (extensions_.getDatabaseVersion != NULL) |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1272 { |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1273 uint32_t version; |
1672
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1274 CheckSuccess(extensions_.getDatabaseVersion(&version, payload_)); |
1615
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1275 return version; |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1276 } |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1277 else |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1278 { |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1279 // Before adding the "GetDatabaseVersion()" extension in plugins |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1280 // (OrthancPostgreSQL <= 1.2), the only supported DB schema was |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1281 // version 5. |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1282 return 5; |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1283 } |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1284 } |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1285 |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1286 |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1287 void OrthancPluginDatabase::Upgrade(unsigned int targetVersion, |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1288 IStorageArea& storageArea) |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1289 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
1290 VoidDatabaseListener listener; |
4589
bec74e29f86b
attaching the listener to transactions in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4571
diff
changeset
|
1291 |
1615
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1292 if (extensions_.upgradeDatabase != NULL) |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1293 { |
4589
bec74e29f86b
attaching the listener to transactions in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4571
diff
changeset
|
1294 Transaction transaction(*this, listener); |
1673
0bbcfd9695e5
UpgradeDatabase in the sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
1295 transaction.Begin(); |
0bbcfd9695e5
UpgradeDatabase in the sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
1296 |
0bbcfd9695e5
UpgradeDatabase in the sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
1297 OrthancPluginErrorCode code = extensions_.upgradeDatabase( |
0bbcfd9695e5
UpgradeDatabase in the sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
1298 payload_, targetVersion, |
0bbcfd9695e5
UpgradeDatabase in the sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
1299 reinterpret_cast<OrthancPluginStorageArea*>(&storageArea)); |
0bbcfd9695e5
UpgradeDatabase in the sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
1300 |
0bbcfd9695e5
UpgradeDatabase in the sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
1301 if (code == OrthancPluginErrorCode_Success) |
0bbcfd9695e5
UpgradeDatabase in the sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
1302 { |
3019
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
1303 transaction.Commit(0); |
1673
0bbcfd9695e5
UpgradeDatabase in the sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
1304 } |
0bbcfd9695e5
UpgradeDatabase in the sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
1305 else |
0bbcfd9695e5
UpgradeDatabase in the sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
1306 { |
0bbcfd9695e5
UpgradeDatabase in the sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
1307 transaction.Rollback(); |
0bbcfd9695e5
UpgradeDatabase in the sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
1308 errorDictionary_.LogError(code, true); |
0bbcfd9695e5
UpgradeDatabase in the sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
1309 throw OrthancException(static_cast<ErrorCode>(code)); |
0bbcfd9695e5
UpgradeDatabase in the sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
1310 } |
1615
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1311 } |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1312 } |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1313 |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
1314 |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1315 void OrthancPluginDatabase::AnswerReceived(const _OrthancPluginDatabaseAnswer& answer) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1316 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1317 if (answer.type == _OrthancPluginDatabaseAnswerType_None) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1318 { |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1629
diff
changeset
|
1319 throw OrthancException(ErrorCode_DatabasePlugin); |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1320 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1321 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1322 if (answer.type == _OrthancPluginDatabaseAnswerType_DeletedAttachment || |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1323 answer.type == _OrthancPluginDatabaseAnswerType_DeletedResource || |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1324 answer.type == _OrthancPluginDatabaseAnswerType_RemainingAncestor) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1325 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1326 assert(listener_ != NULL); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1327 ProcessEvent(*listener_, answer); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1328 return; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1329 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1330 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1331 if (type_ == _OrthancPluginDatabaseAnswerType_None) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1332 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1333 type_ = answer.type; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1334 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1335 switch (type_) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1336 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1337 case _OrthancPluginDatabaseAnswerType_Int32: |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1338 answerInt32_.clear(); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1339 break; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1340 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1341 case _OrthancPluginDatabaseAnswerType_Int64: |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1342 answerInt64_.clear(); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1343 break; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1344 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1345 case _OrthancPluginDatabaseAnswerType_Resource: |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1346 answerResources_.clear(); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1347 break; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1348 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1349 case _OrthancPluginDatabaseAnswerType_Attachment: |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1350 answerAttachments_.clear(); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1351 break; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1352 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1353 case _OrthancPluginDatabaseAnswerType_String: |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1354 answerStrings_.clear(); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1355 break; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1356 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1357 case _OrthancPluginDatabaseAnswerType_DicomTag: |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1358 assert(answerDicomMap_ != NULL); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1359 answerDicomMap_->Clear(); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1360 break; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1361 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1362 case _OrthancPluginDatabaseAnswerType_Change: |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1363 assert(answerChanges_ != NULL); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1364 answerChanges_->clear(); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1365 break; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1366 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1367 case _OrthancPluginDatabaseAnswerType_ExportedResource: |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1368 assert(answerExportedResources_ != NULL); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1369 answerExportedResources_->clear(); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1370 break; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1371 |
3076
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1372 case _OrthancPluginDatabaseAnswerType_MatchingResource: |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1373 assert(answerMatchingResources_ != NULL); |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1374 answerMatchingResources_->clear(); |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1375 |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1376 if (answerMatchingInstances_ != NULL) |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1377 { |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1378 answerMatchingInstances_->clear(); |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1379 } |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1380 |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1381 break; |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1382 |
3189
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1383 case _OrthancPluginDatabaseAnswerType_Metadata: |
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1384 assert(answerMetadata_ != NULL); |
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1385 answerMetadata_->clear(); |
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1386 break; |
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1387 |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1388 default: |
2956 | 1389 throw OrthancException(ErrorCode_DatabasePlugin, |
1390 "Unhandled type of answer for custom index plugin: " + | |
1391 boost::lexical_cast<std::string>(answer.type)); | |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1392 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1393 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1394 else if (type_ != answer.type) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1395 { |
2956 | 1396 throw OrthancException(ErrorCode_DatabasePlugin, |
1397 "Error in the plugin protocol: Cannot change the answer type"); | |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1398 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1399 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1400 switch (answer.type) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1401 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1402 case _OrthancPluginDatabaseAnswerType_Int32: |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1403 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1404 answerInt32_.push_back(answer.valueInt32); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1405 break; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1406 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1407 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1408 case _OrthancPluginDatabaseAnswerType_Int64: |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1409 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1410 answerInt64_.push_back(answer.valueInt64); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1411 break; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1412 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1413 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1414 case _OrthancPluginDatabaseAnswerType_Resource: |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1415 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1416 OrthancPluginResourceType type = static_cast<OrthancPluginResourceType>(answer.valueInt32); |
1672
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1417 answerResources_.push_back(std::make_pair(answer.valueInt64, Plugins::Convert(type))); |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1418 break; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1419 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1420 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1421 case _OrthancPluginDatabaseAnswerType_Attachment: |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1422 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1423 const OrthancPluginAttachment& attachment = |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1424 *reinterpret_cast<const OrthancPluginAttachment*>(answer.valueGeneric); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1425 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1426 answerAttachments_.push_back(Convert(attachment)); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1427 break; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1428 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1429 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1430 case _OrthancPluginDatabaseAnswerType_DicomTag: |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1431 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1432 const OrthancPluginDicomTag& tag = *reinterpret_cast<const OrthancPluginDicomTag*>(answer.valueGeneric); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1433 assert(answerDicomMap_ != NULL); |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1434 answerDicomMap_->SetValue(tag.group, tag.element, std::string(tag.value), false); |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1435 break; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1436 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1437 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1438 case _OrthancPluginDatabaseAnswerType_String: |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1439 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1440 if (answer.valueString == NULL) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1441 { |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1629
diff
changeset
|
1442 throw OrthancException(ErrorCode_DatabasePlugin); |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1443 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1444 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1445 if (type_ == _OrthancPluginDatabaseAnswerType_None) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1446 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1447 type_ = _OrthancPluginDatabaseAnswerType_String; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1448 answerStrings_.clear(); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1449 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1450 else if (type_ != _OrthancPluginDatabaseAnswerType_String) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1451 { |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1629
diff
changeset
|
1452 throw OrthancException(ErrorCode_DatabasePlugin); |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1453 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1454 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1455 answerStrings_.push_back(std::string(answer.valueString)); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1456 break; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1457 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1458 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1459 case _OrthancPluginDatabaseAnswerType_Change: |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1460 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1461 assert(answerDone_ != NULL); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1462 if (answer.valueUint32 == 1) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1463 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1464 *answerDone_ = true; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1465 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1466 else if (*answerDone_) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1467 { |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1629
diff
changeset
|
1468 throw OrthancException(ErrorCode_DatabasePlugin); |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1469 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1470 else |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1471 { |
3078 | 1472 const OrthancPluginChange& change = |
1473 *reinterpret_cast<const OrthancPluginChange*>(answer.valueGeneric); | |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1474 assert(answerChanges_ != NULL); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1475 answerChanges_->push_back |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1476 (ServerIndexChange(change.seq, |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1477 static_cast<ChangeType>(change.changeType), |
1672
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1478 Plugins::Convert(change.resourceType), |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1479 change.publicId, |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1480 change.date)); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1481 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1482 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1483 break; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1484 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1485 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1486 case _OrthancPluginDatabaseAnswerType_ExportedResource: |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1487 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1488 assert(answerDone_ != NULL); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1489 if (answer.valueUint32 == 1) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1490 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1491 *answerDone_ = true; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1492 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1493 else if (*answerDone_) |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1494 { |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1629
diff
changeset
|
1495 throw OrthancException(ErrorCode_DatabasePlugin); |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1496 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1497 else |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1498 { |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1499 const OrthancPluginExportedResource& exported = |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1500 *reinterpret_cast<const OrthancPluginExportedResource*>(answer.valueGeneric); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1501 assert(answerExportedResources_ != NULL); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1502 answerExportedResources_->push_back |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1503 (ExportedResource(exported.seq, |
1672
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1504 Plugins::Convert(exported.resourceType), |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1505 exported.publicId, |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1506 exported.modality, |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1507 exported.date, |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1508 exported.patientId, |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1509 exported.studyInstanceUid, |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1510 exported.seriesInstanceUid, |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1511 exported.sopInstanceUid)); |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1512 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1513 |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1514 break; |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1515 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1516 |
3076
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1517 case _OrthancPluginDatabaseAnswerType_MatchingResource: |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1518 { |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1519 const OrthancPluginMatchingResource& match = |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1520 *reinterpret_cast<const OrthancPluginMatchingResource*>(answer.valueGeneric); |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1521 |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1522 if (match.resourceId == NULL) |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1523 { |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1524 throw OrthancException(ErrorCode_DatabasePlugin); |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1525 } |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1526 |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1527 assert(answerMatchingResources_ != NULL); |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1528 answerMatchingResources_->push_back(match.resourceId); |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1529 |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1530 if (answerMatchingInstances_ != NULL) |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1531 { |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1532 if (match.someInstanceId == NULL) |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1533 { |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1534 throw OrthancException(ErrorCode_DatabasePlugin); |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1535 } |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1536 |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1537 answerMatchingInstances_->push_back(match.someInstanceId); |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1538 } |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1539 |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1540 break; |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1541 } |
8bc2cb1335f4
OrthancPluginDatabase::ApplyLookupResources() using fast lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
1542 |
3189
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1543 case _OrthancPluginDatabaseAnswerType_Metadata: |
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1544 { |
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1545 const OrthancPluginResourcesContentMetadata& metadata = |
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1546 *reinterpret_cast<const OrthancPluginResourcesContentMetadata*>(answer.valueGeneric); |
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1547 |
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1548 MetadataType type = static_cast<MetadataType>(metadata.metadata); |
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1549 |
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1550 if (metadata.value == NULL) |
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1551 { |
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1552 throw OrthancException(ErrorCode_DatabasePlugin); |
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1553 } |
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1554 |
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1555 assert(answerMetadata_ != NULL && |
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1556 answerMetadata_->find(type) == answerMetadata_->end()); |
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1557 (*answerMetadata_) [type] = metadata.value; |
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1558 break; |
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1559 } |
6f89d22a6ec0
New extensions in the database SDK: LookupResourceAndParent and GetAllMetadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
1560 |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1561 default: |
2956 | 1562 throw OrthancException(ErrorCode_DatabasePlugin, |
1563 "Unhandled type of answer for custom index plugin: " + | |
1564 boost::lexical_cast<std::string>(answer.type)); | |
1309
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1565 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1566 } |
8f4487d8f79e
new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1567 } |