changeset 5581:4ad301c35f6e find-refactoring

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 27 Apr 2024 15:02:24 +0200
parents df7324d6e728
children 17da828f9443
files OrthancServer/Sources/Database/FindResponse.h OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp OrthancServer/Sources/Database/StatelessDatabaseOperations.h OrthancServer/Sources/ServerContext.cpp OrthancServer/Sources/ServerContext.h
diffstat 5 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/FindResponse.h	Sat Apr 27 12:14:53 2024 +0200
+++ b/OrthancServer/Sources/Database/FindResponse.h	Sat Apr 27 15:02:24 2024 +0200
@@ -82,8 +82,8 @@
     class Item : public boost::noncopyable
     {
     private:
-      FindRequest::ResponseContent          responseContent_;    // what has been requested
-      ResourceType                          level_;
+      FindRequest::ResponseContent          responseContent_;  // TODO REMOVE  // what has been requested
+      ResourceType                          level_;   // TODO REMOVE
       OrthancIdentifiers                    identifiers_;
       std::unique_ptr<DicomMap>             dicomMap_;
       std::list<std::string>                children_;
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp	Sat Apr 27 12:14:53 2024 +0200
+++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp	Sat Apr 27 15:02:24 2024 +0200
@@ -3863,9 +3863,9 @@
 
   // TODO-FIND: we reuse the ExpandedResource class to reuse Serialization code from ExpandedResource
   // But, finally, we might just get rid of ExpandedResource and replace it by FindResponse
-  ExpandedResource::ExpandedResource(ResourceType level,
+  ExpandedResource::ExpandedResource(const FindRequest& request,
                                      const FindResponse::Item& item) :
-    id_(item.GetIdentifiers().GetLevel(level)),
+    id_(item.GetIdentifiers().GetLevel(request.GetLevel())),
     level_(item.GetLevel()),
     isStable_(false),
     expectedNumberOfInstances_(0),
@@ -3884,7 +3884,7 @@
 
     if (item.HasResponseContent(FindRequest::ResponseContent_Parent))
     {
-      parentId_ = item.GetIdentifiers().GetLevel(GetParentResourceType(level));
+      parentId_ = item.GetIdentifiers().GetLevel(GetParentResourceType(request.GetLevel()));
     }
 
     if (item.HasResponseContent(FindRequest::ResponseContent_Metadata))
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.h	Sat Apr 27 12:14:53 2024 +0200
+++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.h	Sat Apr 27 15:02:24 2024 +0200
@@ -80,7 +80,7 @@
     {
     }
     
-    ExpandedResource(ResourceType level,
+    ExpandedResource(const FindRequest& request,
                      const FindResponse::Item& item);
 
     void SetResource(ResourceType level,
--- a/OrthancServer/Sources/ServerContext.cpp	Sat Apr 27 12:14:53 2024 +0200
+++ b/OrthancServer/Sources/ServerContext.cpp	Sat Apr 27 15:02:24 2024 +0200
@@ -2718,14 +2718,14 @@
   }
 
   void ServerContext::AppendFindResponse(Json::Value& target,
-                                         ResourceType level,
+                                         const FindRequest& request,
                                          const FindResponse::Item& item,
                                          DicomToJsonFormat format,
                                          const std::set<DicomTag>& requestedTags,
                                          bool allowStorageAccess)
   {
     // convert to ExpandedResource to re-use the serialization code TODO-FIND: check if this is the right way to do.  shouldn't we copy the code and finally get rid of ExpandedResource ? 
-    ExpandedResource resource(level, item);
+    ExpandedResource resource(request.GetLevel(), item);
 
     ExpandResourceFlags expandFlags = ExpandResourceFlags_None;
     if (item.HasResponseContent(FindRequest::ResponseContent_Children))
--- a/OrthancServer/Sources/ServerContext.h	Sat Apr 27 12:14:53 2024 +0200
+++ b/OrthancServer/Sources/ServerContext.h	Sat Apr 27 15:02:24 2024 +0200
@@ -608,7 +608,7 @@
                         bool allowStorageAccess);
 
     void AppendFindResponse(Json::Value& target,
-                            ResourceType level,
+                            const FindRequest& request,
                             const FindResponse::Item& item,
                             DicomToJsonFormat format,
                             const std::set<DicomTag>& requestedTags,