diff Framework/Plugins/DatabaseBackendAdapterV3.cpp @ 261:34e2b93a7ac1

implementing interface for revisions in attachments
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 19 Apr 2021 18:47:50 +0200
parents 793bbbe11287
children b0c65094b299
line wrap: on
line diff
--- a/Framework/Plugins/DatabaseBackendAdapterV3.cpp	Mon Apr 19 16:45:15 2021 +0200
+++ b/Framework/Plugins/DatabaseBackendAdapterV3.cpp	Mon Apr 19 18:47:50 2021 +0200
@@ -1118,14 +1118,15 @@
 
   static OrthancPluginErrorCode AddAttachment(OrthancPluginDatabaseTransaction* transaction,
                                               int64_t id,
-                                              const OrthancPluginAttachment* attachment)
+                                              const OrthancPluginAttachment* attachment,
+                                              int64_t revision)
   {
     DatabaseBackendAdapterV3::Transaction* t = reinterpret_cast<DatabaseBackendAdapterV3::Transaction*>(transaction);
 
     try
     {
       t->GetOutput().Clear();
-      t->GetBackend().AddAttachment(t->GetManager(), id, *attachment);
+      t->GetBackend().AddAttachment(t->GetManager(), id, *attachment, revision);
       return OrthancPluginErrorCode_Success;
     }
     ORTHANC_PLUGINS_DATABASE_CATCH(t->GetBackend().GetContext());
@@ -1669,6 +1670,7 @@
 
 
   static OrthancPluginErrorCode LookupAttachment(OrthancPluginDatabaseTransaction* transaction,
+                                                 int64_t* revision /* out */,
                                                  int64_t resourceId,
                                                  int32_t contentType)
   {
@@ -1677,7 +1679,7 @@
     try
     {
       t->GetOutput().Clear();
-      t->GetBackend().LookupAttachment(t->GetOutput(), t->GetManager(), resourceId, contentType);
+      t->GetBackend().LookupAttachment(t->GetOutput(), *revision, t->GetManager(), resourceId, contentType);
       return OrthancPluginErrorCode_Success;
     }
     ORTHANC_PLUGINS_DATABASE_CATCH(t->GetBackend().GetContext());
@@ -2007,7 +2009,6 @@
     params.rollback = Rollback;
     params.commit = Commit;
 
-    params.addAttachment = AddAttachment;
     params.clearChanges = ClearChanges;
     params.clearExportedResources = ClearExportedResources;
     params.clearMainDicomTags = ClearMainDicomTags;
@@ -2028,8 +2029,8 @@
     params.getLastExportedResource = GetLastExportedResource;
     params.getMainDicomTags = GetMainDicomTags;
     params.getPublicId = GetPublicId;
+    params.getResourceType = GetResourceType;
     params.getResourcesCount = GetResourcesCount;
-    params.getResourceType = GetResourceType;
     params.getTotalCompressedSize = GetTotalCompressedSize;
     params.getTotalUncompressedSize = GetTotalUncompressedSize;
     params.isDiskSizeAbove = IsDiskSizeAbove;
@@ -2043,10 +2044,11 @@
     params.lookupMetadata = LookupMetadata;
     params.lookupParent = LookupParent;
     params.lookupResource = LookupResource;
+    params.lookupResourceAndParent = LookupResourceAndParent;
     params.lookupResources = LookupResources;
-    params.lookupResourceAndParent = LookupResourceAndParent;
     params.selectPatientToRecycle = SelectPatientToRecycle;
     params.selectPatientToRecycle2 = SelectPatientToRecycle2;
+    params.setAttachment = AddAttachment;
     params.setGlobalProperty = SetGlobalProperty;
     params.setMetadata = SetMetadata;
     params.setProtectedPatient = SetProtectedPatient;