Mercurial > hg > orthanc
annotate OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp @ 5209:154d37a56500 db-protobuf
started implementation of transactions
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 31 Mar 2023 17:33:33 +0200 |
parents | e7529e6241d2 |
children | 6a7a244c777d |
rev | line source |
---|---|
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * This program is free software: you can redistribute it and/or |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * modify it under the terms of the GNU General Public License as |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * published by the Free Software Foundation, either version 3 of the |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * License, or (at your option) any later version. |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, but |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * General Public License for more details. |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 **/ |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 #include "../../Sources/PrecompiledHeadersServer.h" |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #include "OrthancPluginDatabaseV4.h" |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 #if ORTHANC_ENABLE_PLUGINS != 1 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 # error The plugin support is disabled |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 #endif |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 #include "../../../OrthancFramework/Sources/Logging.h" |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 #include "../../../OrthancFramework/Sources/OrthancException.h" |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 #include "PluginsEnumerations.h" |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 #include "OrthancDatabasePlugin.pb.h" |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 #include <cassert> |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 namespace Orthanc |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 { |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
41 static void CheckSuccess(PluginsErrorDictionary& errorDictionary, |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
42 OrthancPluginErrorCode code) |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
43 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
44 if (code != OrthancPluginErrorCode_Success) |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
45 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
46 errorDictionary.LogError(code, true); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
47 throw OrthancException(static_cast<ErrorCode>(code)); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
48 } |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
49 } |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
50 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
51 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
52 static FileInfo Convert(const DatabasePluginMessages::FileInfo& source) |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
53 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
54 return FileInfo(source.uuid(), |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
55 static_cast<FileContentType>(source.content_type()), |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
56 source.uncompressed_size(), |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
57 source.uncompressed_hash(), |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
58 static_cast<CompressionType>(source.compression_type()), |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
59 source.compressed_size(), |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
60 source.compressed_hash()); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
61 } |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
62 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
63 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
64 static ResourceType Convert(DatabasePluginMessages::ResourceType type) |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
65 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
66 switch (type) |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
67 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
68 case DatabasePluginMessages::RESOURCE_PATIENT: |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
69 return ResourceType_Patient; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
70 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
71 case DatabasePluginMessages::RESOURCE_STUDY: |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
72 return ResourceType_Study; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
73 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
74 case DatabasePluginMessages::RESOURCE_SERIES: |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
75 return ResourceType_Series; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
76 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
77 case DatabasePluginMessages::RESOURCE_INSTANCE: |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
78 return ResourceType_Instance; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
79 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
80 default: |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
81 throw OrthancException(ErrorCode_ParameterOutOfRange); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
82 } |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
83 } |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
84 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
85 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
86 static DatabasePluginMessages::ResourceType Convert(ResourceType type) |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
87 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
88 switch (type) |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
89 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
90 case ResourceType_Patient: |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
91 return DatabasePluginMessages::RESOURCE_PATIENT; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
92 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
93 case ResourceType_Study: |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
94 return DatabasePluginMessages::RESOURCE_STUDY; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
95 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
96 case ResourceType_Series: |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
97 return DatabasePluginMessages::RESOURCE_SERIES; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
98 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
99 case ResourceType_Instance: |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
100 return DatabasePluginMessages::RESOURCE_INSTANCE; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
101 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
102 default: |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
103 throw OrthancException(ErrorCode_ParameterOutOfRange); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
104 } |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
105 } |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
106 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
107 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
108 static void Execute(DatabasePluginMessages::Response& response, |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
109 const OrthancPluginDatabaseV4& database, |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
110 const DatabasePluginMessages::Request& request) |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
111 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
112 std::string requestSerialized; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
113 request.SerializeToString(&requestSerialized); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
114 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
115 OrthancPluginMemoryBuffer64 responseSerialized; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
116 CheckSuccess(database.GetErrorDictionary(), database.GetDefinition().operations( |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
117 &responseSerialized, database.GetDefinition().backend, |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
118 requestSerialized.empty() ? NULL : requestSerialized.c_str(), |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
119 requestSerialized.size())); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
120 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
121 bool success = response.ParseFromArray(responseSerialized.data, responseSerialized.size); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
122 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
123 if (responseSerialized.size > 0) |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
124 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
125 free(responseSerialized.data); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
126 } |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
127 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
128 if (!success) |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
129 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
130 throw OrthancException(ErrorCode_DatabasePlugin, "Cannot unserialize protobuf originating from the database plugin"); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
131 } |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
132 } |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
133 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
134 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
135 static void ExecuteDatabase(DatabasePluginMessages::DatabaseResponse& response, |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
136 const OrthancPluginDatabaseV4& database, |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
137 DatabasePluginMessages::DatabaseOperation operation, |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
138 const DatabasePluginMessages::DatabaseRequest& request) |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
139 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
140 DatabasePluginMessages::Request fullRequest; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
141 fullRequest.set_type(DatabasePluginMessages::REQUEST_DATABASE); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
142 fullRequest.mutable_database_request()->CopyFrom(request); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
143 fullRequest.mutable_database_request()->set_operation(operation); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
144 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
145 DatabasePluginMessages::Response fullResponse; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
146 Execute(fullResponse, database, fullRequest); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
147 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
148 response.CopyFrom(fullResponse.database_response()); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
149 } |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
150 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
151 |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
152 class OrthancPluginDatabaseV4::Transaction : public IDatabaseWrapper::ITransaction |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
153 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
154 private: |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
155 OrthancPluginDatabaseV4& database_; |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
156 IDatabaseListener& listener_; |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 void* transaction_; |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
158 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
159 void ExecuteTransaction(DatabasePluginMessages::TransactionResponse& response, |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
160 DatabasePluginMessages::TransactionOperation operation, |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
161 const DatabasePluginMessages::TransactionRequest& request) |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
162 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
163 DatabasePluginMessages::Request fullRequest; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
164 fullRequest.set_type(DatabasePluginMessages::REQUEST_TRANSACTION); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
165 fullRequest.mutable_transaction_request()->CopyFrom(request); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
166 fullRequest.mutable_transaction_request()->set_transaction(reinterpret_cast<intptr_t>(transaction_)); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
167 fullRequest.mutable_transaction_request()->set_operation(operation); |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
168 |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
169 DatabasePluginMessages::Response fullResponse; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
170 Execute(fullResponse, database_, fullRequest); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
171 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
172 response.CopyFrom(fullResponse.transaction_response()); |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
173 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
174 |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
175 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
176 void ExecuteTransaction(DatabasePluginMessages::TransactionOperation operation, |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
177 const DatabasePluginMessages::TransactionRequest& request) |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
178 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
179 DatabasePluginMessages::TransactionResponse response; // Ignored |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
180 ExecuteTransaction(response, operation, request); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
181 } |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
182 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
183 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
184 void ExecuteTransaction(DatabasePluginMessages::TransactionOperation operation) |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
185 { |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
186 DatabasePluginMessages::TransactionResponse response; // Ignored |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
187 DatabasePluginMessages::TransactionRequest request; // Ignored |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
188 ExecuteTransaction(response, operation, request); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
189 } |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
190 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
191 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
192 public: |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
193 Transaction(OrthancPluginDatabaseV4& database, |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
194 IDatabaseListener& listener, |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
195 void* transaction) : |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
196 database_(database), |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
197 listener_(listener), |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
198 transaction_(transaction) |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
199 { |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
200 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
201 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
202 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
203 virtual ~Transaction() |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
204 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
205 { |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
206 DatabasePluginMessages::DatabaseRequest request; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
207 request.mutable_finalize_transaction()->set_transaction(reinterpret_cast<intptr_t>(transaction_)); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
208 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
209 DatabasePluginMessages::DatabaseResponse response; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
210 ExecuteDatabase(response, database_, DatabasePluginMessages::OPERATION_FINALIZE_TRANSACTION, request); |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
211 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
212 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
213 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
214 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
215 virtual void Rollback() ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
216 { |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
217 ExecuteTransaction(DatabasePluginMessages::OPERATION_ROLLBACK); |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
218 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
219 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
220 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
221 virtual void Commit(int64_t fileSizeDelta) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
222 { |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
223 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
224 DatabasePluginMessages::TransactionRequest request; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
225 request.mutable_commit()->set_file_size_delta(fileSizeDelta); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
226 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
227 ExecuteTransaction(DatabasePluginMessages::OPERATION_COMMIT, request); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
228 } |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
229 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
230 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
231 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
232 virtual void AddAttachment(int64_t id, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
233 const FileInfo& attachment, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
234 int64_t revision) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
235 { |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
236 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
237 DatabasePluginMessages::TransactionRequest request; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
238 request.mutable_add_attachment()->set_id(id); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
239 request.mutable_add_attachment()->mutable_attachment()->set_uuid(attachment.GetUuid()); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
240 request.mutable_add_attachment()->mutable_attachment()->set_content_type(attachment.GetContentType()); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
241 request.mutable_add_attachment()->mutable_attachment()->set_uncompressed_size(attachment.GetUncompressedSize()); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
242 request.mutable_add_attachment()->mutable_attachment()->set_uncompressed_hash(attachment.GetUncompressedMD5()); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
243 request.mutable_add_attachment()->mutable_attachment()->set_compression_type(attachment.GetCompressionType()); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
244 request.mutable_add_attachment()->mutable_attachment()->set_compressed_size(attachment.GetCompressedSize()); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
245 request.mutable_add_attachment()->mutable_attachment()->set_compressed_hash(attachment.GetCompressedMD5()); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
246 request.mutable_add_attachment()->set_revision(revision); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
247 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
248 ExecuteTransaction(DatabasePluginMessages::OPERATION_ADD_ATTACHMENT, request); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
249 } |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
250 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
251 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
252 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
253 virtual void ClearChanges() ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
254 { |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
255 ExecuteTransaction(DatabasePluginMessages::OPERATION_CLEAR_CHANGES); |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
256 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
257 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
258 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
259 virtual void ClearExportedResources() ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
260 { |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
261 ExecuteTransaction(DatabasePluginMessages::OPERATION_CLEAR_EXPORTED_RESOURCES); |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
262 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
263 |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
264 |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
265 virtual void DeleteAttachment(int64_t id, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
266 FileContentType attachment) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
267 { |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
268 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
269 DatabasePluginMessages::TransactionRequest request; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
270 request.mutable_delete_attachment()->set_id(id); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
271 request.mutable_delete_attachment()->set_type(attachment); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
272 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
273 DatabasePluginMessages::TransactionResponse response; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
274 ExecuteTransaction(response, DatabasePluginMessages::OPERATION_DELETE_ATTACHMENT, request); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
275 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
276 listener_.SignalAttachmentDeleted(Convert(response.delete_attachment().deleted_attachment())); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
277 } |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
278 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
279 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
280 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
281 virtual void DeleteMetadata(int64_t id, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
282 MetadataType type) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
283 { |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
284 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
285 DatabasePluginMessages::TransactionRequest request; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
286 request.mutable_delete_metadata()->set_id(id); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
287 request.mutable_delete_metadata()->set_type(type); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
288 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
289 ExecuteTransaction(DatabasePluginMessages::OPERATION_DELETE_METADATA, request); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
290 } |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
291 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
292 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
293 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
294 virtual void DeleteResource(int64_t id) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
295 { |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
296 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
297 DatabasePluginMessages::TransactionRequest request; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
298 request.mutable_delete_resource()->set_id(id); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
299 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
300 DatabasePluginMessages::TransactionResponse response; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
301 ExecuteTransaction(response, DatabasePluginMessages::OPERATION_DELETE_RESOURCE, request); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
302 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
303 for (int i = 0; i < response.delete_resource().deleted_attachments().size(); i++) |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
304 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
305 listener_.SignalAttachmentDeleted(Convert(response.delete_resource().deleted_attachments(i))); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
306 } |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
307 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
308 for (int i = 0; i < response.delete_resource().deleted_resources().size(); i++) |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
309 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
310 listener_.SignalResourceDeleted(Convert(response.delete_resource().deleted_resources(i).level()), |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
311 response.delete_resource().deleted_resources(i).public_id()); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
312 } |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
313 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
314 if (response.delete_resource().is_remaining_ancestor()) |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
315 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
316 listener_.SignalRemainingAncestor(Convert(response.delete_resource().remaining_ancestor().level()), |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
317 response.delete_resource().remaining_ancestor().public_id()); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
318 } |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
319 } |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
320 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
321 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
322 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
323 virtual void GetAllMetadata(std::map<MetadataType, std::string>& target, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
324 int64_t id) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
325 { |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
326 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
327 DatabasePluginMessages::TransactionRequest request; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
328 request.mutable_get_all_metadata()->set_id(id); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
329 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
330 DatabasePluginMessages::TransactionResponse response; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
331 ExecuteTransaction(response, DatabasePluginMessages::OPERATION_GET_ALL_METADATA, request); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
332 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
333 target.clear(); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
334 for (int i = 0; i < response.get_all_metadata().metadata().size(); i++) |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
335 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
336 MetadataType key = static_cast<MetadataType>(response.get_all_metadata().metadata(i).type()); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
337 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
338 if (target.find(key) == target.end()) |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
339 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
340 target[key] = response.get_all_metadata().metadata(i).value(); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
341 } |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
342 else |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
343 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
344 throw OrthancException(ErrorCode_DatabasePlugin); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
345 } |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
346 } |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
347 } |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
348 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
349 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
350 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
351 virtual void GetAllPublicIds(std::list<std::string>& target, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
352 ResourceType resourceType) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
353 { |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
354 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
355 DatabasePluginMessages::TransactionRequest request; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
356 request.mutable_get_all_public_ids()->set_resource_type(Convert(resourceType)); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
357 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
358 DatabasePluginMessages::TransactionResponse response; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
359 ExecuteTransaction(response, DatabasePluginMessages::OPERATION_GET_ALL_PUBLIC_IDS, request); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
360 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
361 target.clear(); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
362 for (int i = 0; i < response.get_all_public_ids().ids().size(); i++) |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
363 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
364 target.push_back(response.get_all_public_ids().ids(i)); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
365 } |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
366 } |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
367 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
368 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
369 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
370 virtual void GetAllPublicIds(std::list<std::string>& target, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
371 ResourceType resourceType, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
372 size_t since, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
373 size_t limit) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
374 { |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
375 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
376 DatabasePluginMessages::TransactionRequest request; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
377 request.mutable_get_all_public_ids_with_limits()->set_resource_type(Convert(resourceType)); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
378 request.mutable_get_all_public_ids_with_limits()->set_since(since); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
379 request.mutable_get_all_public_ids_with_limits()->set_limit(limit); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
380 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
381 DatabasePluginMessages::TransactionResponse response; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
382 ExecuteTransaction(response, DatabasePluginMessages::OPERATION_GET_ALL_PUBLIC_IDS_WITH_LIMITS, request); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
383 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
384 target.clear(); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
385 for (int i = 0; i < response.get_all_public_ids_with_limits().ids().size(); i++) |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
386 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
387 target.push_back(response.get_all_public_ids_with_limits().ids(i)); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
388 } |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
389 } |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
390 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
391 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
392 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
393 virtual void GetChanges(std::list<ServerIndexChange>& target /*out*/, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
394 bool& done /*out*/, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
395 int64_t since, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
396 uint32_t maxResults) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
397 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
398 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
399 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
400 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
401 virtual void GetChildrenInternalId(std::list<int64_t>& target, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
402 int64_t id) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
403 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
404 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
405 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
406 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
407 virtual void GetChildrenPublicId(std::list<std::string>& target, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
408 int64_t id) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
409 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
410 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
411 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
412 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
413 virtual void GetExportedResources(std::list<ExportedResource>& target /*out*/, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
414 bool& done /*out*/, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
415 int64_t since, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
416 uint32_t maxResults) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
417 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
418 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
419 |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
420 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
421 virtual void GetLastChange(std::list<ServerIndexChange>& target /*out*/) ORTHANC_OVERRIDE |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
422 { |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
423 } |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
424 |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
425 |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
426 virtual void GetLastExportedResource(std::list<ExportedResource>& target /*out*/) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
427 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
428 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
429 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
430 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
431 virtual void GetMainDicomTags(DicomMap& target, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
432 int64_t id) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
433 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
434 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
435 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
436 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
437 virtual std::string GetPublicId(int64_t resourceId) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
438 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
439 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
440 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
441 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
442 virtual uint64_t GetResourcesCount(ResourceType resourceType) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
443 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
444 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
445 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
446 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
447 virtual ResourceType GetResourceType(int64_t resourceId) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
448 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
449 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
450 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
451 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
452 virtual uint64_t GetTotalCompressedSize() ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
453 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
454 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
455 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
456 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
457 virtual uint64_t GetTotalUncompressedSize() ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
458 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
459 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
460 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
461 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
462 virtual bool IsProtectedPatient(int64_t internalId) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
463 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
464 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
465 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
466 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
467 virtual void ListAvailableAttachments(std::set<FileContentType>& target, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
468 int64_t id) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
469 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
470 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
471 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
472 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
473 virtual void LogChange(int64_t internalId, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
474 const ServerIndexChange& change) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
475 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
476 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
477 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
478 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
479 virtual void LogExportedResource(const ExportedResource& resource) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
480 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
481 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
482 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
483 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
484 virtual bool LookupAttachment(FileInfo& attachment, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
485 int64_t& revision, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
486 int64_t id, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
487 FileContentType contentType) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
488 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
489 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
490 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
491 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
492 virtual bool LookupGlobalProperty(std::string& target, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
493 GlobalProperty property, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
494 bool shared) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
495 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
496 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
497 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
498 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
499 virtual bool LookupMetadata(std::string& target, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
500 int64_t& revision, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
501 int64_t id, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
502 MetadataType type) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
503 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
504 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
505 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
506 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
507 virtual bool LookupParent(int64_t& parentId, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
508 int64_t resourceId) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
509 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
510 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
511 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
512 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
513 virtual bool LookupResource(int64_t& id, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
514 ResourceType& type, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
515 const std::string& publicId) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
516 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
517 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
518 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
519 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
520 virtual bool SelectPatientToRecycle(int64_t& internalId) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
521 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
522 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
523 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
524 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
525 virtual bool SelectPatientToRecycle(int64_t& internalId, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
526 int64_t patientIdToAvoid) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
527 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
528 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
529 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
530 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
531 virtual void SetGlobalProperty(GlobalProperty property, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
532 bool shared, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
533 const std::string& value) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
534 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
535 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
536 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
537 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
538 virtual void ClearMainDicomTags(int64_t id) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
539 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
540 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
541 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
542 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
543 virtual void SetMetadata(int64_t id, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
544 MetadataType type, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
545 const std::string& value, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
546 int64_t revision) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
547 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
548 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
549 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
550 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
551 virtual void SetProtectedPatient(int64_t internalId, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
552 bool isProtected) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
553 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
554 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
555 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
556 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
557 virtual bool IsDiskSizeAbove(uint64_t threshold) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
558 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
559 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
560 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
561 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
562 virtual void ApplyLookupResources(std::list<std::string>& resourcesId, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
563 std::list<std::string>* instancesId, // Can be NULL if not needed |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
564 const std::vector<DatabaseConstraint>& lookup, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
565 ResourceType queryLevel, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
566 size_t limit) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
567 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
568 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
569 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
570 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
571 virtual bool CreateInstance(CreateInstanceResult& result, /* out */ |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
572 int64_t& instanceId, /* out */ |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
573 const std::string& patient, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
574 const std::string& study, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
575 const std::string& series, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
576 const std::string& instance) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
577 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
578 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
579 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
580 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
581 virtual void SetResourcesContent(const ResourcesContent& content) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
582 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
583 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
584 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
585 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
586 virtual void GetChildrenMetadata(std::list<std::string>& target, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
587 int64_t resourceId, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
588 MetadataType metadata) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
589 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
590 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
591 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
592 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
593 virtual int64_t GetLastChangeIndex() ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
594 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
595 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
596 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
597 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
598 virtual bool LookupResourceAndParent(int64_t& id, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
599 ResourceType& type, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
600 std::string& parentPublicId, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
601 const std::string& publicId) ORTHANC_OVERRIDE |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
602 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
603 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
604 }; |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
605 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
606 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
607 OrthancPluginDatabaseV4::OrthancPluginDatabaseV4(SharedLibrary& library, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
608 PluginsErrorDictionary& errorDictionary, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
609 const _OrthancPluginRegisterDatabaseBackendV4& database, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
610 const std::string& serverIdentifier) : |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
611 library_(library), |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
612 errorDictionary_(errorDictionary), |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
613 definition_(database), |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
614 serverIdentifier_(serverIdentifier), |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
615 open_(false), |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
616 databaseVersion_(0), |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
617 hasFlushToDisk_(false), |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
618 hasRevisionsSupport_(false) |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
619 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
620 CLOG(INFO, PLUGINS) << "Identifier of this Orthanc server for the global properties " |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
621 << "of the custom database: \"" << serverIdentifier << "\""; |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
622 |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
623 if (definition_.backend == NULL || |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
624 definition_.operations == NULL || |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
625 definition_.finalize == NULL) |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
626 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
627 throw OrthancException(ErrorCode_NullPointer); |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
628 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
629 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
630 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
631 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
632 OrthancPluginDatabaseV4::~OrthancPluginDatabaseV4() |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
633 { |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
634 definition_.finalize(definition_.backend); |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
635 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
636 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
637 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
638 void OrthancPluginDatabaseV4::Open() |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
639 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
640 if (open_) |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
641 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
642 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
643 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
644 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
645 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
646 DatabasePluginMessages::DatabaseRequest request; |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
647 DatabasePluginMessages::DatabaseResponse response; |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
648 ExecuteDatabase(response, *this, DatabasePluginMessages::OPERATION_OPEN, request); |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
649 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
650 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
651 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
652 DatabasePluginMessages::DatabaseRequest request; |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
653 DatabasePluginMessages::DatabaseResponse response; |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
654 ExecuteDatabase(response, *this, DatabasePluginMessages::OPERATION_GET_SYSTEM_INFORMATION, request); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
655 databaseVersion_ = response.get_system_information().database_version(); |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
656 hasFlushToDisk_ = response.get_system_information().supports_flush_to_disk(); |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
657 hasRevisionsSupport_ = response.get_system_information().supports_revisions(); |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
658 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
659 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
660 open_ = true; |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
661 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
662 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
663 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
664 void OrthancPluginDatabaseV4::Close() |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
665 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
666 if (!open_) |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
667 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
668 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
669 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
670 else |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
671 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
672 DatabasePluginMessages::DatabaseRequest request; |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
673 DatabasePluginMessages::DatabaseResponse response; |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
674 ExecuteDatabase(response, *this, DatabasePluginMessages::OPERATION_CLOSE, request); |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
675 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
676 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
677 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
678 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
679 bool OrthancPluginDatabaseV4::HasFlushToDisk() const |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
680 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
681 if (!open_) |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
682 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
683 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
684 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
685 else |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
686 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
687 return hasFlushToDisk_; |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
688 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
689 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
690 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
691 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
692 void OrthancPluginDatabaseV4::FlushToDisk() |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
693 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
694 if (!open_ || |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
695 !hasFlushToDisk_) |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
696 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
697 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
698 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
699 else |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
700 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
701 DatabasePluginMessages::DatabaseRequest request; |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
702 DatabasePluginMessages::DatabaseResponse response; |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
703 ExecuteDatabase(response, *this, DatabasePluginMessages::OPERATION_FLUSH_TO_DISK, request); |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
704 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
705 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
706 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
707 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
708 IDatabaseWrapper::ITransaction* OrthancPluginDatabaseV4::StartTransaction(TransactionType type, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
709 IDatabaseListener& listener) |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
710 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
711 if (!open_) |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
712 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
713 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
714 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
715 |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
716 DatabasePluginMessages::DatabaseRequest request; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
717 |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
718 switch (type) |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
719 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
720 case TransactionType_ReadOnly: |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
721 request.mutable_start_transaction()->set_type(DatabasePluginMessages::TRANSACTION_READ_ONLY); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
722 break; |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
723 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
724 case TransactionType_ReadWrite: |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
725 request.mutable_start_transaction()->set_type(DatabasePluginMessages::TRANSACTION_READ_WRITE); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
726 break; |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
727 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
728 default: |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
729 throw OrthancException(ErrorCode_InternalError); |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
730 } |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
731 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
732 DatabasePluginMessages::DatabaseResponse response; |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
733 ExecuteDatabase(response, *this, DatabasePluginMessages::OPERATION_START_TRANSACTION, request); |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
734 |
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
735 return new Transaction(*this, listener, reinterpret_cast<void*>(response.start_transaction().transaction())); |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
736 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
737 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
738 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
739 unsigned int OrthancPluginDatabaseV4::GetDatabaseVersion() |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
740 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
741 if (!open_) |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
742 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
743 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
744 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
745 else |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
746 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
747 return databaseVersion_; |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
748 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
749 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
750 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
751 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
752 void OrthancPluginDatabaseV4::Upgrade(unsigned int targetVersion, |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
753 IStorageArea& storageArea) |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
754 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
755 if (!open_) |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
756 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
757 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
758 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
759 else |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
760 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
761 // TODO |
5209
154d37a56500
started implementation of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5207
diff
changeset
|
762 throw OrthancException(ErrorCode_NotImplemented); |
5207
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
763 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
764 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
765 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
766 |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
767 bool OrthancPluginDatabaseV4::HasRevisionsSupport() const |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
768 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
769 if (!open_) |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
770 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
771 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
772 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
773 else |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
774 { |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
775 return hasRevisionsSupport_; |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
776 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
777 } |
e7529e6241d2
first successful protobuf communication
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
778 } |