comparison OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp @ 4627:f7d5372b59b3 db-changes

handling revisions of attachments
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 20 Apr 2021 15:11:59 +0200
parents 95ffe3b6ef7c
children f0038043fb97 7053502fbf97
comparison
equal deleted inserted replaced
4626:686f189a903d 4627:f7d5372b59b3
649 } 649 }
650 } 650 }
651 651
652 652
653 virtual void AddAttachment(int64_t id, 653 virtual void AddAttachment(int64_t id,
654 const FileInfo& attachment) ORTHANC_OVERRIDE 654 const FileInfo& attachment,
655 { 655 int64_t revision) ORTHANC_OVERRIDE
656 {
657 // "revision" is not used, as it was added in Orthanc 1.9.2
656 OrthancPluginAttachment tmp; 658 OrthancPluginAttachment tmp;
657 tmp.uuid = attachment.GetUuid().c_str(); 659 tmp.uuid = attachment.GetUuid().c_str();
658 tmp.contentType = static_cast<int32_t>(attachment.GetContentType()); 660 tmp.contentType = static_cast<int32_t>(attachment.GetContentType());
659 tmp.uncompressedSize = attachment.GetUncompressedSize(); 661 tmp.uncompressedSize = attachment.GetUncompressedSize();
660 tmp.uncompressedHash = attachment.GetUncompressedMD5().c_str(); 662 tmp.uncompressedHash = attachment.GetUncompressedMD5().c_str();
1102 CheckSuccess(that_.backend_.logExportedResource(that_.payload_, &tmp)); 1104 CheckSuccess(that_.backend_.logExportedResource(that_.payload_, &tmp));
1103 } 1105 }
1104 1106
1105 1107
1106 virtual bool LookupAttachment(FileInfo& attachment, 1108 virtual bool LookupAttachment(FileInfo& attachment,
1109 int64_t& revision,
1107 int64_t id, 1110 int64_t id,
1108 FileContentType contentType) ORTHANC_OVERRIDE 1111 FileContentType contentType) ORTHANC_OVERRIDE
1109 { 1112 {
1110 ResetAnswers(); 1113 ResetAnswers();
1111 1114
1112 CheckSuccess(that_.backend_.lookupAttachment 1115 CheckSuccess(that_.backend_.lookupAttachment
1113 (that_.GetContext(), that_.payload_, id, static_cast<int32_t>(contentType))); 1116 (that_.GetContext(), that_.payload_, id, static_cast<int32_t>(contentType)));
1117
1118 revision = 0; // Dummy value, as revisions were added in Orthanc 1.9.2
1114 1119
1115 if (type_ == _OrthancPluginDatabaseAnswerType_None) 1120 if (type_ == _OrthancPluginDatabaseAnswerType_None)
1116 { 1121 {
1117 return false; 1122 return false;
1118 } 1123 }