diff OrthancServer/Sources/Database/FindRequest.cpp @ 5621:732ec9feeea8 find-refactoring

introduction of FindRequest::ChildrenRetrieveSpecification
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 11 May 2024 15:43:07 +0200
parents 1864b16bc7b1
children 3f13db27b399
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/FindRequest.cpp	Sat May 11 15:11:22 2024 +0200
+++ b/OrthancServer/Sources/Database/FindRequest.cpp	Sat May 11 15:43:07 2024 +0200
@@ -55,6 +55,30 @@
   }
 
 
+  FindRequest::ChildrenRetrieveSpecification& FindRequest::GetChildrenRetrieveSpecification(ResourceType level)
+  {
+    if (!IsResourceLevelAboveOrEqual(level_, level))
+    {
+      throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
+
+    switch (level)
+    {
+      case ResourceType_Study:
+        return retrieveChildrenStudies_;
+
+      case ResourceType_Series:
+        return retrieveChildrenSeries_;
+
+      case ResourceType_Instance:
+        return retrieveChildrenInstances_;
+
+      default:
+        throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
+  }
+
+
   FindRequest::FindRequest(ResourceType level) :
     level_(level),
     hasLimits_(false),
@@ -65,7 +89,6 @@
     retrieveLabels_(false),
     retrieveAttachments_(false),
     retrieveParentIdentifier_(false),
-    retrieveChildrenIdentifiers_(false),
     retrieveOneInstanceIdentifier_(false)
   {
   }
@@ -269,19 +292,6 @@
   }
 
 
-  void FindRequest::SetRetrieveChildrenIdentifiers(bool retrieve)
-  {
-    if (level_ == ResourceType_Instance)
-    {
-      throw OrthancException(ErrorCode_BadParameterType);
-    }
-    else
-    {
-      retrieveChildrenIdentifiers_ = retrieve;
-    }
-  }
-
-
   void FindRequest::AddRetrieveChildrenMetadata(MetadataType metadata)
   {
     if (IsRetrieveChildrenMetadata(metadata))