changeset 5764:db4bd2f9e8d2 find-refactoring

re-enable W002 again
author Alain Mazy <am@orthanc.team>
date Mon, 09 Sep 2024 16:05:13 +0200
parents 1b0e67be3c15
children 3915736c40a5
files OrthancServer/Sources/ResourceFinder.cpp
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Sources/ResourceFinder.cpp	Fri Sep 06 16:51:44 2024 +0200
+++ b/OrthancServer/Sources/ResourceFinder.cpp	Mon Sep 09 16:05:13 2024 +0200
@@ -839,6 +839,7 @@
 
       LOG(WARNING) << "W001: Accessing DICOM tags from storage when accessing "
                    << Orthanc::GetResourceTypeText(resource.GetLevel(), false, false)
+                   << " " << resource.GetIdentifier()
                    << ": " << missings;
     }
 
@@ -901,6 +902,13 @@
   void ResourceFinder::Execute(IVisitor& visitor,
                                ServerContext& context) const
   {
+    bool isWarning002Enabled = false;
+
+    {
+      OrthancConfiguration::ReaderLock lock;
+      isWarning002Enabled = lock.GetConfiguration().IsWarningEnabled(Warnings_002_InconsistentDicomTagsInDb);
+    }
+
     FindResponse response;
     context.GetIndex().ExecuteFind(response, request_);
 
@@ -958,6 +966,19 @@
             ReadMissingTagsFromStorageArea(requestedTags, context, request_, resource, missingTags);
           }
         }
+
+        std::string mainDicomTagsSignature;
+        if (isWarning002Enabled &&
+            resource.LookupMetadata(mainDicomTagsSignature, resource.GetLevel(), MetadataType_MainDicomTagsSignature) &&
+            mainDicomTagsSignature != DicomMap::GetMainDicomTagsSignature(resource.GetLevel()))
+        {
+          LOG(WARNING) << "W002: " << Orthanc::GetResourceTypeText(resource.GetLevel(), false , false)
+                      << " has been stored with another version of Main Dicom Tags list, you should POST to /"
+                      << Orthanc::GetResourceTypeText(resource.GetLevel(), true, false)
+                      << "/" << resource.GetIdentifier()
+                      << "/reconstruct to update the list of tags saved in DB or run the Housekeeper plugin.  Some MainDicomTags might be missing from this answer.";
+        }
+
       }
 
       bool match = true;