changeset 5711:31eb66eaed86 find-refactoring-clean

fix previous integration
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 12 Jul 2024 18:59:20 +0200
parents a786da7599d5
children 52771e1a8072
files OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp
diffstat 1 files changed, 3 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Fri Jul 12 18:55:22 2024 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Fri Jul 12 18:59:20 2024 +0200
@@ -3443,7 +3443,7 @@
     const DicomToJsonFormat format = OrthancRestApi::GetDicomFormat(call, DicomToJsonFormat_Human);
 
     Json::Value resource;
-    if (OrthancRestApi::GetContext(call).ExpandResource(resource, current, end, format, requestedTags, true /* allowStorageAccess */))
+    if (ExpandResource(resource, OrthancRestApi::GetIndex(call), currentType, current, format, false))
     {
       call.GetOutput().AnswerJson(resource);
     }
@@ -3722,24 +3722,6 @@
   }
 
 
-  static void AddMetadata(Json::Value& target,
-                          ServerIndex& index,
-                          const std::string& resource,
-                          ResourceType level)
-  {
-    target = Json::objectValue;
-    
-    std::map<MetadataType, std::string> content;
-    index.GetAllMetadata(content, resource, level);
-    
-    for (std::map<MetadataType, std::string>::const_iterator
-           it = content.begin(); it != content.end(); ++it)
-    {
-      target[EnumerationToString(it->first)] = it->second;
-    }
-  }
-
-
   static void BulkContent(RestApiPostCall& call)
   {
     static const char* const LEVEL = "Level";
@@ -3877,15 +3859,8 @@
                it = interest.begin(); it != interest.end(); ++it)
         {
           Json::Value item;
-          std::set<DicomTag> emptyRequestedTags;  // not supported for bulk content
-
-          if (OrthancRestApi::GetContext(call).ExpandResource(item, *it, level, format, emptyRequestedTags, true /* allowStorageAccess */))
+          if (ExpandResource(item, OrthancRestApi::GetIndex(call), level, *it, format, metadata))
           {
-            if (metadata)
-            {
-              AddMetadata(item[METADATA], index, *it, level);
-            }
-
             answer.append(item);
           }
         }
@@ -3901,16 +3876,10 @@
         {
           ResourceType level;
           Json::Value item;
-          std::set<DicomTag> emptyRequestedTags;  // not supported for bulk content
 
           if (index.LookupResourceType(level, *it) &&
-              OrthancRestApi::GetContext(call).ExpandResource(item, *it, level, format, emptyRequestedTags, true /* allowStorageAccess */))
+              ExpandResource(item, OrthancRestApi::GetIndex(call), level, *it, format, metadata))
           {
-            if (metadata)
-            {
-              AddMetadata(item[METADATA], index, *it, level);
-            }
-
             answer.append(item);
           }
           else