Mercurial > hg > orthanc-databases
comparison Framework/Plugins/DatabaseBackendAdapterV4.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 |
comparison
equal
deleted
inserted
replaced
576:b0533b703c2c | 577:991b9b285e1a |
---|---|
223 attachment->set_uncompressed_size(uncompressedSize); | 223 attachment->set_uncompressed_size(uncompressedSize); |
224 attachment->set_uncompressed_hash(uncompressedHash); | 224 attachment->set_uncompressed_hash(uncompressedHash); |
225 attachment->set_compression_type(compressionType); | 225 attachment->set_compression_type(compressionType); |
226 attachment->set_compressed_size(compressedSize); | 226 attachment->set_compressed_size(compressedSize); |
227 attachment->set_compressed_hash(compressedHash); | 227 attachment->set_compressed_hash(compressedHash); |
228 #if ORTHANC_PLUGINS_HAS_ATTACHMENTS_CUSTOM_DATA == 1 | |
229 attachment->set_custom_data(customData); | |
230 #endif | |
228 } | 231 } |
229 | 232 |
230 virtual void SignalDeletedResource(const std::string& publicId, | 233 virtual void SignalDeletedResource(const std::string& publicId, |
231 OrthancPluginResourceType resourceType) ORTHANC_OVERRIDE | 234 OrthancPluginResourceType resourceType) ORTHANC_OVERRIDE |
232 { | 235 { |
286 lookupAttachment_->mutable_attachment()->set_uncompressed_size(uncompressedSize); | 289 lookupAttachment_->mutable_attachment()->set_uncompressed_size(uncompressedSize); |
287 lookupAttachment_->mutable_attachment()->set_uncompressed_hash(uncompressedHash); | 290 lookupAttachment_->mutable_attachment()->set_uncompressed_hash(uncompressedHash); |
288 lookupAttachment_->mutable_attachment()->set_compression_type(compressionType); | 291 lookupAttachment_->mutable_attachment()->set_compression_type(compressionType); |
289 lookupAttachment_->mutable_attachment()->set_compressed_size(compressedSize); | 292 lookupAttachment_->mutable_attachment()->set_compressed_size(compressedSize); |
290 lookupAttachment_->mutable_attachment()->set_compressed_hash(compressedHash); | 293 lookupAttachment_->mutable_attachment()->set_compressed_hash(compressedHash); |
294 #if ORTHANC_PLUGINS_HAS_ATTACHMENTS_CUSTOM_DATA==1 | |
295 lookupAttachment_->mutable_attachment()->set_custom_data(customData); | |
296 #endif | |
291 } | 297 } |
292 else | 298 else |
293 { | 299 { |
294 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); | 300 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); |
295 } | 301 } |
682 break; | 688 break; |
683 } | 689 } |
684 | 690 |
685 case Orthanc::DatabasePluginMessages::OPERATION_ADD_ATTACHMENT: | 691 case Orthanc::DatabasePluginMessages::OPERATION_ADD_ATTACHMENT: |
686 { | 692 { |
693 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 6) | |
694 backend.AddAttachment(response, manager, request.add_attachment()); | |
695 #else | |
687 OrthancPluginAttachment attachment; | 696 OrthancPluginAttachment attachment; |
688 attachment.uuid = request.add_attachment().attachment().uuid().c_str(); | 697 attachment.uuid = request.add_attachment().attachment().uuid().c_str(); |
689 attachment.contentType = request.add_attachment().attachment().content_type(); | 698 attachment.contentType = request.add_attachment().attachment().content_type(); |
690 attachment.uncompressedSize = request.add_attachment().attachment().uncompressed_size(); | 699 attachment.uncompressedSize = request.add_attachment().attachment().uncompressed_size(); |
691 attachment.uncompressedHash = request.add_attachment().attachment().uncompressed_hash().c_str(); | 700 attachment.uncompressedHash = request.add_attachment().attachment().uncompressed_hash().c_str(); |
692 attachment.compressionType = request.add_attachment().attachment().compression_type(); | 701 attachment.compressionType = request.add_attachment().attachment().compression_type(); |
693 attachment.compressedSize = request.add_attachment().attachment().compressed_size(); | 702 attachment.compressedSize = request.add_attachment().attachment().compressed_size(); |
694 attachment.compressedHash = request.add_attachment().attachment().compressed_hash().c_str(); | 703 attachment.compressedHash = request.add_attachment().attachment().compressed_hash().c_str(); |
695 | 704 |
696 backend.AddAttachment(manager, request.add_attachment().id(), attachment, request.add_attachment().revision()); | 705 backend.AddAttachment(manager, request.add_attachment().id(), attachment, request.add_attachment().revision()); |
697 break; | 706 #endif |
698 } | 707 break; |
699 | 708 } |
700 case Orthanc::DatabasePluginMessages::OPERATION_CLEAR_CHANGES: | 709 case Orthanc::DatabasePluginMessages::OPERATION_CLEAR_CHANGES: |
701 { | 710 { |
702 backend.ClearChanges(manager); | 711 backend.ClearChanges(manager); |
703 break; | 712 break; |
704 } | 713 } |