Mercurial > hg > orthanc
annotate OrthancServer/SQLiteDatabaseWrapper.h @ 3080:1a75595d8e44 db-changes
started refactoring of ServerIndex::Store()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 03 Jan 2019 18:21:22 +0100 |
parents | ead8576a02ef |
children | 847a0ed92654 |
rev | line source |
---|---|
183 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1286
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
3060
4e43e67f8ecf
preparing for 2019
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2773
diff
changeset
|
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium |
183 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU General Public License as | |
9 * published by the Free Software Foundation, either version 3 of the | |
10 * License, or (at your option) any later version. | |
11 * | |
12 * In addition, as a special exception, the copyright holders of this | |
13 * program give permission to link the code of its release with the | |
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
15 * that use the same license as the "OpenSSL" library), and distribute | |
16 * the linked executables. You must obey the GNU General Public License | |
17 * in all respects for all of the code used other than "OpenSSL". If you | |
18 * modify file(s) with this exception, you may extend this exception to | |
19 * your version of the file(s), but you are not obligated to do so. If | |
20 * you do not wish to do so, delete this exception statement from your | |
21 * version. If you delete this exception statement from all source files | |
22 * in the program, then also delete it here. | |
23 * | |
24 * This program is distributed in the hope that it will be useful, but | |
25 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
27 * General Public License for more details. | |
28 * | |
29 * You should have received a copy of the GNU General Public License | |
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
31 **/ | |
32 | |
33 | |
34 #pragma once | |
35 | |
1247 | 36 #include "IDatabaseWrapper.h" |
37 | |
183 | 38 #include "../Core/SQLite/Connection.h" |
3080
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
39 #include "Search/Compatibility/ICompatibilityCreateInstance.h" |
1242 | 40 |
183 | 41 namespace Orthanc |
42 { | |
43 namespace Internals | |
44 { | |
45 class SignalRemainingAncestor; | |
46 } | |
47 | |
48 /** | |
49 * This class manages an instance of the Orthanc SQLite database. It | |
50 * translates low-level requests into SQL statements. Mutual | |
51 * exclusion MUST be implemented at a higher level. | |
52 **/ | |
3080
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
53 class SQLiteDatabaseWrapper : |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
54 public IDatabaseWrapper, |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
55 public Compatibility::ICompatibilityCreateInstance |
183 | 56 { |
57 private: | |
3019
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3017
diff
changeset
|
58 class Transaction; |
3058
6faf575ba9cc
refactoring: class ISqlLookupFormatter to be used in orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3056
diff
changeset
|
59 class LookupFormatter; |
3019
8336204d95dc
refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3017
diff
changeset
|
60 |
1432
0ac74fa21db8
rename IServerIndexListener as IDatabaseListener
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1306
diff
changeset
|
61 IDatabaseListener* listener_; |
183 | 62 SQLite::Connection db_; |
63 Internals::SignalRemainingAncestor* signalRemainingAncestor_; | |
1615
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1509
diff
changeset
|
64 unsigned int version_; |
183 | 65 |
2773
bb63068844ae
moving DatabaseWrapperBase into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2772
diff
changeset
|
66 void GetChangesInternal(std::list<ServerIndexChange>& target, |
bb63068844ae
moving DatabaseWrapperBase into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2772
diff
changeset
|
67 bool& done, |
bb63068844ae
moving DatabaseWrapperBase into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2772
diff
changeset
|
68 SQLite::Statement& s, |
bb63068844ae
moving DatabaseWrapperBase into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2772
diff
changeset
|
69 uint32_t maxResults); |
bb63068844ae
moving DatabaseWrapperBase into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2772
diff
changeset
|
70 |
bb63068844ae
moving DatabaseWrapperBase into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2772
diff
changeset
|
71 void GetExportedResourcesInternal(std::list<ExportedResource>& target, |
bb63068844ae
moving DatabaseWrapperBase into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2772
diff
changeset
|
72 bool& done, |
bb63068844ae
moving DatabaseWrapperBase into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2772
diff
changeset
|
73 SQLite::Statement& s, |
bb63068844ae
moving DatabaseWrapperBase into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2772
diff
changeset
|
74 uint32_t maxResults); |
bb63068844ae
moving DatabaseWrapperBase into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2772
diff
changeset
|
75 |
1286 | 76 void ClearTable(const std::string& tableName); |
77 | |
183 | 78 public: |
3017
517fc4767ae0
renamed class DatabaseWrapper as SQLiteDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2773
diff
changeset
|
79 SQLiteDatabaseWrapper(const std::string& path); |
1247 | 80 |
3017
517fc4767ae0
renamed class DatabaseWrapper as SQLiteDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2773
diff
changeset
|
81 SQLiteDatabaseWrapper(); |
1247 | 82 |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
83 virtual void Open() |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
84 ORTHANC_OVERRIDE; |
1672
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
85 |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
86 virtual void Close() |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
87 ORTHANC_OVERRIDE |
1672
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
88 { |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
89 db_.Close(); |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
90 } |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
91 |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
92 virtual void SetListener(IDatabaseListener& listener) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
93 ORTHANC_OVERRIDE; |
183 | 94 |
2772
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
95 virtual bool LookupParent(int64_t& parentId, |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
96 int64_t resourceId) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
97 ORTHANC_OVERRIDE; |
2772
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
98 |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
99 virtual std::string GetPublicId(int64_t resourceId) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
100 ORTHANC_OVERRIDE; |
2772
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
101 |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
102 virtual ResourceType GetResourceType(int64_t resourceId) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
103 ORTHANC_OVERRIDE; |
2772
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
104 |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
105 virtual void DeleteResource(int64_t id) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
106 ORTHANC_OVERRIDE; |
2772
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
107 |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
108 virtual void GetChanges(std::list<ServerIndexChange>& target /*out*/, |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
109 bool& done /*out*/, |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
110 int64_t since, |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
111 uint32_t maxResults) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
112 ORTHANC_OVERRIDE; |
2772
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
113 |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
114 virtual void GetLastChange(std::list<ServerIndexChange>& target /*out*/) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
115 ORTHANC_OVERRIDE; |
2772
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
116 |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
117 virtual IDatabaseWrapper::ITransaction* StartTransaction() |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
118 ORTHANC_OVERRIDE; |
2772
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
119 |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
120 virtual void FlushToDisk() |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
121 ORTHANC_OVERRIDE |
2772
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
122 { |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
123 db_.FlushToDisk(); |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
124 } |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
125 |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
126 virtual bool HasFlushToDisk() const |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
127 ORTHANC_OVERRIDE |
2772
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
128 { |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
129 return true; |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
130 } |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
131 |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
132 virtual void ClearChanges() |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
133 ORTHANC_OVERRIDE |
2772
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
134 { |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
135 ClearTable("Changes"); |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
136 } |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
137 |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
138 virtual void ClearExportedResources() |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
139 ORTHANC_OVERRIDE |
2772
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
140 { |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
141 ClearTable("ExportedResources"); |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
142 } |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
143 |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
144 virtual void GetAllMetadata(std::map<MetadataType, std::string>& target, |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
145 int64_t id) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
146 ORTHANC_OVERRIDE; |
2772
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
147 |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
148 virtual unsigned int GetDatabaseVersion() |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
149 ORTHANC_OVERRIDE |
2772
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
150 { |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
151 return version_; |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
152 } |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
153 |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
154 virtual void Upgrade(unsigned int targetVersion, |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
155 IStorageArea& storageArea) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
156 ORTHANC_OVERRIDE; |
2772
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
157 |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
158 |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
159 /** |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
160 * The methods declared below are for unit testing only! |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
161 **/ |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
162 |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
163 const char* GetErrorMessage() const |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
164 { |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
165 return db_.GetErrorMessage(); |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
166 } |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
167 |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
168 void GetChildren(std::list<std::string>& childrenPublicIds, |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
169 int64_t id); |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
170 |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
171 int64_t GetTableRecordCount(const std::string& table); |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
172 |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
173 bool GetParentPublicId(std::string& target, |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
174 int64_t id); |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
175 |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
176 |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
177 |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
178 /** |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
179 * Until Orthanc 1.4.0, the methods below were part of the |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
180 * "DatabaseWrapperBase" class, that is now placed in the |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
181 * graveyard. |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
182 **/ |
f3df536e7366
moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2697
diff
changeset
|
183 |
1247 | 184 virtual void SetGlobalProperty(GlobalProperty property, |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
185 const std::string& value) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
186 ORTHANC_OVERRIDE; |
183 | 187 |
1247 | 188 virtual bool LookupGlobalProperty(std::string& target, |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
189 GlobalProperty property) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
190 ORTHANC_OVERRIDE; |
1247 | 191 |
192 virtual int64_t CreateResource(const std::string& publicId, | |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
193 ResourceType type) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
194 ORTHANC_OVERRIDE; |
183 | 195 |
1294 | 196 virtual bool LookupResource(int64_t& id, |
197 ResourceType& type, | |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
198 const std::string& publicId) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
199 ORTHANC_OVERRIDE; |
183 | 200 |
1247 | 201 virtual void AttachChild(int64_t parent, |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
202 int64_t child) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
203 ORTHANC_OVERRIDE; |
304 | 204 |
1247 | 205 virtual void SetMetadata(int64_t id, |
206 MetadataType type, | |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
207 const std::string& value) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
208 ORTHANC_OVERRIDE; |
1247 | 209 |
210 virtual void DeleteMetadata(int64_t id, | |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
211 MetadataType type) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
212 ORTHANC_OVERRIDE; |
183 | 213 |
1247 | 214 virtual bool LookupMetadata(std::string& target, |
215 int64_t id, | |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
216 MetadataType type) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
217 ORTHANC_OVERRIDE; |
183 | 218 |
1247 | 219 virtual void ListAvailableMetadata(std::list<MetadataType>& target, |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
220 int64_t id) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
221 ORTHANC_OVERRIDE; |
438 | 222 |
1247 | 223 virtual void AddAttachment(int64_t id, |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
224 const FileInfo& attachment) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
225 ORTHANC_OVERRIDE; |
183 | 226 |
1247 | 227 virtual void DeleteAttachment(int64_t id, |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
228 FileContentType attachment) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
229 ORTHANC_OVERRIDE; |
1247 | 230 |
1301 | 231 virtual void ListAvailableAttachments(std::list<FileContentType>& target, |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
232 int64_t id) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
233 ORTHANC_OVERRIDE; |
436
d51186bf7602
read access to metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
413
diff
changeset
|
234 |
1247 | 235 virtual bool LookupAttachment(FileInfo& attachment, |
236 int64_t id, | |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
237 FileContentType contentType) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
238 ORTHANC_OVERRIDE; |
183 | 239 |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
240 virtual void ClearMainDicomTags(int64_t id) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
241 ORTHANC_OVERRIDE; |
1668
de1413733c97
reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1664
diff
changeset
|
242 |
1286 | 243 virtual void SetMainDicomTag(int64_t id, |
244 const DicomTag& tag, | |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
245 const std::string& value) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
246 ORTHANC_OVERRIDE; |
699
2929e17f8447
add attachments to resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
247 |
1713 | 248 virtual void SetIdentifierTag(int64_t id, |
2773
bb63068844ae
moving DatabaseWrapperBase into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2772
diff
changeset
|
249 const DicomTag& tag, |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
250 const std::string& value) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
251 ORTHANC_OVERRIDE; |
1713 | 252 |
1247 | 253 virtual void GetMainDicomTags(DicomMap& map, |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
254 int64_t id) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
255 ORTHANC_OVERRIDE; |
440
23e5b35e3c5c
statistics for patient/studies/series/instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
438
diff
changeset
|
256 |
1301 | 257 virtual void GetChildrenPublicId(std::list<std::string>& target, |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
258 int64_t id) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
259 ORTHANC_OVERRIDE; |
200
9c58b2b03cf0
refactoring of read operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
199
diff
changeset
|
260 |
1301 | 261 virtual void GetChildrenInternalId(std::list<int64_t>& target, |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
262 int64_t id) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
263 ORTHANC_OVERRIDE; |
183 | 264 |
1247 | 265 virtual void LogChange(int64_t internalId, |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
266 const ServerIndexChange& change) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
267 ORTHANC_OVERRIDE; |
183 | 268 |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
269 virtual void LogExportedResource(const ExportedResource& resource) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
270 ORTHANC_OVERRIDE; |
183 | 271 |
1247 | 272 virtual void GetExportedResources(std::list<ExportedResource>& target /*out*/, |
273 bool& done /*out*/, | |
274 int64_t since, | |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
275 uint32_t maxResults) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
276 ORTHANC_OVERRIDE; |
237
16a4ac70bd8a
last change and export
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
233
diff
changeset
|
277 |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
278 virtual void GetLastExportedResource(std::list<ExportedResource>& target /*out*/) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
279 ORTHANC_OVERRIDE; |
183 | 280 |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
281 virtual uint64_t GetTotalCompressedSize() |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
282 ORTHANC_OVERRIDE; |
1247 | 283 |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
284 virtual uint64_t GetTotalUncompressedSize() |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
285 ORTHANC_OVERRIDE; |
238 | 286 |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
287 virtual uint64_t GetResourceCount(ResourceType resourceType) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
288 ORTHANC_OVERRIDE; |
190 | 289 |
1247 | 290 virtual void GetAllPublicIds(std::list<std::string>& target, |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
291 ResourceType resourceType) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
292 ORTHANC_OVERRIDE; |
262
2354560daf2f
primitives for recycling patients
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
238
diff
changeset
|
293 |
1509
0586ed8897f1
limit and since arguments while retrieving DICOM resources in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1432
diff
changeset
|
294 virtual void GetAllPublicIds(std::list<std::string>& target, |
0586ed8897f1
limit and since arguments while retrieving DICOM resources in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1432
diff
changeset
|
295 ResourceType resourceType, |
0586ed8897f1
limit and since arguments while retrieving DICOM resources in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1432
diff
changeset
|
296 size_t since, |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
297 size_t limit) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
298 ORTHANC_OVERRIDE; |
1509
0586ed8897f1
limit and since arguments while retrieving DICOM resources in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1432
diff
changeset
|
299 |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
300 virtual bool SelectPatientToRecycle(int64_t& internalId) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
301 ORTHANC_OVERRIDE; |
262
2354560daf2f
primitives for recycling patients
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
238
diff
changeset
|
302 |
1247 | 303 virtual bool SelectPatientToRecycle(int64_t& internalId, |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
304 int64_t patientIdToAvoid) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
305 ORTHANC_OVERRIDE; |
1247 | 306 |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
307 virtual bool IsProtectedPatient(int64_t internalId) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
308 ORTHANC_OVERRIDE; |
262
2354560daf2f
primitives for recycling patients
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
238
diff
changeset
|
309 |
1247 | 310 virtual void SetProtectedPatient(int64_t internalId, |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
311 bool isProtected) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
312 ORTHANC_OVERRIDE; |
183 | 313 |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
314 virtual bool IsExistingResource(int64_t internalId) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
315 ORTHANC_OVERRIDE; |
521 | 316 |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
317 virtual bool IsDiskSizeAbove(uint64_t threshold) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
318 ORTHANC_OVERRIDE; |
3025
039a9d262d64
preparing to speed up find in databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3020
diff
changeset
|
319 |
3075
ead8576a02ef
IDatabaseWrapper::ApplyLookupResources now returns lists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3061
diff
changeset
|
320 virtual void ApplyLookupResources(std::list<std::string>& resourcesId, |
ead8576a02ef
IDatabaseWrapper::ApplyLookupResources now returns lists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3061
diff
changeset
|
321 std::list<std::string>* instancesId, |
3029
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3027
diff
changeset
|
322 const std::vector<DatabaseConstraint>& lookup, |
3025
039a9d262d64
preparing to speed up find in databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3020
diff
changeset
|
323 ResourceType queryLevel, |
3050
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
324 size_t limit) |
d8a91acb7424
working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3038
diff
changeset
|
325 ORTHANC_OVERRIDE; |
3080
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
326 |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
327 virtual bool CreateInstance(CreateInstanceResult& result, |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
328 int64_t& instanceId, |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
329 const std::string& patient, |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
330 const std::string& study, |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
331 const std::string& series, |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
332 const std::string& instance, |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
333 bool overwrite) |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
334 { |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
335 return ICompatibilityCreateInstance::Apply( |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
336 result, instanceId, *this, *this, patient, study, series, instance, overwrite); |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3075
diff
changeset
|
337 } |
183 | 338 }; |
339 } |