Mercurial > hg > orthanc
comparison 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 |
comparison
equal
deleted
inserted
replaced
5665:d8c86698110c | 5666:aa231c18b9d2 |
---|---|
409 throw OrthancException(ErrorCode_DatabasePlugin); | 409 throw OrthancException(ErrorCode_DatabasePlugin); |
410 } | 410 } |
411 } | 411 } |
412 } | 412 } |
413 | 413 |
414 if (request.GetLevel() != ResourceType_Instance && | 414 if (request.GetLevel() != ResourceType_Instance) |
415 request.GetChildrenRetrieveSpecification(GetChildResourceType(request.GetLevel())).IsRetrieveIdentifiers()) | |
416 { | 415 { |
417 // TODO-FIND: Retrieve other levels than immediate children | 416 // TODO-FIND: Retrieve other levels than immediate children |
418 std::list<std::string> children; | 417 const ResourceType childLevel = GetChildResourceType(request.GetLevel()); |
419 transaction_.GetChildrenPublicId(children, internalId); | 418 |
420 | 419 if (request.GetChildrenRetrieveSpecification(childLevel).IsRetrieveIdentifiers()) |
421 for (std::list<std::string>::const_iterator it = children.begin(); it != children.end(); ++it) | 420 { |
422 { | 421 std::list<std::string> children; |
423 resource->AddChildIdentifier(*it); | 422 transaction_.GetChildrenPublicId(children, internalId); |
423 | |
424 for (std::list<std::string>::const_iterator it = children.begin(); it != children.end(); ++it) | |
425 { | |
426 resource->AddChildIdentifier(childLevel, *it); | |
427 } | |
424 } | 428 } |
425 } | 429 } |
426 | 430 |
427 for (std::set<MetadataType>::const_iterator it = request.GetRetrieveChildrenMetadata().begin(); | 431 for (std::set<MetadataType>::const_iterator it = request.GetRetrieveChildrenMetadata().begin(); |
428 it != request.GetRetrieveChildrenMetadata().end(); ++it) | 432 it != request.GetRetrieveChildrenMetadata().end(); ++it) |
430 std::list<std::string> values; | 434 std::list<std::string> values; |
431 transaction_.GetChildrenMetadata(values, internalId, *it); | 435 transaction_.GetChildrenMetadata(values, internalId, *it); |
432 resource->AddChildrenMetadata(*it, values); | 436 resource->AddChildrenMetadata(*it, values); |
433 } | 437 } |
434 | 438 |
435 if (request.IsRetrieveOneInstanceIdentifier()) | 439 if (request.IsRetrieveOneInstanceIdentifier() && |
440 !request.GetChildrenRetrieveSpecification(ResourceType_Instance).IsRetrieveIdentifiers()) | |
436 { | 441 { |
437 int64_t currentId = internalId; | 442 int64_t currentId = internalId; |
438 ResourceType currentLevel = level; | 443 ResourceType currentLevel = level; |
439 | 444 |
440 while (currentLevel != ResourceType_Instance) | 445 while (currentLevel != ResourceType_Instance) |
450 currentId = children.front(); | 455 currentId = children.front(); |
451 currentLevel = GetChildResourceType(currentLevel); | 456 currentLevel = GetChildResourceType(currentLevel); |
452 } | 457 } |
453 } | 458 } |
454 | 459 |
455 resource->SetOneInstanceIdentifier(transaction_.GetPublicId(currentId)); | 460 resource->AddChildIdentifier(ResourceType_Instance, transaction_.GetPublicId(currentId)); |
456 } | 461 } |
457 | 462 |
458 response.Add(resource.release()); | 463 response.Add(resource.release()); |
459 } | 464 } |
460 } | 465 } |