Mercurial > hg > orthanc
annotate OrthancServer/OrthancRestApi/OrthancRestArchive.cpp @ 2966:10c610e80b15
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 05 Dec 2018 15:27:01 +0100 |
parents | 9d277f8ad698 |
children | 2c16c29b287d |
rev | line source |
---|---|
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1121
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
2447
878b59270859
upgrade to year 2018
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2446
diff
changeset
|
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU General Public License as |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * published by the Free Software Foundation, either version 3 of the |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * License, or (at your option) any later version. |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * In addition, as a special exception, the copyright holders of this |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * program give permission to link the code of its release with the |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * that use the same license as the "OpenSSL" library), and distribute |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * the linked executables. You must obey the GNU General Public License |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * in all respects for all of the code used other than "OpenSSL". If you |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * modify file(s) with this exception, you may extend this exception to |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * your version of the file(s), but you are not obligated to do so. If |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 * you do not wish to do so, delete this exception statement from your |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 * version. If you delete this exception statement from all source files |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 * in the program, then also delete it here. |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 * |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 * This program is distributed in the hope that it will be useful, but |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 * WITHOUT ANY WARRANTY; without even the implied warranty of |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 * General Public License for more details. |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 * |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 * You should have received a copy of the GNU General Public License |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 **/ |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 |
831
84513f2ee1f3
pch for unit tests and server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
34 #include "../PrecompiledHeadersServer.h" |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 #include "OrthancRestApi.h" |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 #include "../../Core/HttpServer/FilesystemHttpSender.h" |
2966 | 38 #include "../../Core/SerializationToolbox.h" |
2632 | 39 #include "../ServerJobs/ArchiveJob.h" |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 namespace Orthanc |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 { |
2966 | 43 static const char* const KEY_RESOURCES = "Resources"; |
44 static const char* const KEY_EXTENDED = "Extended"; | |
45 | |
46 static void AddResourcesOfInterestFromArray(ArchiveJob& job, | |
47 const Json::Value& resources) | |
1774
784a6b92d2f1
start of refactoring the creation of archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1623
diff
changeset
|
48 { |
2966 | 49 if (resources.type() != Json::arrayValue) |
1774
784a6b92d2f1
start of refactoring the creation of archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1623
diff
changeset
|
50 { |
2966 | 51 throw OrthancException(ErrorCode_BadFileFormat, |
52 "Expected a list of strings (Orthanc identifiers)"); | |
53 } | |
54 | |
55 for (Json::Value::ArrayIndex i = 0; i < resources.size(); i++) | |
56 { | |
57 if (resources[i].type() != Json::stringValue) | |
1774
784a6b92d2f1
start of refactoring the creation of archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1623
diff
changeset
|
58 { |
2966 | 59 throw OrthancException(ErrorCode_BadFileFormat, |
60 "Expected a list of strings (Orthanc identifiers)"); | |
61 } | |
62 else | |
63 { | |
2632 | 64 job.AddResource(resources[i].asString()); |
1774
784a6b92d2f1
start of refactoring the creation of archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1623
diff
changeset
|
65 } |
2966 | 66 } |
67 } | |
1774
784a6b92d2f1
start of refactoring the creation of archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1623
diff
changeset
|
68 |
2966 | 69 |
70 static void AddResourcesOfInterest(ArchiveJob& job /* inout */, | |
71 const Json::Value& body /* in */) | |
72 { | |
73 if (body.type() == Json::arrayValue) | |
74 { | |
75 AddResourcesOfInterestFromArray(job, body); | |
76 } | |
77 else if (body.type() == Json::objectValue) | |
78 { | |
79 if (body.isMember(KEY_RESOURCES)) | |
80 { | |
81 AddResourcesOfInterestFromArray(job, body[KEY_RESOURCES]); | |
82 } | |
83 else | |
84 { | |
85 throw OrthancException(ErrorCode_BadFileFormat, | |
86 "Missing field " + std::string(KEY_RESOURCES) + | |
87 " in the JSON body"); | |
88 } | |
1778
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
89 } |
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
90 else |
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
91 { |
2966 | 92 throw OrthancException(ErrorCode_BadFileFormat); |
93 } | |
94 } | |
95 | |
96 | |
97 static void GetJobParameters(bool& synchronous, /* out */ | |
98 bool& extended, /* out */ | |
99 const Json::Value& body, /* in */ | |
100 const bool defaultExtended /* in */) | |
101 { | |
102 synchronous = OrthancRestApi::IsSynchronousJobRequest | |
103 (true /* synchronous by default */, body); | |
104 | |
105 if (body.type() == Json::objectValue && | |
106 body.isMember(KEY_EXTENDED)) | |
107 { | |
108 extended = SerializationToolbox::ReadBoolean(body, KEY_EXTENDED); | |
109 } | |
110 else | |
111 { | |
112 extended = defaultExtended; | |
1778
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
113 } |
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
114 } |
1774
784a6b92d2f1
start of refactoring the creation of archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1623
diff
changeset
|
115 |
1778
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
116 |
2630
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
117 static void SubmitJob(RestApiCall& call, |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
118 ServerContext& context, |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
119 std::auto_ptr<ArchiveJob>& job, |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
120 const std::string& filename) |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
121 { |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
122 if (job.get() == NULL) |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
123 { |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
124 throw OrthancException(ErrorCode_NullPointer); |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
125 } |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
126 |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
127 job->SetDescription("REST API"); |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
128 |
2966 | 129 boost::shared_ptr<TemporaryFile> tmp(new TemporaryFile); |
130 job->SetSynchronousTarget(tmp); | |
131 | |
2867 | 132 Json::Value publicContent; |
133 if (context.GetJobsEngine().GetRegistry().SubmitAndWait | |
134 (publicContent, job.release(), 0 /* TODO priority */)) | |
2630
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
135 { |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
136 // The archive is now created: Prepare the sending of the ZIP file |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
137 FilesystemHttpSender sender(tmp->GetPath()); |
2908
9d277f8ad698
new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
138 sender.SetContentType(MimeType_Gzip); |
2630
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
139 sender.SetContentFilename(filename); |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
140 |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
141 // Send the ZIP |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
142 call.GetOutput().AnswerStream(sender); |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
143 } |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
144 else |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
145 { |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
146 call.GetOutput().SignalError(HttpStatus_500_InternalServerError); |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
147 } |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
148 } |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
149 |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
150 |
1778
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
151 static void CreateBatchArchive(RestApiPostCall& call) |
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
152 { |
2630
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
153 ServerContext& context = OrthancRestApi::GetContext(call); |
1774
784a6b92d2f1
start of refactoring the creation of archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1623
diff
changeset
|
154 |
2966 | 155 Json::Value body; |
156 if (call.ParseJsonRequest(body)) | |
1778
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
157 { |
2966 | 158 bool synchronous, extended; |
159 GetJobParameters(synchronous, extended, body, false /* by default, not extended */); | |
160 | |
161 std::auto_ptr<ArchiveJob> job(new ArchiveJob(context, false, extended)); | |
162 AddResourcesOfInterest(*job, body); | |
163 SubmitJob(call, context, job, "Archive.zip"); | |
164 } | |
165 else | |
166 { | |
167 throw OrthancException(ErrorCode_BadFileFormat, | |
168 "Expected a list of resources to archive in the body"); | |
1778
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
169 } |
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
170 } |
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
171 |
2446
a894adc8bb03
/tools/create-media-extended to include type-3 tags in DICOMDIR
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2422
diff
changeset
|
172 |
2966 | 173 template <bool DEFAULT_EXTENDED> |
1778
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
174 static void CreateBatchMedia(RestApiPostCall& call) |
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
175 { |
2630
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
176 ServerContext& context = OrthancRestApi::GetContext(call); |
1778
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
177 |
2966 | 178 Json::Value body; |
179 if (call.ParseJsonRequest(body)) | |
1778
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
180 { |
2966 | 181 bool synchronous, extended; |
182 GetJobParameters(synchronous, extended, body, DEFAULT_EXTENDED); | |
183 | |
184 std::auto_ptr<ArchiveJob> job(new ArchiveJob(context, true, extended)); | |
185 AddResourcesOfInterest(*job, body); | |
186 SubmitJob(call, context, job, "Archive.zip"); | |
187 } | |
188 else | |
189 { | |
190 throw OrthancException(ErrorCode_BadFileFormat, | |
191 "Expected a list of resources to archive in the body"); | |
1774
784a6b92d2f1
start of refactoring the creation of archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1623
diff
changeset
|
192 } |
2630
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
193 } |
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
194 |
1774
784a6b92d2f1
start of refactoring the creation of archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1623
diff
changeset
|
195 |
1778
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
196 static void CreateArchive(RestApiGetCall& call) |
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
197 { |
2630
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
198 ServerContext& context = OrthancRestApi::GetContext(call); |
1778
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
199 |
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
200 std::string id = call.GetUriComponent("id", ""); |
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
201 |
2966 | 202 std::auto_ptr<ArchiveJob> job(new ArchiveJob(context, false, false)); |
2632 | 203 job->AddResource(id); |
1778
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
204 |
2966 | 205 SubmitJob(call, context, job, id + ".zip"); |
1778
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
206 } |
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
207 |
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
208 |
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
209 static void CreateMedia(RestApiGetCall& call) |
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
210 { |
2630
00327e989458
creating archives/medias is now a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2629
diff
changeset
|
211 ServerContext& context = OrthancRestApi::GetContext(call); |
1778
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
212 |
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
213 std::string id = call.GetUriComponent("id", ""); |
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
214 |
2966 | 215 std::auto_ptr<ArchiveJob> job(new ArchiveJob(context, true, call.HasArgument("extended"))); |
2632 | 216 job->AddResource(id); |
1778
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
217 |
2966 | 218 SubmitJob(call, context, job, id + ".zip"); |
1778
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
219 } |
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
220 |
1774
784a6b92d2f1
start of refactoring the creation of archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1623
diff
changeset
|
221 |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
222 void OrthancRestApi::RegisterArchive() |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
223 { |
1778
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
224 Register("/patients/{id}/archive", CreateArchive); |
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
225 Register("/studies/{id}/archive", CreateArchive); |
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
226 Register("/series/{id}/archive", CreateArchive); |
1121
82567bac5e25
Creation of ZIP archives for media storage, with DICOMDIR
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
976
diff
changeset
|
227 |
1778
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
228 Register("/patients/{id}/media", CreateMedia); |
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
229 Register("/studies/{id}/media", CreateMedia); |
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
230 Register("/series/{id}/media", CreateMedia); |
1774
784a6b92d2f1
start of refactoring the creation of archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1623
diff
changeset
|
231 |
1778
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1777
diff
changeset
|
232 Register("/tools/create-archive", CreateBatchArchive); |
2446
a894adc8bb03
/tools/create-media-extended to include type-3 tags in DICOMDIR
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2422
diff
changeset
|
233 Register("/tools/create-media", CreateBatchMedia<false>); |
a894adc8bb03
/tools/create-media-extended to include type-3 tags in DICOMDIR
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2422
diff
changeset
|
234 Register("/tools/create-media-extended", CreateBatchMedia<true>); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
235 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
236 } |