changeset 260:793bbbe11287

IDatabaseBackend::HasRevisionsSupport()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 19 Apr 2021 16:45:15 +0200
parents 93a6efd7d8e5
children 34e2b93a7ac1
files Framework/Plugins/DatabaseBackendAdapterV3.cpp Framework/Plugins/IDatabaseBackend.h Framework/Plugins/PluginInitialization.cpp MySQL/Plugins/MySQLIndex.h PostgreSQL/Plugins/PostgreSQLIndex.h SQLite/Plugins/SQLiteIndex.h
diffstat 6 files changed, 29 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Plugins/DatabaseBackendAdapterV3.cpp	Fri Apr 16 17:49:29 2021 +0200
+++ b/Framework/Plugins/DatabaseBackendAdapterV3.cpp	Mon Apr 19 16:45:15 2021 +0200
@@ -24,8 +24,8 @@
 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE)         // Macro introduced in Orthanc 1.3.1
 #  if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 9, 2)
 
+#include <Logging.h>
 #include <MultiThreading/SharedMessageQueue.h>
-
 #include <OrthancException.h>
 
 #include <stdexcept>
@@ -2061,6 +2061,15 @@
       throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, "Unable to register the database backend");
     }
 
+    if (backend->HasRevisionsSupport())
+    {
+      LOG(INFO) << "The database backend *has* support for revisions of metadata and attachments";
+    }
+    else
+    {
+      LOG(WARNING) << "The database backend has *no* support for revisions of metadata and attachments";
+    }
+
     backend->SetOutputFactory(new Factory);
 
     isBackendInUse_ = true;
--- a/Framework/Plugins/IDatabaseBackend.h	Fri Apr 16 17:49:29 2021 +0200
+++ b/Framework/Plugins/IDatabaseBackend.h	Mon Apr 19 16:45:15 2021 +0200
@@ -48,6 +48,8 @@
                         
     virtual IDatabaseBackendOutput* CreateOutput() = 0;
 
+    virtual bool HasRevisionsSupport() const = 0;
+
     virtual void AddAttachment(DatabaseManager& manager,
                                int64_t id,
                                const OrthancPluginAttachment& attachment) = 0;
--- a/Framework/Plugins/PluginInitialization.cpp	Fri Apr 16 17:49:29 2021 +0200
+++ b/Framework/Plugins/PluginInitialization.cpp	Mon Apr 19 16:45:15 2021 +0200
@@ -50,7 +50,8 @@
 #else
     Orthanc::Logging::Initialize(context);
 #endif
-    
+
+    Orthanc::Logging::EnableInfoLevel(true);
     OrthancPlugins::SetGlobalContext(context);
     ImplicitTransaction::SetErrorOnDoubleExecution(false);
 
--- a/MySQL/Plugins/MySQLIndex.h	Fri Apr 16 17:49:29 2021 +0200
+++ b/MySQL/Plugins/MySQLIndex.h	Mon Apr 19 16:45:15 2021 +0200
@@ -45,6 +45,11 @@
 
     virtual void ConfigureDatabase(DatabaseManager& database) ORTHANC_OVERRIDE;
  
+    virtual bool HasRevisionsSupport() const ORTHANC_OVERRIDE
+    {
+      return false;  // TODO - REVISIONS
+    }
+    
     virtual int64_t CreateResource(DatabaseManager& manager,
                                    const char* publicId,
                                    OrthancPluginResourceType type)
--- a/PostgreSQL/Plugins/PostgreSQLIndex.h	Fri Apr 16 17:49:29 2021 +0200
+++ b/PostgreSQL/Plugins/PostgreSQLIndex.h	Mon Apr 19 16:45:15 2021 +0200
@@ -45,6 +45,11 @@
 
     virtual void ConfigureDatabase(DatabaseManager& manager) ORTHANC_OVERRIDE;
 
+    virtual bool HasRevisionsSupport() const ORTHANC_OVERRIDE
+    {
+      return false;  // TODO - REVISIONS
+    }
+    
     virtual int64_t CreateResource(DatabaseManager& manager,
                                    const char* publicId,
                                    OrthancPluginResourceType type)
--- a/SQLite/Plugins/SQLiteIndex.h	Fri Apr 16 17:49:29 2021 +0200
+++ b/SQLite/Plugins/SQLiteIndex.h	Mon Apr 19 16:45:15 2021 +0200
@@ -46,6 +46,11 @@
 
     virtual void ConfigureDatabase(DatabaseManager& manager) ORTHANC_OVERRIDE;
     
+    virtual bool HasRevisionsSupport() const ORTHANC_OVERRIDE
+    {
+      return true;
+    }
+    
     virtual int64_t CreateResource(DatabaseManager& manager,
                                    const char* publicId,
                                    OrthancPluginResourceType type) ORTHANC_OVERRIDE;