# HG changeset patch # User Sebastien Jodogne # Date 1721374213 -7200 # Node ID 89d559e67b0341fbbd43e4b298d13ea3a465f9ee # Parent c5ca97d210239f3b711fd1118e604ddb321b3aa2 fix compatibility with old database plugins diff -r c5ca97d21023 -r 89d559e67b03 OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp --- a/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp Sat Jul 13 00:58:29 2024 +0200 +++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp Fri Jul 19 09:30:13 2024 +0200 @@ -1291,22 +1291,23 @@ virtual void ExecuteFind(std::list& 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); } }; diff -r c5ca97d21023 -r 89d559e67b03 OrthancServer/Sources/Database/BaseDatabaseWrapper.cpp --- a/OrthancServer/Sources/Database/BaseDatabaseWrapper.cpp Sat Jul 13 00:58:29 2024 +0200 +++ b/OrthancServer/Sources/Database/BaseDatabaseWrapper.cpp Fri Jul 19 09:30:13 2024 +0200 @@ -56,20 +56,21 @@ void BaseDatabaseWrapper::BaseTransaction::ExecuteFind(std::list& 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); } diff -r c5ca97d21023 -r 89d559e67b03 OrthancServer/Sources/Database/BaseDatabaseWrapper.h --- a/OrthancServer/Sources/Database/BaseDatabaseWrapper.h Sat Jul 13 00:58:29 2024 +0200 +++ b/OrthancServer/Sources/Database/BaseDatabaseWrapper.h Fri Jul 19 09:30:13 2024 +0200 @@ -53,10 +53,11 @@ const Capabilities& capabilities) ORTHANC_OVERRIDE; virtual void ExecuteFind(std::list& 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; }; diff -r c5ca97d21023 -r 89d559e67b03 OrthancServer/Sources/Database/Compatibility/GenericFind.cpp --- a/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp Sat Jul 13 00:58:29 2024 +0200 +++ b/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp Fri Jul 19 09:30:13 2024 +0200 @@ -114,8 +114,8 @@ } void GenericFind::ExecuteFind(std::list& 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); } diff -r c5ca97d21023 -r 89d559e67b03 OrthancServer/Sources/Database/Compatibility/GenericFind.h --- a/OrthancServer/Sources/Database/Compatibility/GenericFind.h Sat Jul 13 00:58:29 2024 +0200 +++ b/OrthancServer/Sources/Database/Compatibility/GenericFind.h Fri Jul 19 09:30:13 2024 +0200 @@ -45,10 +45,11 @@ } void ExecuteFind(std::list& 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); }; diff -r c5ca97d21023 -r 89d559e67b03 OrthancServer/Sources/Database/IDatabaseWrapper.h --- a/OrthancServer/Sources/Database/IDatabaseWrapper.h Sat Jul 13 00:58:29 2024 +0200 +++ b/OrthancServer/Sources/Database/IDatabaseWrapper.h Fri Jul 19 09:30:13 2024 +0200 @@ -365,8 +365,8 @@ // This is only implemented if "HasIntegratedFind()" is "false" virtual void ExecuteFind(std::list& 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; }; diff -r c5ca97d21023 -r 89d559e67b03 OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp --- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Sat Jul 13 00:58:29 2024 +0200 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Fri Jul 19 09:30:13 2024 +0200 @@ -3688,8 +3688,7 @@ } }; - class FindStage : public ReadOnlyOperationsT3&, const FindRequest&, - const IDatabaseWrapper::Capabilities&> + class FindStage : public ReadOnlyOperationsT3&, const IDatabaseWrapper::Capabilities&, const FindRequest& > { public: virtual void ApplyTuple(ReadOnlyTransaction& transaction, @@ -3699,13 +3698,13 @@ } }; - class ExpandStage : public ReadOnlyOperationsT3 + class ExpandStage : public ReadOnlyOperationsT4 { 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>()); } }; @@ -3730,7 +3729,7 @@ std::list identifiers; FindStage find; - find.Apply(*this, identifiers, request, capabilities); + find.Apply(*this, identifiers, capabilities, request); ExpandStage expand; @@ -3741,7 +3740,7 @@ * another transaction). The database engine must ignore such * error cases. **/ - expand.Apply(*this, response, request, *it); + expand.Apply(*this, response, capabilities, request, *it); } } } diff -r c5ca97d21023 -r 89d559e67b03 OrthancServer/Sources/Database/StatelessDatabaseOperations.h --- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.h Sat Jul 13 00:58:29 2024 +0200 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.h Fri Jul 19 09:30:13 2024 +0200 @@ -399,17 +399,18 @@ } void ExecuteFind(std::list& 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); } };