Mercurial > hg > orthanc
comparison OrthancServer/OrthancRestApi/OrthancRestModalities.cpp @ 974:83622b0f544c
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 30 Jun 2014 14:44:05 +0200 |
parents | 84513f2ee1f3 |
children | db18c071fbd7 |
comparison
equal
deleted
inserted
replaced
972:2047e6f033bd | 974:83622b0f544c |
---|---|
63 } | 63 } |
64 | 64 |
65 return true; | 65 return true; |
66 } | 66 } |
67 | 67 |
68 static void DicomFindPatient(RestApi::PostCall& call) | 68 static void DicomFindPatient(RestApiPostCall& call) |
69 { | 69 { |
70 ServerContext& context = OrthancRestApi::GetContext(call); | 70 ServerContext& context = OrthancRestApi::GetContext(call); |
71 | 71 |
72 DicomMap m; | 72 DicomMap m; |
73 DicomMap::SetupFindPatientTemplate(m); | 73 DicomMap::SetupFindPatientTemplate(m); |
85 Json::Value result; | 85 Json::Value result; |
86 answers.ToJson(result); | 86 answers.ToJson(result); |
87 call.GetOutput().AnswerJson(result); | 87 call.GetOutput().AnswerJson(result); |
88 } | 88 } |
89 | 89 |
90 static void DicomFindStudy(RestApi::PostCall& call) | 90 static void DicomFindStudy(RestApiPostCall& call) |
91 { | 91 { |
92 ServerContext& context = OrthancRestApi::GetContext(call); | 92 ServerContext& context = OrthancRestApi::GetContext(call); |
93 | 93 |
94 DicomMap m; | 94 DicomMap m; |
95 DicomMap::SetupFindStudyTemplate(m); | 95 DicomMap::SetupFindStudyTemplate(m); |
113 Json::Value result; | 113 Json::Value result; |
114 answers.ToJson(result); | 114 answers.ToJson(result); |
115 call.GetOutput().AnswerJson(result); | 115 call.GetOutput().AnswerJson(result); |
116 } | 116 } |
117 | 117 |
118 static void DicomFindSeries(RestApi::PostCall& call) | 118 static void DicomFindSeries(RestApiPostCall& call) |
119 { | 119 { |
120 ServerContext& context = OrthancRestApi::GetContext(call); | 120 ServerContext& context = OrthancRestApi::GetContext(call); |
121 | 121 |
122 DicomMap m; | 122 DicomMap m; |
123 DicomMap::SetupFindSeriesTemplate(m); | 123 DicomMap::SetupFindSeriesTemplate(m); |
142 Json::Value result; | 142 Json::Value result; |
143 answers.ToJson(result); | 143 answers.ToJson(result); |
144 call.GetOutput().AnswerJson(result); | 144 call.GetOutput().AnswerJson(result); |
145 } | 145 } |
146 | 146 |
147 static void DicomFindInstance(RestApi::PostCall& call) | 147 static void DicomFindInstance(RestApiPostCall& call) |
148 { | 148 { |
149 ServerContext& context = OrthancRestApi::GetContext(call); | 149 ServerContext& context = OrthancRestApi::GetContext(call); |
150 | 150 |
151 DicomMap m; | 151 DicomMap m; |
152 DicomMap::SetupFindInstanceTemplate(m); | 152 DicomMap::SetupFindInstanceTemplate(m); |
172 Json::Value result; | 172 Json::Value result; |
173 answers.ToJson(result); | 173 answers.ToJson(result); |
174 call.GetOutput().AnswerJson(result); | 174 call.GetOutput().AnswerJson(result); |
175 } | 175 } |
176 | 176 |
177 static void DicomFind(RestApi::PostCall& call) | 177 static void DicomFind(RestApiPostCall& call) |
178 { | 178 { |
179 ServerContext& context = OrthancRestApi::GetContext(call); | 179 ServerContext& context = OrthancRestApi::GetContext(call); |
180 | 180 |
181 DicomMap m; | 181 DicomMap m; |
182 DicomMap::SetupFindPatientTemplate(m); | 182 DicomMap::SetupFindPatientTemplate(m); |
246 } | 246 } |
247 | 247 |
248 | 248 |
249 static bool GetInstancesToExport(std::list<std::string>& instances, | 249 static bool GetInstancesToExport(std::list<std::string>& instances, |
250 const std::string& remote, | 250 const std::string& remote, |
251 RestApi::PostCall& call) | 251 RestApiPostCall& call) |
252 { | 252 { |
253 ServerContext& context = OrthancRestApi::GetContext(call); | 253 ServerContext& context = OrthancRestApi::GetContext(call); |
254 | 254 |
255 std::string stripped = Toolbox::StripSpaces(call.GetPostBody()); | 255 std::string stripped = Toolbox::StripSpaces(call.GetPostBody()); |
256 | 256 |
306 | 306 |
307 return true; | 307 return true; |
308 } | 308 } |
309 | 309 |
310 | 310 |
311 static void DicomStore(RestApi::PostCall& call) | 311 static void DicomStore(RestApiPostCall& call) |
312 { | 312 { |
313 ServerContext& context = OrthancRestApi::GetContext(call); | 313 ServerContext& context = OrthancRestApi::GetContext(call); |
314 | 314 |
315 std::string remote = call.GetUriComponent("id", ""); | 315 std::string remote = call.GetUriComponent("id", ""); |
316 | 316 |
343 const std::string& id) | 343 const std::string& id) |
344 { | 344 { |
345 return peers.find(id) != peers.end(); | 345 return peers.find(id) != peers.end(); |
346 } | 346 } |
347 | 347 |
348 static void ListPeers(RestApi::GetCall& call) | 348 static void ListPeers(RestApiGetCall& call) |
349 { | 349 { |
350 OrthancRestApi::SetOfStrings peers; | 350 OrthancRestApi::SetOfStrings peers; |
351 Configuration::GetListOfOrthancPeers(peers); | 351 Configuration::GetListOfOrthancPeers(peers); |
352 | 352 |
353 Json::Value result = Json::arrayValue; | 353 Json::Value result = Json::arrayValue; |
358 } | 358 } |
359 | 359 |
360 call.GetOutput().AnswerJson(result); | 360 call.GetOutput().AnswerJson(result); |
361 } | 361 } |
362 | 362 |
363 static void ListPeerOperations(RestApi::GetCall& call) | 363 static void ListPeerOperations(RestApiGetCall& call) |
364 { | 364 { |
365 OrthancRestApi::SetOfStrings peers; | 365 OrthancRestApi::SetOfStrings peers; |
366 Configuration::GetListOfOrthancPeers(peers); | 366 Configuration::GetListOfOrthancPeers(peers); |
367 | 367 |
368 std::string id = call.GetUriComponent("id", ""); | 368 std::string id = call.GetUriComponent("id", ""); |
372 result.append("store"); | 372 result.append("store"); |
373 call.GetOutput().AnswerJson(result); | 373 call.GetOutput().AnswerJson(result); |
374 } | 374 } |
375 } | 375 } |
376 | 376 |
377 static void PeerStore(RestApi::PostCall& call) | 377 static void PeerStore(RestApiPostCall& call) |
378 { | 378 { |
379 ServerContext& context = OrthancRestApi::GetContext(call); | 379 ServerContext& context = OrthancRestApi::GetContext(call); |
380 | 380 |
381 std::string remote = call.GetUriComponent("id", ""); | 381 std::string remote = call.GetUriComponent("id", ""); |
382 | 382 |
427 const std::string& id) | 427 const std::string& id) |
428 { | 428 { |
429 return modalities.find(id) != modalities.end(); | 429 return modalities.find(id) != modalities.end(); |
430 } | 430 } |
431 | 431 |
432 static void ListModalities(RestApi::GetCall& call) | 432 static void ListModalities(RestApiGetCall& call) |
433 { | 433 { |
434 OrthancRestApi::SetOfStrings modalities; | 434 OrthancRestApi::SetOfStrings modalities; |
435 Configuration::GetListOfDicomModalities(modalities); | 435 Configuration::GetListOfDicomModalities(modalities); |
436 | 436 |
437 Json::Value result = Json::arrayValue; | 437 Json::Value result = Json::arrayValue; |
443 | 443 |
444 call.GetOutput().AnswerJson(result); | 444 call.GetOutput().AnswerJson(result); |
445 } | 445 } |
446 | 446 |
447 | 447 |
448 static void ListModalityOperations(RestApi::GetCall& call) | 448 static void ListModalityOperations(RestApiGetCall& call) |
449 { | 449 { |
450 OrthancRestApi::SetOfStrings modalities; | 450 OrthancRestApi::SetOfStrings modalities; |
451 Configuration::GetListOfDicomModalities(modalities); | 451 Configuration::GetListOfDicomModalities(modalities); |
452 | 452 |
453 std::string id = call.GetUriComponent("id", ""); | 453 std::string id = call.GetUriComponent("id", ""); |
463 call.GetOutput().AnswerJson(result); | 463 call.GetOutput().AnswerJson(result); |
464 } | 464 } |
465 } | 465 } |
466 | 466 |
467 | 467 |
468 static void UpdateModality(RestApi::PutCall& call) | 468 static void UpdateModality(RestApiPutCall& call) |
469 { | 469 { |
470 Json::Value json; | 470 Json::Value json; |
471 Json::Reader reader; | 471 Json::Reader reader; |
472 if (reader.parse(call.GetPutBody(), json)) | 472 if (reader.parse(call.GetPutBody(), json)) |
473 { | 473 { |
477 call.GetOutput().AnswerBuffer("", "text/plain"); | 477 call.GetOutput().AnswerBuffer("", "text/plain"); |
478 } | 478 } |
479 } | 479 } |
480 | 480 |
481 | 481 |
482 static void DeleteModality(RestApi::DeleteCall& call) | 482 static void DeleteModality(RestApiDeleteCall& call) |
483 { | 483 { |
484 Configuration::RemoveModality(call.GetUriComponent("id", "")); | 484 Configuration::RemoveModality(call.GetUriComponent("id", "")); |
485 call.GetOutput().AnswerBuffer("", "text/plain"); | 485 call.GetOutput().AnswerBuffer("", "text/plain"); |
486 } | 486 } |
487 | 487 |
488 | 488 |
489 static void UpdatePeer(RestApi::PutCall& call) | 489 static void UpdatePeer(RestApiPutCall& call) |
490 { | 490 { |
491 Json::Value json; | 491 Json::Value json; |
492 Json::Reader reader; | 492 Json::Reader reader; |
493 if (reader.parse(call.GetPutBody(), json)) | 493 if (reader.parse(call.GetPutBody(), json)) |
494 { | 494 { |
498 call.GetOutput().AnswerBuffer("", "text/plain"); | 498 call.GetOutput().AnswerBuffer("", "text/plain"); |
499 } | 499 } |
500 } | 500 } |
501 | 501 |
502 | 502 |
503 static void DeletePeer(RestApi::DeleteCall& call) | 503 static void DeletePeer(RestApiDeleteCall& call) |
504 { | 504 { |
505 Configuration::RemovePeer(call.GetUriComponent("id", "")); | 505 Configuration::RemovePeer(call.GetUriComponent("id", "")); |
506 call.GetOutput().AnswerBuffer("", "text/plain"); | 506 call.GetOutput().AnswerBuffer("", "text/plain"); |
507 } | 507 } |
508 | 508 |