1247
|
1 /**
|
|
2 * Orthanc - A Lightweight, RESTful DICOM Store
|
|
3 * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege,
|
|
4 * Belgium
|
|
5 *
|
|
6 * This program is free software: you can redistribute it and/or
|
|
7 * modify it under the terms of the GNU General Public License as
|
|
8 * published by the Free Software Foundation, either version 3 of the
|
|
9 * License, or (at your option) any later version.
|
|
10 *
|
|
11 * In addition, as a special exception, the copyright holders of this
|
|
12 * program give permission to link the code of its release with the
|
|
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it
|
|
14 * that use the same license as the "OpenSSL" library), and distribute
|
|
15 * the linked executables. You must obey the GNU General Public License
|
|
16 * in all respects for all of the code used other than "OpenSSL". If you
|
|
17 * modify file(s) with this exception, you may extend this exception to
|
|
18 * your version of the file(s), but you are not obligated to do so. If
|
|
19 * you do not wish to do so, delete this exception statement from your
|
|
20 * version. If you delete this exception statement from all source files
|
|
21 * in the program, then also delete it here.
|
|
22 *
|
|
23 * This program is distributed in the hope that it will be useful, but
|
|
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
26 * General Public License for more details.
|
|
27 *
|
|
28 * You should have received a copy of the GNU General Public License
|
|
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
30 **/
|
|
31
|
|
32
|
|
33 #pragma once
|
|
34
|
|
35 #include "../Core/DicomFormat/DicomMap.h"
|
|
36 #include "../Core/SQLite/ITransaction.h"
|
|
37 #include "../Core/FileStorage/FileInfo.h"
|
|
38 #include "IServerIndexListener.h"
|
|
39 #include "ExportedResource.h"
|
|
40
|
|
41 #include <list>
|
|
42 #include <boost/noncopyable.hpp>
|
|
43
|
|
44 namespace Orthanc
|
|
45 {
|
|
46 class IDatabaseWrapper : public boost::noncopyable
|
|
47 {
|
|
48 public:
|
|
49 virtual ~IDatabaseWrapper()
|
|
50 {
|
|
51 }
|
|
52
|
|
53 virtual void AddAttachment(int64_t id,
|
|
54 const FileInfo& attachment) = 0;
|
|
55
|
|
56 virtual void AttachChild(int64_t parent,
|
|
57 int64_t child) = 0;
|
|
58
|
1286
|
59 virtual void ClearChanges() = 0;
|
|
60
|
|
61 virtual void ClearExportedResources() = 0;
|
1247
|
62
|
|
63 virtual int64_t CreateResource(const std::string& publicId,
|
|
64 ResourceType type) = 0;
|
|
65
|
|
66 virtual void DeleteAttachment(int64_t id,
|
|
67 FileContentType attachment) = 0;
|
|
68
|
|
69 virtual void DeleteMetadata(int64_t id,
|
|
70 MetadataType type) = 0;
|
|
71
|
|
72 virtual void DeleteResource(int64_t id) = 0;
|
|
73
|
|
74 virtual void FlushToDisk() = 0;
|
|
75
|
|
76 virtual void GetAllMetadata(std::map<MetadataType, std::string>& result,
|
|
77 int64_t id) = 0;
|
|
78
|
|
79 virtual void GetAllPublicIds(std::list<std::string>& target,
|
|
80 ResourceType resourceType) = 0;
|
|
81
|
|
82
|
|
83 virtual void GetChanges(std::list<ServerIndexChange>& target /*out*/,
|
|
84 bool& done /*out*/,
|
|
85 int64_t since,
|
|
86 unsigned int maxResults) = 0;
|
|
87
|
|
88 virtual void GetChildrenInternalId(std::list<int64_t>& result,
|
|
89 int64_t id) = 0;
|
|
90
|
|
91 virtual void GetChildrenPublicId(std::list<std::string>& result,
|
|
92 int64_t id) = 0;
|
|
93
|
|
94 virtual void GetExportedResources(std::list<ExportedResource>& target /*out*/,
|
|
95 bool& done /*out*/,
|
|
96 int64_t since,
|
|
97 unsigned int maxResults) = 0;
|
|
98
|
|
99 virtual void GetLastChange(std::list<ServerIndexChange>& target /*out*/) = 0;
|
|
100
|
|
101 virtual void GetLastExportedResource(std::list<ExportedResource>& target /*out*/) = 0;
|
|
102
|
|
103 virtual void GetMainDicomTags(DicomMap& map,
|
|
104 int64_t id) = 0;
|
|
105
|
|
106 virtual std::string GetPublicId(int64_t resourceId) = 0;
|
|
107
|
|
108 virtual uint64_t GetResourceCount(ResourceType resourceType) = 0;
|
|
109
|
|
110 virtual ResourceType GetResourceType(int64_t resourceId) = 0;
|
|
111
|
|
112 virtual uint64_t GetTotalCompressedSize() = 0;
|
|
113
|
|
114 virtual uint64_t GetTotalUncompressedSize() = 0;
|
|
115
|
|
116 virtual bool IsExistingResource(int64_t internalId) = 0;
|
|
117
|
|
118 virtual bool IsProtectedPatient(int64_t internalId) = 0;
|
|
119
|
|
120 virtual void ListAvailableMetadata(std::list<MetadataType>& target,
|
|
121 int64_t id) = 0;
|
|
122
|
|
123 virtual void ListAvailableAttachments(std::list<FileContentType>& result,
|
|
124 int64_t id) = 0;
|
|
125
|
|
126 virtual void LogChange(int64_t internalId,
|
|
127 const ServerIndexChange& change) = 0;
|
|
128
|
|
129 virtual void LogExportedResource(const ExportedResource& resource) = 0;
|
|
130
|
|
131 virtual bool LookupAttachment(FileInfo& attachment,
|
|
132 int64_t id,
|
|
133 FileContentType contentType) = 0;
|
|
134
|
|
135 virtual bool LookupGlobalProperty(std::string& target,
|
|
136 GlobalProperty property) = 0;
|
|
137
|
|
138 virtual void LookupIdentifier(std::list<int64_t>& result,
|
|
139 const DicomTag& tag,
|
|
140 const std::string& value) = 0;
|
|
141
|
|
142 virtual void LookupIdentifier(std::list<int64_t>& result,
|
|
143 const std::string& value) = 0;
|
|
144
|
|
145 virtual bool LookupMetadata(std::string& target,
|
|
146 int64_t id,
|
|
147 MetadataType type) = 0;
|
|
148
|
|
149 virtual bool LookupParent(int64_t& parentId,
|
|
150 int64_t resourceId) = 0;
|
|
151
|
|
152 virtual bool LookupResource(const std::string& publicId,
|
|
153 int64_t& id,
|
|
154 ResourceType& type) = 0;
|
|
155
|
|
156 virtual bool SelectPatientToRecycle(int64_t& internalId) = 0;
|
|
157
|
|
158 virtual bool SelectPatientToRecycle(int64_t& internalId,
|
|
159 int64_t patientIdToAvoid) = 0;
|
|
160
|
|
161 virtual void SetGlobalProperty(GlobalProperty property,
|
|
162 const std::string& value) = 0;
|
|
163
|
1286
|
164 virtual void SetMainDicomTag(int64_t id,
|
|
165 const DicomTag& tag,
|
|
166 const std::string& value) = 0;
|
1247
|
167
|
|
168 virtual void SetMetadata(int64_t id,
|
|
169 MetadataType type,
|
|
170 const std::string& value) = 0;
|
|
171
|
|
172 virtual void SetProtectedPatient(int64_t internalId,
|
|
173 bool isProtected) = 0;
|
|
174
|
|
175 virtual SQLite::ITransaction* StartTransaction() = 0;
|
|
176
|
|
177 virtual void SetListener(IServerIndexListener& listener) = 0;
|
|
178 };
|
|
179 }
|