Mercurial > hg > orthanc
changeset 5720:89d559e67b03 find-refactoring
fix compatibility with old database plugins
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 19 Jul 2024 09:30:13 +0200 |
parents | c5ca97d21023 |
children | 3f97590cc0c9 b1c86368af2b |
files | OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp OrthancServer/Sources/Database/BaseDatabaseWrapper.cpp OrthancServer/Sources/Database/BaseDatabaseWrapper.h OrthancServer/Sources/Database/Compatibility/GenericFind.cpp OrthancServer/Sources/Database/Compatibility/GenericFind.h OrthancServer/Sources/Database/IDatabaseWrapper.h 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 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<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 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<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 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<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 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<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 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<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 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<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 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<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, @@ -3699,13 +3698,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>()); } }; @@ -3730,7 +3729,7 @@ std::list<std::string> 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); } } }
--- 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<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); } };