changeset 5721:3f97590cc0c9 find-refactoring-clean

integration find-refactoring->find-refactoring-clean
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 19 Jul 2024 10:06:39 +0200
parents f488fc5c972a (current diff) 89d559e67b03 (diff)
children 3fd4d5833c55
files OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp OrthancServer/Sources/Database/StatelessDatabaseOperations.h
diffstat 8 files changed, 34 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp	Sat Jul 13 01:01:50 2024 +0200
+++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp	Fri Jul 19 10:06:39 2024 +0200
@@ -1291,22 +1291,23 @@
 
 
     virtual void ExecuteFind(std::list<std::string>& identifiers,
-                             const FindRequest& request,
-                             const Capabilities& capabilities) ORTHANC_OVERRIDE
+                             const Capabilities& capabilities,
+                             const FindRequest& request) ORTHANC_OVERRIDE
     {
       // TODO-FIND
       Compatibility::GenericFind find(*this);
-      find.ExecuteFind(identifiers, request, capabilities);
+      find.ExecuteFind(identifiers, capabilities, request);
     }
 
 
     virtual void ExecuteExpand(FindResponse& response,
+                               const Capabilities& capabilities,
                                const FindRequest& request,
                                const std::string& identifier) ORTHANC_OVERRIDE
     {
       // TODO-FIND
       Compatibility::GenericFind find(*this);
-      find.ExecuteExpand(response, request, identifier);
+      find.ExecuteExpand(response, capabilities, request, identifier);
     }
   };
 
--- a/OrthancServer/Sources/Database/BaseDatabaseWrapper.cpp	Sat Jul 13 01:01:50 2024 +0200
+++ b/OrthancServer/Sources/Database/BaseDatabaseWrapper.cpp	Fri Jul 19 10:06:39 2024 +0200
@@ -56,20 +56,21 @@
 
 
   void BaseDatabaseWrapper::BaseTransaction::ExecuteFind(std::list<std::string>& identifiers,
-                                                         const FindRequest& request,
-                                                         const Capabilities& capabilities)
+                                                         const Capabilities& capabilities,
+                                                         const FindRequest& request)
   {
     Compatibility::GenericFind find(*this);
-    find.ExecuteFind(identifiers, request, capabilities);
+    find.ExecuteFind(identifiers, capabilities, request);
   }
 
 
   void BaseDatabaseWrapper::BaseTransaction::ExecuteExpand(FindResponse& response,
+                                                           const Capabilities& capabilities,
                                                            const FindRequest& request,
                                                            const std::string& identifier)
   {
     Compatibility::GenericFind find(*this);
-    find.ExecuteExpand(response, request, identifier);
+    find.ExecuteExpand(response, capabilities, request, identifier);
   }
 
 
--- a/OrthancServer/Sources/Database/BaseDatabaseWrapper.h	Sat Jul 13 01:01:50 2024 +0200
+++ b/OrthancServer/Sources/Database/BaseDatabaseWrapper.h	Fri Jul 19 10:06:39 2024 +0200
@@ -53,10 +53,11 @@
                                const Capabilities& capabilities) ORTHANC_OVERRIDE;
 
       virtual void ExecuteFind(std::list<std::string>& identifiers,
-                               const FindRequest& request,
-                               const Capabilities& capabilities) ORTHANC_OVERRIDE;
+                               const Capabilities& capabilities,
+                               const FindRequest& request) ORTHANC_OVERRIDE;
 
       virtual void ExecuteExpand(FindResponse& response,
+                                 const Capabilities& capabilities,
                                  const FindRequest& request,
                                  const std::string& identifier) ORTHANC_OVERRIDE;
     };
--- a/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp	Sat Jul 13 01:01:50 2024 +0200
+++ b/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp	Fri Jul 19 10:06:39 2024 +0200
@@ -114,8 +114,8 @@
     }
 
     void GenericFind::ExecuteFind(std::list<std::string>& identifiers,
-                                  const FindRequest& request,
-                                  const IDatabaseWrapper::Capabilities& capabilities)
+                                  const IDatabaseWrapper::Capabilities& capabilities,
+                                  const FindRequest& request)
     {
       if (!request.GetLabels().empty() &&
           !capabilities.HasLabelsSupport())
@@ -357,6 +357,7 @@
 
 
     void GenericFind::ExecuteExpand(FindResponse& response,
+                                    const IDatabaseWrapper::Capabilities& capabilities,
                                     const FindRequest& request,
                                     const std::string& identifier)
     {
@@ -448,7 +449,8 @@
         }
       }
 
-      if (request.IsRetrieveLabels())
+      if (capabilities.HasLabelsSupport() &&
+          request.IsRetrieveLabels())
       {
         transaction_.ListLabels(resource->GetLabels(), internalId);
       }
