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