annotate OrthancServer/Sources/Database/SQLiteDatabaseWrapper.h @ 4587:888868a5dc4e db-changes

ServerIndex now uses StatelessDatabaseOperations
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 10 Mar 2021 15:59:03 +0100
parents 648defffc8cc
children bec74e29f86b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1750
diff changeset
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
4437
d9473bd5ed43 upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU General Public License as
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * published by the Free Software Foundation, either version 3 of the
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * License, or (at your option) any later version.
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * In addition, as a special exception, the copyright holders of this
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * program give permission to link the code of its release with the
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * that use the same license as the "OpenSSL" library), and distribute
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * the linked executables. You must obey the GNU General Public License
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * in all respects for all of the code used other than "OpenSSL". If you
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * modify file(s) with this exception, you may extend this exception to
baada606da3c databasewrapper
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
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * you do not wish to do so, delete this exception statement from your
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * version. If you delete this exception statement from all source files
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * in the program, then also delete it here.
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 *
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * This program is distributed in the hope that it will be useful, but
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * General Public License for more details.
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 *
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * You should have received a copy of the GNU General Public License
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 **/
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #pragma once
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
36 #include "IDatabaseWrapper.h"
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
37
4045
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
38 #include "../../../OrthancFramework/Sources/SQLite/Connection.h"
3093
2e1808b6146a reorganization of folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3091
diff changeset
39 #include "Compatibility/ICreateInstance.h"
2e1808b6146a reorganization of folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3091
diff changeset
40 #include "Compatibility/IGetChildrenMetadata.h"
3187
4bbadcd03966 refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3124
diff changeset
41 #include "Compatibility/ILookupResourceAndParent.h"
3093
2e1808b6146a reorganization of folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3091
diff changeset
42 #include "Compatibility/ISetResourcesContent.h"
1242
58e6a89c3ef4 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1241
diff changeset
43
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 namespace Orthanc
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 {
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 namespace Internals
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 {
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 class SignalRemainingAncestor;
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 }
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 /**
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 * This class manages an instance of the Orthanc SQLite database. It
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 * translates low-level requests into SQL statements. Mutual
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 * exclusion MUST be implemented at a higher level.
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 **/
3080
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
56 class SQLiteDatabaseWrapper :
3084
195ba4cbac3f reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3083
diff changeset
57 public IDatabaseWrapper,
195ba4cbac3f reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3083
diff changeset
58 public Compatibility::ICreateInstance,
3091
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
59 public Compatibility::IGetChildrenMetadata,
3187
4bbadcd03966 refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3124
diff changeset
60 public Compatibility::ILookupResourceAndParent,
3083
683d572424b6 IDatabaseWrapper::SetResourcesContent
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3082
diff changeset
61 public Compatibility::ISetResourcesContent
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 {
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 private:
4570
648defffc8cc new enum: TransactionType
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
64 class ReadOnlyTransaction;
648defffc8cc new enum: TransactionType
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
65 class ReadWriteTransaction;
3058
6faf575ba9cc refactoring: class ISqlLookupFormatter to be used in orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3056
diff changeset
66 class LookupFormatter;
3019
8336204d95dc refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3017
diff changeset
67
1432
0ac74fa21db8 rename IServerIndexListener as IDatabaseListener
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1306
diff changeset
68 IDatabaseListener* listener_;
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 SQLite::Connection db_;
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 Internals::SignalRemainingAncestor* signalRemainingAncestor_;
1615
c40fe92a68e7 Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1509
diff changeset
71 unsigned int version_;
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72
2773
bb63068844ae moving DatabaseWrapperBase into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2772
diff changeset
73 void GetChangesInternal(std::list<ServerIndexChange>& target,
bb63068844ae moving DatabaseWrapperBase into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2772
diff changeset
74 bool& done,
bb63068844ae moving DatabaseWrapperBase into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2772
diff changeset
75 SQLite::Statement& s,
bb63068844ae moving DatabaseWrapperBase into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2772
diff changeset
76 uint32_t maxResults);
bb63068844ae moving DatabaseWrapperBase into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2772
diff changeset
77
bb63068844ae moving DatabaseWrapperBase into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2772
diff changeset
78 void GetExportedResourcesInternal(std::list<ExportedResource>& target,
bb63068844ae moving DatabaseWrapperBase into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2772
diff changeset
79 bool& done,
bb63068844ae moving DatabaseWrapperBase into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2772
diff changeset
80 SQLite::Statement& s,
bb63068844ae moving DatabaseWrapperBase into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2772
diff changeset
81 uint32_t maxResults);
bb63068844ae moving DatabaseWrapperBase into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2772
diff changeset
82
1286
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
83 void ClearTable(const std::string& tableName);
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
84
3121
f86ebf971a72 fix unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3116
diff changeset
85 // Unused => could be removed
3116
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3105
diff changeset
86 int GetGlobalIntegerProperty(GlobalProperty property,
3121
f86ebf971a72 fix unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3116
diff changeset
87 int defaultValue);
3116
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3105
diff changeset
88
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 public:
3017
517fc4767ae0 renamed class DatabaseWrapper as SQLiteDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2773
diff changeset
90 SQLiteDatabaseWrapper(const std::string& path);
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
91
3017
517fc4767ae0 renamed class DatabaseWrapper as SQLiteDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2773
diff changeset
92 SQLiteDatabaseWrapper();
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
93
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
94 virtual void Open()
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
95 ORTHANC_OVERRIDE;
1672
4c5a85c3ff43 sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1671
diff changeset
96
4c5a85c3ff43 sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1671
diff changeset
97 virtual void Close()
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
98 ORTHANC_OVERRIDE
1672
4c5a85c3ff43 sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1671
diff changeset
99 {
4c5a85c3ff43 sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1671
diff changeset
100 db_.Close();
4c5a85c3ff43 sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1671
diff changeset
101 }
4c5a85c3ff43 sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1671
diff changeset
102
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
103 virtual void SetListener(IDatabaseListener& listener)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
104 ORTHANC_OVERRIDE;
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105
2772
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
106 virtual bool LookupParent(int64_t& parentId,
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
107 int64_t resourceId)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
108 ORTHANC_OVERRIDE;
2772
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
109
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
110 virtual std::string GetPublicId(int64_t resourceId)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
111 ORTHANC_OVERRIDE;
2772
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
112
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
113 virtual ResourceType GetResourceType(int64_t resourceId)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
114 ORTHANC_OVERRIDE;
2772
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
115
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
116 virtual void DeleteResource(int64_t id)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
117 ORTHANC_OVERRIDE;
2772
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
118
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
119 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
120 bool& done /*out*/,
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
121 int64_t since,
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
122 uint32_t maxResults)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
123 ORTHANC_OVERRIDE;
2772
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
124
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
125 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
126 ORTHANC_OVERRIDE;
2772
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
127
4570
648defffc8cc new enum: TransactionType
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
128 virtual IDatabaseWrapper::ITransaction* StartTransaction(TransactionType type)
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
129 ORTHANC_OVERRIDE;
2772
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 virtual void FlushToDisk()
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
132 ORTHANC_OVERRIDE
2772
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
133 {
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
134 db_.FlushToDisk();
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
135 }
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 virtual bool HasFlushToDisk() const
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
138 ORTHANC_OVERRIDE
2772
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
139 {
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
140 return true;
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
141 }
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 virtual void ClearChanges()
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
144 ORTHANC_OVERRIDE
2772
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
145 {
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
146 ClearTable("Changes");
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
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
149 virtual void ClearExportedResources()
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
150 ORTHANC_OVERRIDE
2772
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
151 {
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
152 ClearTable("ExportedResources");
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
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
155 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
156 int64_t id)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
157 ORTHANC_OVERRIDE;
2772
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 virtual unsigned int GetDatabaseVersion()
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
160 ORTHANC_OVERRIDE
2772
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 return version_;
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
163 }
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 virtual void Upgrade(unsigned int targetVersion,
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
166 IStorageArea& storageArea)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
167 ORTHANC_OVERRIDE;
2772
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
168
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
169
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 * 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
172 **/
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
173
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
174 const char* GetErrorMessage() const
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 return db_.GetErrorMessage();
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 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
180 int64_t id);
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
181
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
182 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
183
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
184 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
185 int64_t id);
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
186
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
187
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
188
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
189 /**
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
190 * 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
191 * "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
192 * graveyard.
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
193 **/
f3df536e7366 moving the outdated database plugin sample into the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
194
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
195 virtual void SetGlobalProperty(GlobalProperty property,
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
196 const std::string& value)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
197 ORTHANC_OVERRIDE;
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
199 virtual bool LookupGlobalProperty(std::string& target,
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
200 GlobalProperty property)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
201 ORTHANC_OVERRIDE;
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
202
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
203 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
204 ResourceType type)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
205 ORTHANC_OVERRIDE;
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206
1294
910478b2d4e4 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
207 virtual bool LookupResource(int64_t& id,
910478b2d4e4 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
208 ResourceType& type,
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
209 const std::string& publicId)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
210 ORTHANC_OVERRIDE;
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
212 virtual void AttachChild(int64_t parent,
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
213 int64_t child)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
214 ORTHANC_OVERRIDE;
304
4eea080e6e7a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
215
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
216 virtual void SetMetadata(int64_t id,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
217 MetadataType type,
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
218 const std::string& value)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
219 ORTHANC_OVERRIDE;
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
220
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
221 virtual void DeleteMetadata(int64_t id,
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
222 MetadataType type)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
223 ORTHANC_OVERRIDE;
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
225 virtual bool LookupMetadata(std::string& target,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
226 int64_t id,
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
227 MetadataType type)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
228 ORTHANC_OVERRIDE;
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
230 virtual void AddAttachment(int64_t id,
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
231 const FileInfo& attachment)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
232 ORTHANC_OVERRIDE;
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
234 virtual void DeleteAttachment(int64_t id,
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
235 FileContentType attachment)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
236 ORTHANC_OVERRIDE;
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
237
4514
5b929e6b3c36 removal of "dicom-as-json" attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
238 virtual void ListAvailableAttachments(std::set<FileContentType>& target,
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
239 int64_t id)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
240 ORTHANC_OVERRIDE;
436
d51186bf7602 read access to metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
241
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
242 virtual bool LookupAttachment(FileInfo& attachment,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
243 int64_t id,
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
244 FileContentType contentType)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
245 ORTHANC_OVERRIDE;
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
247 virtual void ClearMainDicomTags(int64_t id)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
248 ORTHANC_OVERRIDE;
1668
de1413733c97 reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1664
diff changeset
249
1286
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
250 virtual void SetMainDicomTag(int64_t id,
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
251 const DicomTag& tag,
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
252 const std::string& value)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
253 ORTHANC_OVERRIDE;
699
2929e17f8447 add attachments to resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
254
1713
4db9200c7f46 SetIdentifierTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1711
diff changeset
255 virtual void SetIdentifierTag(int64_t id,
2773
bb63068844ae moving DatabaseWrapperBase into graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2772
diff changeset
256 const DicomTag& tag,
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
257 const std::string& value)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
258 ORTHANC_OVERRIDE;
1713
4db9200c7f46 SetIdentifierTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1711
diff changeset
259
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
260 virtual void GetMainDicomTags(DicomMap& map,
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
261 int64_t id)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
262 ORTHANC_OVERRIDE;
440
23e5b35e3c5c statistics for patient/studies/series/instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 438
diff changeset
263
1301
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1294
diff changeset
264 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
265 int64_t id)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
266 ORTHANC_OVERRIDE;
200
9c58b2b03cf0 refactoring of read operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 199
diff changeset
267
1301
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1294
diff changeset
268 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
269 int64_t id)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
270 ORTHANC_OVERRIDE;
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
272 virtual void LogChange(int64_t internalId,
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
273 const ServerIndexChange& change)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
274 ORTHANC_OVERRIDE;
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
276 virtual void LogExportedResource(const ExportedResource& resource)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
277 ORTHANC_OVERRIDE;
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
279 virtual void GetExportedResources(std::list<ExportedResource>& target /*out*/,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
280 bool& done /*out*/,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
281 int64_t since,
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
282 uint32_t maxResults)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
283 ORTHANC_OVERRIDE;
237
16a4ac70bd8a last change and export
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 233
diff changeset
284
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
285 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
286 ORTHANC_OVERRIDE;
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
288 virtual uint64_t GetTotalCompressedSize()
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
289 ORTHANC_OVERRIDE;
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
290
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
291 virtual uint64_t GetTotalUncompressedSize()
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
292 ORTHANC_OVERRIDE;
238
e4148b0ab1d0 statistics URI
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 237
diff changeset
293
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
294 virtual uint64_t GetResourceCount(ResourceType resourceType)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
295 ORTHANC_OVERRIDE;
190
b6cef9d45cc3 getallpublicids
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 189
diff changeset
296
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
297 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
298 ResourceType resourceType)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
299 ORTHANC_OVERRIDE;
262
2354560daf2f primitives for recycling patients
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 238
diff changeset
300
1509
0586ed8897f1 limit and since arguments while retrieving DICOM resources in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1432
diff changeset
301 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
302 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
303 size_t since,
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
304 size_t limit)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
305 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
306
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
307 virtual bool SelectPatientToRecycle(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
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
310 virtual bool SelectPatientToRecycle(int64_t& internalId,
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
311 int64_t patientIdToAvoid)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
312 ORTHANC_OVERRIDE;
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
313
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
314 virtual bool IsProtectedPatient(int64_t internalId)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
315 ORTHANC_OVERRIDE;
262
2354560daf2f primitives for recycling patients
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 238
diff changeset
316
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
317 virtual void SetProtectedPatient(int64_t internalId,
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
318 bool isProtected)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
319 ORTHANC_OVERRIDE;
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
321 virtual bool IsExistingResource(int64_t internalId)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
322 ORTHANC_OVERRIDE;
521
2c739f76d0bb lookup tag values
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 513
diff changeset
323
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
324 virtual bool IsDiskSizeAbove(uint64_t threshold)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
325 ORTHANC_OVERRIDE;
3025
039a9d262d64 preparing to speed up find in databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3020
diff changeset
326
3075
ead8576a02ef IDatabaseWrapper::ApplyLookupResources now returns lists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3061
diff changeset
327 virtual void ApplyLookupResources(std::list<std::string>& resourcesId,
ead8576a02ef IDatabaseWrapper::ApplyLookupResources now returns lists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3061
diff changeset
328 std::list<std::string>* instancesId,
3029
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3027
diff changeset
329 const std::vector<DatabaseConstraint>& lookup,
3025
039a9d262d64 preparing to speed up find in databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3020
diff changeset
330 ResourceType queryLevel,
3050
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
331 size_t limit)
d8a91acb7424 working on a database compatibility layer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3038
diff changeset
332 ORTHANC_OVERRIDE;
3080
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
333
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
334 virtual bool CreateInstance(CreateInstanceResult& result,
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
335 int64_t& instanceId,
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
336 const std::string& patient,
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
337 const std::string& study,
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
338 const std::string& series,
3091
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
339 const std::string& instance)
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
340 ORTHANC_OVERRIDE
3080
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
341 {
3084
195ba4cbac3f reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3083
diff changeset
342 return ICreateInstance::Apply
3091
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
343 (*this, result, instanceId, patient, study, series, instance);
3084
195ba4cbac3f reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3083
diff changeset
344 }
195ba4cbac3f reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3083
diff changeset
345
3091
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
346 virtual void SetResourcesContent(const Orthanc::ResourcesContent& content)
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
347 ORTHANC_OVERRIDE
3084
195ba4cbac3f reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3083
diff changeset
348 {
195ba4cbac3f reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3083
diff changeset
349 ISetResourcesContent::Apply(*this, content);
3080
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
350 }
3091
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
351
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
352 virtual void GetChildrenMetadata(std::list<std::string>& target,
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
353 int64_t resourceId,
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
354 MetadataType metadata)
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
355 ORTHANC_OVERRIDE
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
356 {
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
357 IGetChildrenMetadata::Apply(*this, target, resourceId, metadata);
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
358 }
3105
2e1711f80f74 More consistent handling of the "Last" field returned by the "/changes" URI
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
359
2e1711f80f74 More consistent handling of the "Last" field returned by the "/changes" URI
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
360 virtual int64_t GetLastChangeIndex() ORTHANC_OVERRIDE;
3121
f86ebf971a72 fix unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3116
diff changeset
361
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
362 virtual void TagMostRecentPatient(int64_t patient) ORTHANC_OVERRIDE;
3187
4bbadcd03966 refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3124
diff changeset
363
4bbadcd03966 refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3124
diff changeset
364 virtual bool LookupResourceAndParent(int64_t& id,
4bbadcd03966 refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3124
diff changeset
365 ResourceType& type,
4bbadcd03966 refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3124
diff changeset
366 std::string& parentPublicId,
4bbadcd03966 refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3124
diff changeset
367 const std::string& publicId)
4bbadcd03966 refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3124
diff changeset
368 ORTHANC_OVERRIDE
4bbadcd03966 refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3124
diff changeset
369 {
4bbadcd03966 refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3124
diff changeset
370 return ILookupResourceAndParent::Apply(*this, id, type, parentPublicId, publicId);
4bbadcd03966 refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3124
diff changeset
371 }
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
372 };
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
373 }