comparison OrthancServer/OrthancRestApi/OrthancRestArchive.cpp @ 1776:3c28f5f6c9b7

rename
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 13 Nov 2015 11:36:51 +0100
parents 1861e410a9d7
children 0f5c416969dc
comparison
equal deleted inserted replaced
1775:1861e410a9d7 1776:3c28f5f6c9b7
382 382
383 383
384 384
385 namespace 385 namespace
386 { 386 {
387 class Resource 387 class ResourceIdentifiers
388 { 388 {
389 private: 389 private:
390 ResourceType level_; 390 ResourceType level_;
391 std::string patient_; 391 std::string patient_;
392 std::string study_; 392 std::string study_;
408 } 408 }
409 } 409 }
410 410
411 411
412 public: 412 public:
413 Resource(ServerIndex& index, 413 ResourceIdentifiers(ServerIndex& index,
414 const std::string& publicId) 414 const std::string& publicId)
415 { 415 {
416 if (!index.LookupResourceType(level_, publicId)) 416 if (!index.LookupResourceType(level_, publicId))
417 { 417 {
418 throw OrthancException(ErrorCode_UnknownResource); 418 throw OrthancException(ErrorCode_UnknownResource);
419 } 419 }
539 { 539 {
540 delete it->second; 540 delete it->second;
541 } 541 }
542 } 542 }
543 543
544 void Add(const Resource& resource) 544 void Add(const ResourceIdentifiers& resource)
545 { 545 {
546 const std::string& id = resource.GetIdentifier(level_); 546 const std::string& id = resource.GetIdentifier(level_);
547 Resources::iterator previous = resources_.find(id); 547 Resources::iterator previous = resources_.find(id);
548 548
549 if (resource.GetLevel() == level_) 549 if (resource.GetLevel() == level_)
741 if (resources[i].type() != Json::stringValue) 741 if (resources[i].type() != Json::stringValue)
742 { 742 {
743 return; // Bad request 743 return; // Bad request
744 } 744 }
745 745
746 Resource resource(index, resources[i].asString()); 746 ResourceIdentifiers resource(index, resources[i].asString());
747 archive.Add(resource); 747 archive.Add(resource);
748 } 748 }
749 749
750 archive.Expand(); 750 archive.Expand();
751 751