Mercurial > hg > orthanc
changeset 5849:0f4345cbe558 find-refactoring
GetChildrenPublicId() and LookupResourceAndParent() tagged as compatibility database primitives
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 29 Oct 2024 14:05:59 +0000 |
parents | b8fb95937f22 |
children | 1980354c8113 |
files | OrthancServer/Sources/Database/Compatibility/GenericFind.cpp OrthancServer/Sources/Database/IDatabaseWrapper.h OrthancServer/Sources/Database/StatelessDatabaseOperations.h |
diffstat | 3 files changed, 23 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp Tue Oct 29 13:48:39 2024 +0000 +++ b/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp Tue Oct 29 14:05:59 2024 +0000 @@ -56,7 +56,7 @@ } static void GetChildren(std::list<std::string>& target, - IDatabaseWrapper::ITransaction& transaction, + IDatabaseWrapper::ICompatibilityTransaction& transaction, const std::list<int64_t>& resources) { target.clear(); @@ -71,6 +71,7 @@ static void GetChildrenIdentifiers(std::list<std::string>& children, IDatabaseWrapper::ITransaction& transaction, + IDatabaseWrapper::ICompatibilityTransaction& compatibilityTransaction, const OrthancIdentifiers& identifiers, ResourceType topLevel, ResourceType bottomLevel) @@ -100,7 +101,7 @@ ResourceType nextLevel = GetChildResourceType(currentLevel); if (nextLevel == bottomLevel) { - GetChildren(children, transaction, currentResources); + GetChildren(children, compatibilityTransaction, currentResources); } else { @@ -209,7 +210,8 @@ !request.GetOrthancIdentifiers().HasSeriesId() && !request.GetOrthancIdentifiers().HasInstanceId()) { - GetChildrenIdentifiers(identifiers, transaction_, request.GetOrthancIdentifiers(), ResourceType_Patient, request.GetLevel()); + GetChildrenIdentifiers(identifiers, transaction_, compatibilityTransaction_, + request.GetOrthancIdentifiers(), ResourceType_Patient, request.GetLevel()); } else if (IsRequestWithoutContraint(request) && (request.GetLevel() == ResourceType_Series || @@ -219,7 +221,8 @@ !request.GetOrthancIdentifiers().HasSeriesId() && !request.GetOrthancIdentifiers().HasInstanceId()) { - GetChildrenIdentifiers(identifiers, transaction_, request.GetOrthancIdentifiers(), ResourceType_Study, request.GetLevel()); + GetChildrenIdentifiers(identifiers, transaction_, compatibilityTransaction_, + request.GetOrthancIdentifiers(), ResourceType_Study, request.GetLevel()); } else if (IsRequestWithoutContraint(request) && request.GetLevel() == ResourceType_Instance && @@ -228,7 +231,8 @@ request.GetOrthancIdentifiers().HasSeriesId() && !request.GetOrthancIdentifiers().HasInstanceId()) { - GetChildrenIdentifiers(identifiers, transaction_, request.GetOrthancIdentifiers(), ResourceType_Series, request.GetLevel()); + GetChildrenIdentifiers(identifiers, transaction_, compatibilityTransaction_, + request.GetOrthancIdentifiers(), ResourceType_Series, request.GetLevel()); } else if (request.GetMetadataConstraintsCount() == 0 && request.GetOrdering().empty() && @@ -393,7 +397,7 @@ if (request.IsRetrieveParentIdentifier()) { - if (!transaction_.LookupResourceAndParent(internalId, level, parent, identifier)) + if (!compatibilityTransaction_.LookupResourceAndParent(internalId, level, parent, identifier)) { return; // The resource is not available anymore } @@ -519,7 +523,7 @@ for (std::list<int64_t>::const_iterator it = currentIds.begin(); it != currentIds.end(); ++it) { std::list<std::string> ids; - transaction_.GetChildrenPublicId(ids, *it); + compatibilityTransaction_.GetChildrenPublicId(ids, *it); for (std::list<std::string>::const_iterator it2 = ids.begin(); it2 != ids.end(); ++it2) {
--- a/OrthancServer/Sources/Database/IDatabaseWrapper.h Tue Oct 29 13:48:39 2024 +0000 +++ b/OrthancServer/Sources/Database/IDatabaseWrapper.h Tue Oct 29 14:05:59 2024 +0000 @@ -210,9 +210,6 @@ virtual void GetChildrenInternalId(std::list<int64_t>& target, int64_t id) = 0; - virtual void GetChildrenPublicId(std::list<std::string>& target, - int64_t id) = 0; - virtual void GetExportedResources(std::list<ExportedResource>& target /*out*/, bool& done /*out*/, int64_t since, @@ -336,16 +333,6 @@ /** - * Primitives introduced in Orthanc 1.5.4 - **/ - - virtual bool LookupResourceAndParent(int64_t& id, - ResourceType& type, - std::string& parentPublicId, - const std::string& publicId) = 0; - - - /** * Primitives introduced in Orthanc 1.12.0 **/ @@ -429,6 +416,18 @@ ResourceType resourceType, int64_t since, uint32_t limit) = 0; + + virtual void GetChildrenPublicId(std::list<std::string>& target, + int64_t id) = 0; + + /** + * Primitives introduced in Orthanc 1.5.4 + **/ + + virtual bool LookupResourceAndParent(int64_t& id, + ResourceType& type, + std::string& parentPublicId, + const std::string& publicId) = 0; };
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.h Tue Oct 29 13:48:39 2024 +0000 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.h Tue Oct 29 14:05:59 2024 +0000 @@ -165,12 +165,6 @@ transaction_.GetChildrenInternalId(target, id); } - void GetChildrenPublicId(std::list<std::string>& target, - int64_t id) - { - transaction_.GetChildrenPublicId(target, id); - } - void GetExportedResources(std::list<ExportedResource>& target /*out*/, bool& done /*out*/, int64_t since, @@ -271,14 +265,6 @@ { return transaction_.LookupResource(id, type, publicId); } - - bool LookupResourceAndParent(int64_t& id, - ResourceType& type, - std::string& parentPublicId, - const std::string& publicId) - { - return transaction_.LookupResourceAndParent(id, type, parentPublicId, publicId); - } void ListLabels(std::set<std::string>& target, int64_t id)