diff OrthancServer/Sources/ResourceFinder.cpp @ 5682:fd4c5e064cbe find-refactoring

started refactoring of ServerContext::Apply()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 09 Jul 2024 11:17:34 +0200
parents b744a2cf408a
children 11575590e493
line wrap: on
line diff
--- a/OrthancServer/Sources/ResourceFinder.cpp	Tue Jul 09 10:15:15 2024 +0200
+++ b/OrthancServer/Sources/ResourceFinder.cpp	Tue Jul 09 11:17:34 2024 +0200
@@ -29,6 +29,7 @@
 #include "../../OrthancFramework/Sources/OrthancException.h"
 #include "../../OrthancFramework/Sources/SerializationToolbox.h"
 #include "OrthancConfiguration.h"
+#include "Search/DatabaseLookup.h"
 #include "ServerContext.h"
 #include "ServerIndex.h"
 
@@ -452,6 +453,13 @@
   }
 
 
+  void ResourceFinder::SetDatabaseLookup(const DatabaseLookup& lookup)
+  {
+    MainDicomTagsRegistry registry;
+    registry.NormalizeLookup(request_.GetDicomTagConstraints(), lookup, request_.GetLevel());
+  }
+
+
   void ResourceFinder::AddRequestedTags(const DicomTag& tag)
   {
     if (DicomMap::IsMainDicomTag(tag, ResourceType_Patient))
@@ -700,6 +708,20 @@
   }
 
 
+  void ResourceFinder::Execute(FindResponse& response,
+                               ServerIndex& index) const
+  {
+    if (hasRequestedTags_)
+    {
+      throw OrthancException(ErrorCode_BadSequenceOfCalls);
+    }
+    else
+    {
+      index.ExecuteFind(response, request_);
+    }
+  }
+
+  
   void ResourceFinder::Execute(Json::Value& target,
                                ServerContext& context) const
   {
@@ -712,12 +734,6 @@
     {
       const FindResponse::Resource& resource = response.GetResourceByIndex(i);
 
-      {
-        Json::Value v;
-        resource.DebugExport(v, request_);
-        std::cout << v.toStyledString();
-      }
-
       if (expand_)
       {
         Json::Value item;