annotate OrthancServer/Sources/OrthancWebDav.h @ 5752:717acb0ea546 find-refactoring

fix DICOMWeb integration tests
author Alain Mazy <am@orthanc.team>
date Tue, 03 Sep 2024 16:37:31 +0200
parents eb56ee3c5d63
children 1404a80dd461
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4240
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
5640
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
4240
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 *
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * This program is free software: you can redistribute it and/or
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * modify it under the terms of the GNU General Public License as
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * published by the Free Software Foundation, either version 3 of the
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * License, or (at your option) any later version.
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 *
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful, but
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * General Public License for more details.
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 *
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 **/
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #pragma once
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include "../../OrthancFramework/Sources/HttpServer/WebDavStorage.h"
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #include "../../OrthancFramework/Sources/MultiThreading/SharedMessageQueue.h"
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 #include "../../OrthancFramework/Sources/Toolbox.h"
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 namespace Orthanc
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 {
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 class ServerContext;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 class OrthancWebDav : public IWebDavBucket
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 {
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 private:
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 typedef std::map<ResourceType, std::string> Templates;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
4242
5cfa6ba75dfc deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4240
diff changeset
40 class DicomDeleteVisitor;
4240
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 class DicomFileVisitor;
5705
eb56ee3c5d63 removed dependency of OrthancWebDav on ServerContext::ILookupVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5700
diff changeset
42 class DicomFileVisitorV2;
4242
5cfa6ba75dfc deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4240
diff changeset
43 class DicomIdentifiersVisitor;
5700
1fab9ddaf702 webdav using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
44 class DicomIdentifiersVisitorV2;
4240
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 class InstancesOfSeries;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 class InternalNode;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 class ListOfResources;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 class ListOfStudiesByDate;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 class ListOfStudiesByMonth;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 class ListOfStudiesByYear;
4242
5cfa6ba75dfc deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4240
diff changeset
51 class OrthancJsonVisitor;
5705
eb56ee3c5d63 removed dependency of OrthancWebDav on ServerContext::ILookupVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5700
diff changeset
52 class OrthancJsonVisitorV2;
4240
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 class ResourcesIndex;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 class RootNode;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 class SingleDicomResource;
4242
5cfa6ba75dfc deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4240
diff changeset
56
4240
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 class INode : public boost::noncopyable
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 {
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 public:
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 virtual ~INode()
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 {
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 }
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 virtual bool ListCollection(IWebDavBucket::Collection& target,
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 const UriComponents& path) = 0;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 virtual bool GetFileContent(MimeType& mime,
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 std::string& content,
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 boost::posix_time::ptime& time,
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 const UriComponents& path) = 0;
4242
5cfa6ba75dfc deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4240
diff changeset
71
5cfa6ba75dfc deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4240
diff changeset
72 virtual bool DeleteItem(const UriComponents& path) = 0;
4240
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 };
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 void AddVirtualFile(Collection& collection,
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 const UriComponents& path,
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 const std::string& filename);
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 static void UploadWorker(OrthancWebDav* that);
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 void Upload(const std::string& path);
4242
5cfa6ba75dfc deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4240
diff changeset
83
5cfa6ba75dfc deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4240
diff changeset
84 INode& GetRootNode(const std::string& rootPath);
4240
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 ServerContext& context_;
4242
5cfa6ba75dfc deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4240
diff changeset
87 bool allowDicomDelete_;
4243
64f57c9d5f79 configuration options for webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4242
diff changeset
88 bool allowUpload_;
4240
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 std::unique_ptr<INode> patients_;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 std::unique_ptr<INode> studies_;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 std::unique_ptr<INode> dates_;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 Templates patientsTemplates_;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 Templates studiesTemplates_;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 WebDavStorage uploads_;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 SharedMessageQueue uploadQueue_;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 boost::thread uploadThread_;
4243
64f57c9d5f79 configuration options for webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4242
diff changeset
97 bool uploadRunning_;
4240
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 public:
4242
5cfa6ba75dfc deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4240
diff changeset
100 OrthancWebDav(ServerContext& context,
4243
64f57c9d5f79 configuration options for webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4242
diff changeset
101 bool allowDicomDelete,
64f57c9d5f79 configuration options for webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4242
diff changeset
102 bool allowUpload);
4240
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 virtual ~OrthancWebDav()
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 {
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 Stop();
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 }
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 virtual bool IsExistingFolder(const UriComponents& path) ORTHANC_OVERRIDE;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 virtual bool ListCollection(Collection& collection,
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 const UriComponents& path) ORTHANC_OVERRIDE;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 virtual bool GetFileContent(MimeType& mime,
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 std::string& content,
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 boost::posix_time::ptime& modificationTime,
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 const UriComponents& path) ORTHANC_OVERRIDE;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 virtual bool StoreFile(const std::string& content,
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 const UriComponents& path) ORTHANC_OVERRIDE;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 virtual bool CreateFolder(const UriComponents& path) ORTHANC_OVERRIDE;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 virtual bool DeleteItem(const std::vector<std::string>& path) ORTHANC_OVERRIDE;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 virtual void Start() ORTHANC_OVERRIDE;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 virtual void Stop() ORTHANC_OVERRIDE;
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 };
799c0c527ced reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 }