changeset 5858:66fd63b8601e find-refactoring tip

StorageAccessOnFind: cont
author Alain Mazy <am@orthanc.team>
date Mon, 04 Nov 2024 22:34:14 +0100
parents 39996519afce
children
files OrthancServer/Sources/ResourceFinder.cpp OrthancServer/Sources/ResourceFinder.h
diffstat 2 files changed, 5 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Sources/ResourceFinder.cpp	Mon Nov 04 22:06:45 2024 +0100
+++ b/OrthancServer/Sources/ResourceFinder.cpp	Mon Nov 04 22:34:14 2024 +0100
@@ -1114,7 +1114,9 @@
         if (!remainingRequestedTags.empty() && 
             !DicomMap::HasOnlyComputedTags(remainingRequestedTags)) // if the only remaining tags are computed tags, it is worthless to read them from disk
         {
-          if (IsStorageAccessAllowedOnAnswers())
+          // If a lookup tag is not available from DB, it is included in remainingRequestedTags and it will always be included in the answer too
+          // -> from 1.12.5, "StorageAccessOnFind": "Always" is actually equivalent to "StorageAccessOnFind": "Answers"
+          if (IsStorageAccessAllowed())
           {
             ReadMissingTagsFromStorageArea(outRequestedTags, context, request_, resource, remainingRequestedTags);
           }
@@ -1195,7 +1197,7 @@
     }
   }
 
-  bool ResourceFinder::IsStorageAccessAllowedOnAnswers()
+  bool ResourceFinder::IsStorageAccessAllowed()
   {
     switch (storageAccessMode_)
     {
@@ -1209,21 +1211,6 @@
     }
   }
 
-
-  bool ResourceFinder::IsStorageAccessOnLookup()
-  {
-    switch (storageAccessMode_)
-    {
-      case FindStorageAccessMode_DiskOnAnswer:
-        return false;
-      case FindStorageAccessMode_DiskOnLookupAndAnswer:
-      case FindStorageAccessMode_DatabaseOnly:
-        return true;
-      default:
-        throw OrthancException(ErrorCode_InternalError);
-    }
-  }
-
   void ResourceFinder::Execute(Json::Value& target,
                                ServerContext& context,
                                DicomToJsonFormat format,
--- a/OrthancServer/Sources/ResourceFinder.h	Mon Nov 04 22:06:45 2024 +0100
+++ b/OrthancServer/Sources/ResourceFinder.h	Mon Nov 04 22:34:14 2024 +0100
@@ -101,9 +101,7 @@
       return requestedTags_.size() > 0;
     }
 
-    bool IsStorageAccessAllowedOnAnswers();
-
-    bool IsStorageAccessOnLookup();
+    bool IsStorageAccessAllowed();
 
   public:
     ResourceFinder(ResourceType level,