diff OrthancServer/Sources/Database/Compatibility/GenericFind.cpp @ 5586:fc3914c07dd3 find-refactoring

refactoring FindResponse
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 03 May 2024 17:02:02 +0200
parents 74cc31c8db2b
children b51ee994cd6f
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp	Sat Apr 27 22:15:37 2024 +0200
+++ b/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp	Fri May 03 17:02:02 2024 +0200
@@ -59,10 +59,7 @@
 
         for (std::list<std::string>::const_iterator it = ids.begin(); it != ids.end(); ++it)
         {
-          OrthancIdentifiers identifiers;
-          identifiers.SetLevel(request.GetLevel(), *it);
-
-          response.Add(new FindResponse::Item(identifiers));
+          response.Add(new FindResponse::Item(request.GetLevel(), *it));
         }
       }
       else
@@ -79,10 +76,14 @@
       {
         const FindResponse::Item& item = response.GetItem(i);
 
-        if (request.HasResponseContent(FindRequest::ResponseContent_MainDicomTags)
-            && !item.HasDicomMap())
+        if (request.HasResponseContent(FindRequest::ResponseContent_MainDicomTags))
         {
-          throw OrthancException(ErrorCode_InternalError);
+          DicomMap tmp;
+          item.GetDicomTagsAtLevel(tmp, request.GetLevel());
+          if (tmp.GetSize() == 0)
+          {
+            throw OrthancException(ErrorCode_InternalError);
+          }
         }
 
         // TODO: other sanity checks