diff Framework/Plugins/IndexBackend.cpp @ 577:991b9b285e1a attach-custom-data tip

fix custom-data handling
author Alain Mazy <am@orthanc.team>
date Wed, 02 Oct 2024 09:40:20 +0200
parents f18e46d7dbf8
children
line wrap: on
line diff
--- a/Framework/Plugins/IndexBackend.cpp	Tue Oct 01 16:02:48 2024 +0200
+++ b/Framework/Plugins/IndexBackend.cpp	Wed Oct 02 09:40:20 2024 +0200
@@ -400,17 +400,38 @@
                          attachment.compressionType, attachment.compressedSize, attachment.compressedHash, "", revision);
   }
 
-#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 0)
-  void IndexBackend::AddAttachment2(DatabaseManager& manager,
-                                   int64_t id,
-                                   const OrthancPluginAttachment2& attachment,
-                                   int64_t revision)
+#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 6)
+  void IndexBackend::AddAttachment(Orthanc::DatabasePluginMessages::TransactionResponse& response,
+                                   DatabaseManager& manager,
+                                   const Orthanc::DatabasePluginMessages::AddAttachment_Request& request)
   {
     assert(HasRevisionsSupport() && HasAttachmentCustomDataSupport()); // all plugins supports these features now
-    ExecuteAddAttachment(manager, id, attachment.uuid, attachment.contentType, attachment.uncompressedSize, attachment.uncompressedHash,
-                         attachment.compressionType, attachment.compressedSize, attachment.compressedHash, attachment.customData, revision);
+    ExecuteAddAttachment(manager, 
+                         request.id(), 
+                         request.attachment().uuid().c_str(),
+                         request.attachment().content_type(),
+                         request.attachment().uncompressed_size(),
+                         request.attachment().uncompressed_hash().c_str(),
+                         request.attachment().compression_type(),
+                         request.attachment().compressed_size(),
+                         request.attachment().compressed_hash().c_str(),
+                         request.attachment().custom_data().c_str(),
+                         request.revision());
   }
 #endif
+
+
+// #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 6)
+//   void IndexBackend::AddAttachment2(DatabaseManager& manager,
+//                                    int64_t id,
+//                                    const OrthancPluginAttachment2& attachment,
+//                                    int64_t revision)
+//   {
+//     assert(HasRevisionsSupport() && HasAttachmentCustomDataSupport()); // all plugins supports these features now
+//     ExecuteAddAttachment(manager, id, attachment.uuid, attachment.contentType, attachment.uncompressedSize, attachment.uncompressedHash,
+//                          attachment.compressionType, attachment.compressedSize, attachment.compressedHash, attachment.customData, revision);
+//   }
+// #endif
     
   void IndexBackend::AttachChild(DatabaseManager& manager,
                                  int64_t parent,