--- a/OrthancServer/Sources/Database/Compatibility/GenericFind.h	Sat Jul 13 01:01:50 2024 +0200
+++ b/OrthancServer/Sources/Database/Compatibility/GenericFind.h	Fri Jul 19 10:06:39 2024 +0200
@@ -45,10 +45,11 @@
       }
 
       void ExecuteFind(std::list<std::string>& identifiers,
-                       const FindRequest& request,
-                       const IDatabaseWrapper::Capabilities& capabilities);
+                       const IDatabaseWrapper::Capabilities& capabilities,
+                       const FindRequest& request);
 
       void ExecuteExpand(FindResponse& response,
+                         const IDatabaseWrapper::Capabilities& capabilities,
                          const FindRequest& request,
                          const std::string& identifier);
     };
--- a/OrthancServer/Sources/Database/IDatabaseWrapper.h	Sat Jul 13 01:01:50 2024 +0200
+++ b/OrthancServer/Sources/Database/IDatabaseWrapper.h	Fri Jul 19 10:06:39 2024 +0200
@@ -365,8 +365,8 @@
 
       // This is only implemented if "HasIntegratedFind()" is "false"
       virtual void ExecuteFind(std::list<std::string>& identifiers,
-                               const FindRequest& request,
-                               const Capabilities& capabilities) = 0;
+                               const Capabilities& capabilities,
+                               const FindRequest& request) = 0;
 
       /**
        * This is only implemented if "HasIntegratedFind()" is
@@ -378,6 +378,7 @@
        * modified).
        **/
       virtual void ExecuteExpand(FindResponse& response,
+                                 const Capabilities& capabilities,
                                  const FindRequest& request,
                                  const std::string& identifier) = 0;
     };
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp	Sat Jul 13 01:01:50 2024 +0200
+++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp	Fri Jul 19 10:06:39 2024 +0200
@@ -3409,8 +3409,7 @@
       }
     };
 
-    class FindStage : public ReadOnlyOperationsT3<std::list<std::string>&, const FindRequest&,
-                                                  const IDatabaseWrapper::Capabilities&>
+    class FindStage : public ReadOnlyOperationsT3<std::list<std::string>&, const IDatabaseWrapper::Capabilities&, const FindRequest& >
     {
     public:
       virtual void ApplyTuple(ReadOnlyTransaction& transaction,
@@ -3420,13 +3419,13 @@
       }
     };
 
-    class ExpandStage : public ReadOnlyOperationsT3<FindResponse&, const FindRequest&, const std::string&>
+    class ExpandStage : public ReadOnlyOperationsT4<FindResponse&, const IDatabaseWrapper::Capabilities&, const FindRequest&, const std::string&>
     {
     public:
       virtual void ApplyTuple(ReadOnlyTransaction& transaction,
                               const Tuple& tuple) ORTHANC_OVERRIDE
       {
-        transaction.ExecuteExpand(tuple.get<0>(), tuple.get<1>(), tuple.get<2>());
+        transaction.ExecuteExpand(tuple.get<0>(), tuple.get<1>(), tuple.get<2>(), tuple.get<3>());
       }
     };
 
@@ -3451,7 +3450,7 @@
       std::list<std::string> identifiers;
 
       FindStage find;
-      find.Apply(*this, identifiers, request, capabilities);
+      find.Apply(*this, identifiers, capabilities, request);
 
       ExpandStage expand;
 
@@ -3462,7 +3461,7 @@
          * another transaction). The database engine must ignore such
          * error cases.
          **/
-        expand.Apply(*this, response, request, *it);
+        expand.Apply(*this, response, capabilities, request, *it);
       }
     }
   }
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.h	Sat Jul 13 01:01:50 2024 +0200
+++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.h	Fri Jul 19 10:06:39 2024 +0200
@@ -303,17 +303,18 @@
       }
 
       void ExecuteFind(std::list<std::string>& identifiers,
-                       const FindRequest& request,
-                       const IDatabaseWrapper::Capabilities& capabilities)
+                       const IDatabaseWrapper::Capabilities& capabilities,
+                       const FindRequest& request)
       {
-        transaction_.ExecuteFind(identifiers, request, capabilities);
+        transaction_.ExecuteFind(identifiers, capabilities, request);
       }
 
       void ExecuteExpand(FindResponse& response,
+                         const IDatabaseWrapper::Capabilities& capabilities,
                          const FindRequest& request,
                          const std::string& identifier)
       {
-        transaction_.ExecuteExpand(response, request, identifier);
+        transaction_.ExecuteExpand(response, capabilities, request, identifier);
       }
     };