changeset 5618:824a5fb0774e find-refactoring

removed constructor of ExpandedResource with FindRequest
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 11 May 2024 11:23:25 +0200
parents 8905ffa45fc2
children 1864b16bc7b1
files OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp OrthancServer/Sources/Database/StatelessDatabaseOperations.h
diffstat 2 files changed, 0 insertions(+), 99 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp	Thu May 09 14:59:17 2024 +0200
+++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp	Sat May 11 11:23:25 2024 +0200
@@ -3769,100 +3769,4 @@
       }
     }
   }
-
-  // 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(const FindRequest& request,
-                                     const FindResponse::Resource& resource) :
-    id_(resource.GetIdentifier()),
-    level_(request.GetLevel()),
-    isStable_(false),
-    expectedNumberOfInstances_(0),
-    fileSize_(0),
-    indexInSeries_(0)
-  {
-    if (request.GetLevel() != resource.GetLevel())
-    {
-      throw OrthancException(ErrorCode_InternalError);
-    }
-
-    if (request.IsRetrieveMainDicomTags(request.GetLevel()))
-    {
-      resource.GetMainDicomTags(tags_, request.GetLevel());
-    }
-
-    if (request.IsRetrieveChildrenIdentifiers())
-    {
-      const std::set<std::string>& children = resource.GetChildrenIdentifiers();
-      for (std::set<std::string>::const_iterator it = children.begin(); it != children.end(); ++it)
-      {
-        childrenIds_.push_back(*it);
-      }
-    }
-
-    if (request.IsRetrieveParentIdentifier())
-    {
-      parentId_ = resource.GetParentIdentifier();
-    }
-
-    if (request.IsRetrieveMetadata(request.GetLevel()))
-    {
-      metadata_ = resource.GetMetadata(request.GetLevel());
-      std::string value;
-      if (resource.LookupMetadata(value, request.GetLevel(), MetadataType_MainDicomTagsSignature))
-      {
-        mainDicomTagsSignature_ = value;
-      }
-      if (resource.LookupMetadata(value, request.GetLevel(), MetadataType_AnonymizedFrom))
-      {
-        anonymizedFrom_ = value;
-      }
-      if (resource.LookupMetadata(value, request.GetLevel(), MetadataType_ModifiedFrom))
-      {
-        modifiedFrom_ = value;
-      }
-      if (resource.LookupMetadata(value, request.GetLevel(), MetadataType_LastUpdate))
-      {
-        lastUpdate_ = value;
-      }
-      if (request.GetLevel() == ResourceType_Series)
-      {
-        if (resource.LookupMetadata(value, request.GetLevel(), MetadataType_Series_ExpectedNumberOfInstances))
-        {
-          expectedNumberOfInstances_ = boost::lexical_cast<int>(value);
-        }
-      }
-      if (request.GetLevel() == ResourceType_Instance)
-      {
-        if (resource.LookupMetadata(value, request.GetLevel(), MetadataType_Instance_IndexInSeries))
-        {
-          indexInSeries_ = boost::lexical_cast<int>(value);
-        }
-      }
-    }
-
-    if (request.IsRetrieveLabels())
-    {
-      labels_ = resource.GetLabels();
-    }
-
-    if (request.IsRetrieveAttachments())
-    {
-      FileInfo attachment;
-      if (resource.LookupAttachment(attachment, FileContentType_Dicom))
-      {
-        fileSize_ = attachment.GetUncompressedSize();
-        fileUuid_ = attachment.GetUuid();
-      }
-    }
-
-    //if (request.IsRetrieveChildrenMetadata())
-    {
-      // TODO-FIND: the status_ is normally obtained from transaction.GetSeriesStatus(internalId, i)
-      // but, that's an heavy operation for something that is rarely used -> we should have dedicated SQL code 
-      // to compute it AFAP and we should compute it only if the user request it !
-    }
-
-    // TODO-FIND: continue: isStable_, status_
-  }
 }
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.h	Thu May 09 14:59:17 2024 +0200
+++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.h	Sat May 11 11:23:25 2024 +0200
@@ -80,9 +80,6 @@
       indexInSeries_(0)
     {
     }
-    
-    ExpandedResource(const FindRequest& request,
-                     const FindResponse::Resource& resource);
 
     void SetResource(ResourceType level,
                      const std::string& id)