comparison 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
comparison
equal deleted inserted replaced
5614:4640b7ae9a11 5615:a10978a5e65c
338 const DicomToJsonFormat format = OrthancRestApi::GetDicomFormat(call, DicomToJsonFormat_Human); 338 const DicomToJsonFormat format = OrthancRestApi::GetDicomFormat(call, DicomToJsonFormat_Human);
339 339
340 std::set<DicomTag> requestedTags; 340 std::set<DicomTag> requestedTags;
341 OrthancRestApi::GetRequestedTags(requestedTags, call); 341 OrthancRestApi::GetRequestedTags(requestedTags, call);
342 342
343 Json::Value json; 343 if (true)
344 if (OrthancRestApi::GetContext(call).ExpandResource( 344 {
345 json, call.GetUriComponent("id", ""), resourceType, format, requestedTags, true /* allowStorageAccess */)) 345 /**
346 { 346 * EXPERIMENTAL VERSION
347 call.GetOutput().AnswerJson(json); 347 **/
348
349 ResourceFinder finder(resourceType, true /* expand */);
350 finder.AddRequestedTags(requestedTags);
351 finder.SetFormat(OrthancRestApi::GetDicomFormat(call, DicomToJsonFormat_Human));
352 finder.SetOrthancId(resourceType, call.GetUriComponent("id", ""));
353
354 Json::Value json;
355 if (finder.ExecuteOneResource(json, OrthancRestApi::GetContext(call)))
356 {
357 call.GetOutput().AnswerJson(json);
358 }
359 }
360 else
361 {
362 /**
363 * VERSION IN ORTHANC <= 1.12.3
364 **/
365
366 Json::Value json;
367 if (OrthancRestApi::GetContext(call).ExpandResource(
368 json, call.GetUriComponent("id", ""), resourceType, format, requestedTags, true /* allowStorageAccess */))
369 {
370 call.GetOutput().AnswerJson(json);
371 }
348 } 372 }
349 } 373 }
350 374
351 template <enum ResourceType resourceType> 375 template <enum ResourceType resourceType>
352 static void DeleteSingleResource(RestApiDeleteCall& call) 376 static void DeleteSingleResource(RestApiDeleteCall& call)