diff OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp @ 5709:476b1db52110 find-refactoring

removed the "format_" member from ResourceFinder
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 12 Jul 2024 18:41:44 +0200
parents 1891a8c2dbb4
children a786da7599d5 d851a54e49b7
line wrap: on
line diff
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Fri Jul 12 18:31:14 2024 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Fri Jul 12 18:41:44 2024 +0200
@@ -138,7 +138,6 @@
   {
     ResourceFinder finder(level, true /* expand */);
     finder.SetOrthancId(level, identifier);
-    finder.SetFormat(format);
     finder.SetRetrieveMetadata(retrieveMetadata);
 
     FindResponse response;
@@ -151,7 +150,7 @@
     else
     {
       const FindResponse::Resource& resource = response.GetResourceByIndex(0);
-      finder.Expand(target, resource, index);
+      finder.Expand(target, resource, index, format);
 
       if (retrieveMetadata)
       {
@@ -288,7 +287,6 @@
 
       ResourceFinder finder(resourceType, expand);
       finder.AddRequestedTags(requestedTags);
-      finder.SetFormat(OrthancRestApi::GetDicomFormat(call, DicomToJsonFormat_Human));
 
       if (call.HasArgument("limit") ||
           call.HasArgument("since"))
@@ -314,7 +312,7 @@
       }
 
       Json::Value answer;
-      finder.Execute(answer, context);
+      finder.Execute(answer, context, OrthancRestApi::GetDicomFormat(call, DicomToJsonFormat_Human));
       call.GetOutput().AnswerJson(answer);
     }
     else
@@ -395,11 +393,10 @@
 
       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)))
+      if (finder.ExecuteOneResource(json, OrthancRestApi::GetContext(call), format))
       {
         call.GetOutput().AnswerJson(json);
       }
@@ -3390,7 +3387,8 @@
 
       ResourceFinder finder(level, expand);
       finder.SetDatabaseLimits(context.GetDatabaseLimits(level));
-      finder.SetFormat(OrthancRestApi::GetDicomFormat(request, DicomToJsonFormat_Human));
+
+      const DicomToJsonFormat format = OrthancRestApi::GetDicomFormat(request, DicomToJsonFormat_Human);
 
       if (request.isMember(KEY_LIMIT))
       {
@@ -3499,7 +3497,7 @@
       }
 
       Json::Value answer;
-      finder.Execute(answer, context);
+      finder.Execute(answer, context, format);
       call.GetOutput().AnswerJson(answer);
     }
     else
@@ -3668,10 +3666,9 @@
       ResourceFinder finder(end, expand);
       finder.SetOrthancId(start, call.GetUriComponent("id", ""));
       finder.AddRequestedTags(requestedTags);
-      finder.SetFormat(format);
 
       Json::Value answer;
-      finder.Execute(answer, context);
+      finder.Execute(answer, context, format);
       call.GetOutput().AnswerJson(answer);
     }
     else