Mercurial > hg > orthanc
comparison OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp @ 5617:8905ffa45fc2 find-refactoring
started listing of children resources
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 09 May 2024 14:59:17 +0200 |
parents | a10978a5e65c |
children | 3f13db27b399 |
comparison
equal
deleted
inserted
replaced
5616:1e92fb051fd7 | 5617:8905ffa45fc2 |
---|---|
3438 } | 3438 } |
3439 | 3439 |
3440 ServerIndex& index = OrthancRestApi::GetIndex(call); | 3440 ServerIndex& index = OrthancRestApi::GetIndex(call); |
3441 ServerContext& context = OrthancRestApi::GetContext(call); | 3441 ServerContext& context = OrthancRestApi::GetContext(call); |
3442 | 3442 |
3443 const bool expand = (!call.HasArgument("expand") || | |
3444 // this "expand" is the only one to have a false default value to keep backward compatibility | |
3445 call.GetBooleanArgument("expand", false)); | |
3446 const DicomToJsonFormat format = OrthancRestApi::GetDicomFormat(call, DicomToJsonFormat_Human); | |
3447 | |
3443 std::set<DicomTag> requestedTags; | 3448 std::set<DicomTag> requestedTags; |
3444 OrthancRestApi::GetRequestedTags(requestedTags, call); | 3449 OrthancRestApi::GetRequestedTags(requestedTags, call); |
3445 | 3450 |
3446 std::list<std::string> a, b, c; | 3451 if (false) |
3447 a.push_back(call.GetUriComponent("id", "")); | 3452 { |
3448 | 3453 /** |
3449 ResourceType type = start; | 3454 * EXPERIMENTAL VERSION |
3450 while (type != end) | 3455 **/ |
3451 { | 3456 |
3452 b.clear(); | 3457 ResourceFinder finder(end, expand); |
3453 | 3458 finder.SetOrthancId(start, call.GetUriComponent("id", "")); |
3454 for (std::list<std::string>::const_iterator | 3459 finder.AddRequestedTags(requestedTags); |
3455 it = a.begin(); it != a.end(); ++it) | 3460 finder.SetFormat(format); |
3456 { | 3461 |
3457 index.GetChildren(c, *it); | 3462 Json::Value answer; |
3458 b.splice(b.begin(), c); | 3463 finder.Execute(answer, context); |
3459 } | 3464 call.GetOutput().AnswerJson(answer); |
3460 | 3465 } |
3461 type = GetChildResourceType(type); | 3466 else |
3462 | 3467 { |
3463 a.clear(); | 3468 /** |
3464 a.splice(a.begin(), b); | 3469 * VERSION IN ORTHANC <= 1.12.3 |
3465 } | 3470 **/ |
3466 | 3471 std::list<std::string> a, b, c; |
3467 AnswerListOfResources2(call.GetOutput(), context, a, type, !call.HasArgument("expand") || call.GetBooleanArgument("expand", false), // this "expand" is the only one to have a false default value to keep backward compatibility | 3472 a.push_back(call.GetUriComponent("id", "")); |
3468 OrthancRestApi::GetDicomFormat(call, DicomToJsonFormat_Human), | 3473 |
3469 requestedTags, | 3474 ResourceType type = start; |
3470 true /* allowStorageAccess */); | 3475 while (type != end) |
3476 { | |
3477 b.clear(); | |
3478 | |
3479 for (std::list<std::string>::const_iterator | |
3480 it = a.begin(); it != a.end(); ++it) | |
3481 { | |
3482 index.GetChildren(c, *it); | |
3483 b.splice(b.begin(), c); | |
3484 } | |
3485 | |
3486 type = GetChildResourceType(type); | |
3487 | |
3488 a.clear(); | |
3489 a.splice(a.begin(), b); | |
3490 } | |
3491 | |
3492 AnswerListOfResources2(call.GetOutput(), context, a, type, expand, format, requestedTags, true /* allowStorageAccess */); | |
3493 } | |
3471 } | 3494 } |
3472 | 3495 |
3473 | 3496 |
3474 static void GetChildInstancesTags(RestApiGetCall& call) | 3497 static void GetChildInstancesTags(RestApiGetCall& call) |
3475 { | 3498 { |