Mercurial > hg > orthanc
changeset 5832:dd2af8692cbc find-refactoring
new default ResponseContent
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Wed, 09 Oct 2024 10:23:04 +0200 |
parents | 22623aa8e6fc |
children | 58c549b881ae 79a497908b04 7c61bdf925fc |
files | OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp OrthancServer/Sources/OrthancWebDav.cpp OrthancServer/Sources/ServerEnumerations.h |
diffstat | 3 files changed, 36 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Tue Oct 08 17:53:06 2024 +0200 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Wed Oct 09 10:23:04 2024 +0200 @@ -137,7 +137,7 @@ DicomToJsonFormat format, bool retrieveMetadata) { - ResponseContentFlags responseContent = ResponseContentFlags_Default; + ResponseContentFlags responseContent = ResponseContentFlags_ExpandTrue; if (retrieveMetadata) { @@ -265,7 +265,7 @@ std::set<DicomTag> requestedTags; OrthancRestApi::GetRequestedTags(requestedTags, call); - ResourceFinder finder(resourceType, (expand ? ResponseContentFlags_Default : ResponseContentFlags_ID)); + ResourceFinder finder(resourceType, (expand ? ResponseContentFlags_ExpandTrue : ResponseContentFlags_ID)); finder.AddRequestedTags(requestedTags); if (call.HasArgument("limit") || @@ -371,7 +371,7 @@ * EXPERIMENTAL VERSION **/ - ResourceFinder finder(resourceType, ResponseContentFlags_Default); + ResourceFinder finder(resourceType, ResponseContentFlags_ExpandTrue); finder.AddRequestedTags(requestedTags); finder.SetOrthancId(resourceType, call.GetUriComponent("id", "")); @@ -3420,6 +3420,8 @@ if (request.isMember(KEY_RESPONSE_CONTENT)) { + responseContent = ResponseContentFlags_Default; + for (Json::ArrayIndex i = 0; i < request[KEY_RESPONSE_CONTENT].size(); ++i) { responseContent = static_cast<ResponseContentFlags>(static_cast<uint32_t>(responseContent) | StringToResponseContent(request[KEY_RESPONSE_CONTENT][i].asString())); @@ -3427,7 +3429,7 @@ } else if (request.isMember(KEY_EXPAND) && request[KEY_EXPAND].asBool()) { - responseContent = ResponseContentFlags_Default; + responseContent = ResponseContentFlags_ExpandTrue; } const ResourceType level = StringToResourceType(request[KEY_LEVEL].asCString()); @@ -3822,7 +3824,7 @@ * EXPERIMENTAL VERSION **/ - ResourceFinder finder(end, (expand ? ResponseContentFlags_Default : ResponseContentFlags_ID)); + ResourceFinder finder(end, (expand ? ResponseContentFlags_ExpandTrue : ResponseContentFlags_ID)); finder.SetOrthancId(start, call.GetUriComponent("id", "")); finder.AddRequestedTags(requestedTags);
--- a/OrthancServer/Sources/OrthancWebDav.cpp Tue Oct 08 17:53:06 2024 +0200 +++ b/OrthancServer/Sources/OrthancWebDav.cpp Wed Oct 09 10:23:04 2024 +0200 @@ -1666,7 +1666,7 @@ ResourceType level, const DatabaseLookup& query) { - ResourceFinder finder(level, ResponseContentFlags_Default); + ResourceFinder finder(level, ResponseContentFlags_ExpandTrue); finder.SetDatabaseLookup(query); Json::Value expanded;
--- a/OrthancServer/Sources/ServerEnumerations.h Tue Oct 08 17:53:06 2024 +0200 +++ b/OrthancServer/Sources/ServerEnumerations.h Wed Oct 09 10:23:04 2024 +0200 @@ -124,27 +124,36 @@ enum ResponseContentFlags { ResponseContentFlags_ID = (1 << 0), - ResponseContentFlags_MainDicomTags = (1 << 1), - ResponseContentFlags_MetadataLegacy = (1 << 2), // when "Expand": true -> all metadata are included at root level - ResponseContentFlags_AttachmentsLegacy = (1 << 3), // when "Expand": true -> include attachments info at instance level - ResponseContentFlags_Metadata = (1 << 4), // all metadata are listed in a "Metadata" field - ResponseContentFlags_Attachments = (1 << 5), // all attachments are listed in a "Attachments" field - ResponseContentFlags_Status = (1 << 6), - ResponseContentFlags_Parent = (1 << 7), - ResponseContentFlags_Children = (1 << 8), - ResponseContentFlags_Labels = (1 << 9), - ResponseContentFlags_IsStable = (1 << 10), + ResponseContentFlags_Type = (1 << 1), + ResponseContentFlags_RequestedTags = (1 << 2), + ResponseContentFlags_MainDicomTags = (1 << 3), + ResponseContentFlags_MetadataLegacy = (1 << 4), // when "Expand": true -> all metadata are included at root level + ResponseContentFlags_AttachmentsLegacy = (1 << 5), // when "Expand": true -> include attachments info at instance level + ResponseContentFlags_Metadata = (1 << 6), // all metadata are listed in a "Metadata" field + ResponseContentFlags_Attachments = (1 << 7), // all attachments are listed in a "Attachments" field + ResponseContentFlags_Status = (1 << 8), + ResponseContentFlags_Parent = (1 << 9), + ResponseContentFlags_Children = (1 << 10), + ResponseContentFlags_Labels = (1 << 11), + ResponseContentFlags_IsStable = (1 << 12), // Some predefined combinations - ResponseContentFlags_Default = (ResponseContentFlags_ID | - ResponseContentFlags_MainDicomTags | - ResponseContentFlags_MetadataLegacy | - ResponseContentFlags_AttachmentsLegacy | - ResponseContentFlags_Status | - ResponseContentFlags_Parent | - ResponseContentFlags_Children | - ResponseContentFlags_Labels | - ResponseContentFlags_IsStable) // equivalent to "Expand": true + ResponseContentFlags_ExpandTrue = (ResponseContentFlags_ID | + ResponseContentFlags_Type | + ResponseContentFlags_RequestedTags | + ResponseContentFlags_MainDicomTags | + ResponseContentFlags_MetadataLegacy | + ResponseContentFlags_AttachmentsLegacy | + ResponseContentFlags_Status | + ResponseContentFlags_Parent | + ResponseContentFlags_Children | + ResponseContentFlags_Labels | + ResponseContentFlags_IsStable), // equivalent to "Expand": true + + ResponseContentFlags_Default = (ResponseContentFlags_ID | + ResponseContentFlags_Type | + ResponseContentFlags_RequestedTags) // minimal content as soon as you have a "ResponseContent" + }; /**