changeset 4939:e8a2e145c80e more-tags

cleanup
author Alain Mazy <am@osimis.io>
date Tue, 15 Mar 2022 09:09:52 +0100
parents f630796a59b1
children 304514ce84ee
files OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp OrthancServer/Sources/Database/StatelessDatabaseOperations.h OrthancServer/Sources/ServerContext.cpp OrthancServer/Sources/ServerContext.h
diffstat 4 files changed, 30 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp	Mon Mar 14 16:44:00 2022 +0100
+++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp	Tue Mar 15 09:09:52 2022 +0100
@@ -713,11 +713,10 @@
   bool StatelessDatabaseOperations::ExpandResource(ExpandedResource& target,
                                                    const std::string& publicId,
                                                    ResourceType level,
-                                                   DicomToJsonFormat format,
                                                    const std::set<DicomTag>& requestedTags)
   {    
-    class Operations : public ReadOnlyOperationsT6<
-      bool&, ExpandedResource&, const std::string&, ResourceType, DicomToJsonFormat, const std::set<DicomTag>&>
+    class Operations : public ReadOnlyOperationsT5<
+      bool&, ExpandedResource&, const std::string&, ResourceType, const std::set<DicomTag>&>
     {
     private:
   
@@ -1025,7 +1024,7 @@
           transaction.GetMainDicomTags(target.tags_, internalId);
 
           // check if we have access to all requestedTags or if we must get tags from parents
-          const std::set<DicomTag>& requestedTags = tuple.get<5>();
+          const std::set<DicomTag>& requestedTags = tuple.get<4>();
 
           if (requestedTags.size() > 0)
           {
@@ -1140,7 +1139,7 @@
 
     bool found;
     Operations operations;
-    operations.Apply(*this, found, target, publicId, level, format, requestedTags);
+    operations.Apply(*this, found, target, publicId, level, requestedTags);
     return found;
   }
 
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.h	Mon Mar 14 16:44:00 2022 +0100
+++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.h	Tue Mar 15 09:09:52 2022 +0100
@@ -479,7 +479,6 @@
     bool ExpandResource(ExpandedResource& target,
                         const std::string& publicId,
                         ResourceType level,
-                        DicomToJsonFormat format,
                         const std::set<DicomTag>& requestedTags);
 
     void GetAllMetadata(std::map<MetadataType, std::string>& target,
--- a/OrthancServer/Sources/ServerContext.cpp	Mon Mar 14 16:44:00 2022 +0100
+++ b/OrthancServer/Sources/ServerContext.cpp	Tue Mar 15 09:09:52 2022 +0100
@@ -2270,15 +2270,31 @@
 
   bool ServerContext::ExpandResource(Json::Value& target,
                                      const std::string& publicId,
-                                     const std::string& instanceId,    // optional: the id of an instance for the resource
-                                     const Json::Value& dicomAsJson,   // optional: the dicom-as-json for the resource
+                                     const std::string& instanceId,    // optional: the id of an instance for the resource (if already available)
+                                     const Json::Value& dicomAsJson,   // optional: the dicom-as-json for the resource (if already available)
                                      ResourceType level,
                                      DicomToJsonFormat format,
                                      const std::set<DicomTag>& requestedTags)
   {
     ExpandedResource resource;
 
-    if (GetIndex().ExpandResource(resource, publicId, level, format, requestedTags))
+    if (ExpandResource(resource, publicId, instanceId, dicomAsJson, level, requestedTags))
+    {
+      SerializeExpandedResource(target, resource, format, requestedTags);
+      return true;
+    }
+
+    return false;
+  }
+  
+  bool ServerContext::ExpandResource(ExpandedResource& resource,
+                                     const std::string& publicId,
+                                     const std::string& instanceId,    // optional: the id of an instance for the resource (if already available)
+                                     const Json::Value& dicomAsJson,   // optional: the dicom-as-json for the resource (if already available)
+                                     ResourceType level,
+                                     const std::set<DicomTag>& requestedTags)
+  {
+    if (GetIndex().ExpandResource(resource, publicId, level, requestedTags))
     {
       // check the main dicom tags list has not changed since the resource was stored
       if (resource.mainDicomTagsSignature_ != DicomMap::GetMainDicomTagsSignature(resource.type_))
@@ -2325,8 +2341,6 @@
         resource.tags_.Merge(allTags);
       }
 
-      SerializeExpandedResource(target, resource, format, requestedTags);
-
       return true;
     }
 
--- a/OrthancServer/Sources/ServerContext.h	Mon Mar 14 16:44:00 2022 +0100
+++ b/OrthancServer/Sources/ServerContext.h	Tue Mar 15 09:09:52 2022 +0100
@@ -554,5 +554,12 @@
                         DicomToJsonFormat format,
                         const std::set<DicomTag>& requestedTags);
 
+    bool ExpandResource(ExpandedResource& target,
+                        const std::string& publicId,
+                        const std::string& instanceId,    // optional: the id of an instance for the resource
+                        const Json::Value& dicomAsJson,   // optional: the dicom-as-json for the resource
+                        ResourceType level,
+                        const std::set<DicomTag>& requestedTags);
+
   };
 }