comparison OrthancServer/Sources/Database/FindResponse.cpp @ 5621:732ec9feeea8 find-refactoring

introduction of FindRequest::ChildrenRetrieveSpecification
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 11 May 2024 15:43:07 +0200
parents 1864b16bc7b1
children 3f13db27b399
comparison
equal deleted inserted replaced
5620:4bfd885fb45f 5621:732ec9feeea8
491 491
492 static const ResourceType levels[4] = { ResourceType_Patient, ResourceType_Study, ResourceType_Series, ResourceType_Instance }; 492 static const ResourceType levels[4] = { ResourceType_Patient, ResourceType_Study, ResourceType_Series, ResourceType_Instance };
493 493
494 for (size_t i = 0; i < 4; i++) 494 for (size_t i = 0; i < 4; i++)
495 { 495 {
496 const char* level = EnumerationToString(levels[i]);
497
496 if (levels[i] != request.GetLevel() && 498 if (levels[i] != request.GetLevel() &&
497 IsResourceLevelAboveOrEqual(levels[i], request.GetLevel())) 499 IsResourceLevelAboveOrEqual(levels[i], request.GetLevel()))
498 { 500 {
499 const char* level = EnumerationToString(levels[i]);
500
501 if (request.GetParentRetrieveSpecification(levels[i]).IsRetrieveMainDicomTags()) 501 if (request.GetParentRetrieveSpecification(levels[i]).IsRetrieveMainDicomTags())
502 { 502 {
503 DicomMap m; 503 DicomMap m;
504 GetMainDicomTags(m, levels[i]); 504 GetMainDicomTags(m, levels[i]);
505 DebugDicomMap(target[level]["MainDicomTags"], m); 505 DebugDicomMap(target[level]["MainDicomTags"], m);
508 if (request.GetParentRetrieveSpecification(levels[i]).IsRetrieveMainDicomTags()) 508 if (request.GetParentRetrieveSpecification(levels[i]).IsRetrieveMainDicomTags())
509 { 509 {
510 DebugMetadata(target[level]["Metadata"], GetMetadata(levels[i])); 510 DebugMetadata(target[level]["Metadata"], GetMetadata(levels[i]));
511 } 511 }
512 } 512 }
513 } 513
514 514 if (levels[i] != request.GetLevel() &&
515 if (request.IsRetrieveChildrenIdentifiers()) 515 IsResourceLevelAboveOrEqual(request.GetLevel(), levels[i]))
516 { 516 {
517 Json::Value v = Json::arrayValue; 517 if (request.GetChildrenRetrieveSpecification(levels[i]).IsRetrieveIdentifiers())
518 for (std::set<std::string>::const_iterator it = childrenIdentifiers_.begin(); 518 {
519 it != childrenIdentifiers_.end(); ++it) 519 if (levels[i] != GetChildResourceType(request.GetLevel()))
520 { 520 {
521 v.append(*it); 521 throw OrthancException(ErrorCode_NotImplemented); // TODO-FIND
522 } 522 }
523 target["Children"] = v; 523 else
524 {
525 Json::Value v = Json::arrayValue;
526 for (std::set<std::string>::const_iterator it = childrenIdentifiers_.begin();
527 it != childrenIdentifiers_.end(); ++it)
528 {
529 v.append(*it);
530 }
531 target[level]["Identifiers"] = v;
532 }
533 }
534 }
524 } 535 }
525 536
526 if (request.IsRetrieveLabels()) 537 if (request.IsRetrieveLabels())
527 { 538 {
528 Json::Value v = Json::arrayValue; 539 Json::Value v = Json::arrayValue;