# HG changeset patch # User Sebastien Jodogne # Date 1720508620 -7200 # Node ID 527918e9c5d97d7e251d1403ce9eb64c62f12bc3 # Parent dc96401dbe882d1f195c44c72d8f6b9c2ef976cb# Parent e47ac5e133b1d67db275e5458c2482e2c94c17e1 integration mainline->find-refactoring diff -r dc96401dbe88 -r 527918e9c5d9 OrthancServer/Sources/Database/MainDicomTagsRegistry.cpp --- a/OrthancServer/Sources/Database/MainDicomTagsRegistry.cpp Mon Jul 08 19:03:23 2024 +0200 +++ b/OrthancServer/Sources/Database/MainDicomTagsRegistry.cpp Tue Jul 09 09:03:40 2024 +0200 @@ -96,4 +96,34 @@ type = it->second.GetType(); } } + + + void MainDicomTagsRegistry::NormalizeLookup(std::vector& target, + const DatabaseLookup& source, + ResourceType queryLevel) const + { + target.clear(); + target.reserve(source.GetConstraintsCount()); + + for (size_t i = 0; i < source.GetConstraintsCount(); i++) + { + ResourceType level; + DicomTagType type; + + LookupTag(level, type, source.GetConstraint(i).GetTag()); + + if (type == DicomTagType_Identifier || + type == DicomTagType_Main) + { + // Use the fact that patient-level tags are copied at the study level + if (level == ResourceType_Patient && + queryLevel != ResourceType_Patient) + { + level = ResourceType_Study; + } + + target.push_back(source.GetConstraint(i).ConvertToDatabaseConstraint(level, type)); + } + } + } } diff -r dc96401dbe88 -r 527918e9c5d9 OrthancServer/Sources/Database/MainDicomTagsRegistry.h --- a/OrthancServer/Sources/Database/MainDicomTagsRegistry.h Mon Jul 08 19:03:23 2024 +0200 +++ b/OrthancServer/Sources/Database/MainDicomTagsRegistry.h Tue Jul 09 09:03:40 2024 +0200 @@ -23,7 +23,7 @@ #pragma once -#include "../Search/DicomTagConstraint.h" +#include "../Search/DatabaseLookup.h" #include @@ -74,5 +74,9 @@ void LookupTag(ResourceType& level, DicomTagType& type, const DicomTag& tag) const; + + void NormalizeLookup(std::vector& target, + const DatabaseLookup& source, + ResourceType queryLevel) const; }; } diff -r dc96401dbe88 -r 527918e9c5d9 OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp --- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Mon Jul 08 19:03:23 2024 +0200 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Tue Jul 09 09:03:40 2024 +0200 @@ -364,38 +364,6 @@ } - void StatelessDatabaseOperations::NormalizeLookup(std::vector& target, - const DatabaseLookup& source, - ResourceType queryLevel) const - { - assert(mainDicomTagsRegistry_.get() != NULL); - - target.clear(); - target.reserve(source.GetConstraintsCount()); - - for (size_t i = 0; i < source.GetConstraintsCount(); i++) - { - ResourceType level; - DicomTagType type; - - mainDicomTagsRegistry_->LookupTag(level, type, source.GetConstraint(i).GetTag()); - - if (type == DicomTagType_Identifier || - type == DicomTagType_Main) - { - // Use the fact that patient-level tags are copied at the study level - if (level == ResourceType_Patient && - queryLevel != ResourceType_Patient) - { - level = ResourceType_Study; - } - - target.push_back(source.GetConstraint(i).ConvertToDatabaseConstraint(level, type)); - } - } - } - - class StatelessDatabaseOperations::Transaction : public boost::noncopyable { private: @@ -1929,7 +1897,9 @@ } std::vector normalized; - NormalizeLookup(normalized, lookup, queryLevel); + + assert(mainDicomTagsRegistry_.get() != NULL); + mainDicomTagsRegistry_->NormalizeLookup(normalized, lookup, queryLevel); Operations operations; operations.Apply(*this, (instancesId != NULL), normalized, queryLevel, labels, labelsConstraint, limit); diff -r dc96401dbe88 -r 527918e9c5d9 OrthancServer/Sources/Database/StatelessDatabaseOperations.h --- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.h Mon Jul 08 19:03:23 2024 +0200 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.h Tue Jul 09 09:03:40 2024 +0200 @@ -588,10 +588,6 @@ std::unique_ptr factory_; unsigned int maxRetries_; - void NormalizeLookup(std::vector& target, - const DatabaseLookup& source, - ResourceType level) const; - void ApplyInternal(IReadOnlyOperations* readOperations, IReadWriteOperations* writeOperations);