Mercurial > hg > orthanc
diff OrthancServer/Sources/OrthancRestApi/OrthancRestResources.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 | 4690a0d2b01e |
children | 8905ffa45fc2 |
line wrap: on
line diff
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Thu May 09 11:59:56 2024 +0200 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Thu May 09 12:24:29 2024 +0200 @@ -340,11 +340,35 @@ std::set<DicomTag> requestedTags; OrthancRestApi::GetRequestedTags(requestedTags, call); - Json::Value json; - if (OrthancRestApi::GetContext(call).ExpandResource( - json, call.GetUriComponent("id", ""), resourceType, format, requestedTags, true /* allowStorageAccess */)) + if (true) { - call.GetOutput().AnswerJson(json); + /** + * EXPERIMENTAL VERSION + **/ + + ResourceFinder finder(resourceType, true /* expand */); + finder.AddRequestedTags(requestedTags); + finder.SetFormat(OrthancRestApi::GetDicomFormat(call, DicomToJsonFormat_Human)); + finder.SetOrthancId(resourceType, call.GetUriComponent("id", "")); + + Json::Value json; + if (finder.ExecuteOneResource(json, OrthancRestApi::GetContext(call))) + { + call.GetOutput().AnswerJson(json); + } + } + else + { + /** + * VERSION IN ORTHANC <= 1.12.3 + **/ + + Json::Value json; + if (OrthancRestApi::GetContext(call).ExpandResource( + json, call.GetUriComponent("id", ""), resourceType, format, requestedTags, true /* allowStorageAccess */)) + { + call.GetOutput().AnswerJson(json); + } } }