comparison OrthancServer/Sources/ResourceFinder.cpp @ 5615:a10978a5e65c find-refactoring

expansion of single resources using ResourceFinder
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 09 May 2024 12:24:29 +0200
parents 599ce5ed126c
children 1e92fb051fd7
comparison
equal deleted inserted replaced
5614:4640b7ae9a11 5615:a10978a5e65c
579 { 579 {
580 target.append(resource.GetIdentifier()); 580 target.append(resource.GetIdentifier());
581 } 581 }
582 } 582 }
583 } 583 }
584
585
586 bool ResourceFinder::ExecuteOneResource(Json::Value& target,
587 ServerContext& context)
588 {
589 Json::Value answer;
590 Execute(answer, context);
591
592 if (answer.type() != Json::arrayValue)
593 {
594 throw OrthancException(ErrorCode_InternalError);
595 }
596 else if (answer.size() > 1)
597 {
598 throw OrthancException(ErrorCode_DatabasePlugin);
599 }
600 else if (answer.empty())
601 {
602 // Inexistent resource (or was deleted between the first and second phases)
603 return false;
604 }
605 else
606 {
607 target = answer[0];
608 return true;
609 }
610 }
584 } 611 }