Mercurial > hg > orthanc
diff OrthancServer/Sources/Database/Compatibility/GenericFind.cpp @ 5666:aa231c18b9d2 find-refactoring
adding computed tags
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 04 Jul 2024 18:31:54 +0200 |
parents | 3f13db27b399 |
children | 93dff1fccf36 |
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp Thu Jul 04 14:36:24 2024 +0200 +++ b/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp Thu Jul 04 18:31:54 2024 +0200 @@ -411,16 +411,20 @@ } } - if (request.GetLevel() != ResourceType_Instance && - request.GetChildrenRetrieveSpecification(GetChildResourceType(request.GetLevel())).IsRetrieveIdentifiers()) + if (request.GetLevel() != ResourceType_Instance) { // TODO-FIND: Retrieve other levels than immediate children - std::list<std::string> children; - transaction_.GetChildrenPublicId(children, internalId); + const ResourceType childLevel = GetChildResourceType(request.GetLevel()); - for (std::list<std::string>::const_iterator it = children.begin(); it != children.end(); ++it) + if (request.GetChildrenRetrieveSpecification(childLevel).IsRetrieveIdentifiers()) { - resource->AddChildIdentifier(*it); + std::list<std::string> children; + transaction_.GetChildrenPublicId(children, internalId); + + for (std::list<std::string>::const_iterator it = children.begin(); it != children.end(); ++it) + { + resource->AddChildIdentifier(childLevel, *it); + } } } @@ -432,7 +436,8 @@ resource->AddChildrenMetadata(*it, values); } - if (request.IsRetrieveOneInstanceIdentifier()) + if (request.IsRetrieveOneInstanceIdentifier() && + !request.GetChildrenRetrieveSpecification(ResourceType_Instance).IsRetrieveIdentifiers()) { int64_t currentId = internalId; ResourceType currentLevel = level; @@ -452,7 +457,7 @@ } } - resource->SetOneInstanceIdentifier(transaction_.GetPublicId(currentId)); + resource->AddChildIdentifier(ResourceType_Instance, transaction_.GetPublicId(currentId)); } response.Add(resource.release());