changeset 4592:36bbf3169a27 db-changes

comments
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 15 Mar 2021 16:16:42 +0100
parents ff8170d17d90
children 60a860942c5e
files OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp
diffstat 2 files changed, 38 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp	Mon Mar 15 15:30:42 2021 +0100
+++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp	Mon Mar 15 16:16:42 2021 +0100
@@ -119,23 +119,6 @@
 
 
     // From the "ILookupResources" interface
-    void GetAllInternalIds(std::list<int64_t>& target,
-                           ResourceType resourceType) ORTHANC_OVERRIDE
-    {
-      if (that_.extensions_.getAllInternalIds == NULL)
-      {
-        throw OrthancException(ErrorCode_DatabasePlugin,
-                               "The database plugin does not implement the mandatory GetAllInternalIds() extension");
-      }
-
-      that_.ResetAnswers();
-      CheckSuccess(that_.extensions_.getAllInternalIds(that_.GetContext(), that_.payload_, Plugins::Convert(resourceType)));
-      that_.ForwardAnswers(target);
-    }
-
-
-
-    // From the "ILookupResources" interface
     void LookupIdentifier(std::list<int64_t>& result,
                           ResourceType level,
                           const DicomTag& tag,
@@ -160,11 +143,6 @@
     }
 
     
-
-    /**
-     * Implementation of "ITransaction"
-     **/
-    
     virtual void ApplyLookupResources(std::list<std::string>& resourcesId,
                                       std::list<std::string>* instancesId,
                                       const std::vector<DatabaseConstraint>& lookup,
@@ -241,15 +219,6 @@
         }
       }
     }
-
-
-    virtual int64_t CreateResource(const std::string& publicId,
-                                   ResourceType type) ORTHANC_OVERRIDE
-    {
-      int64_t id;
-      CheckSuccess(that_.backend_.createResource(&id, that_.payload_, publicId.c_str(), Plugins::Convert(type)));
-      return id;
-    }
     
 
     virtual void AddAttachment(int64_t id,
@@ -268,6 +237,7 @@
     }
 
 
+    // From the "ICreateInstance" interface
     virtual void AttachChild(int64_t parent,
                              int64_t child) ORTHANC_OVERRIDE
     {
@@ -299,6 +269,16 @@
     }
 
 
+    // From the "ICreateInstance" interface
+    virtual int64_t CreateResource(const std::string& publicId,
+                                   ResourceType type) ORTHANC_OVERRIDE
+    {
+      int64_t id;
+      CheckSuccess(that_.backend_.createResource(&id, that_.payload_, publicId.c_str(), Plugins::Convert(type)));
+      return id;
+    }
+
+
     virtual void DeleteAttachment(int64_t id,
                                   FileContentType attachment) ORTHANC_OVERRIDE
     {
@@ -319,6 +299,23 @@
     }
 
 
+    // From the "ILookupResources" interface
+    void GetAllInternalIds(std::list<int64_t>& target,
+                           ResourceType resourceType) ORTHANC_OVERRIDE
+    {
+      if (that_.extensions_.getAllInternalIds == NULL)
+      {
+        throw OrthancException(ErrorCode_DatabasePlugin,
+                               "The database plugin does not implement the mandatory GetAllInternalIds() extension");
+      }
+
+      that_.ResetAnswers();
+      CheckSuccess(that_.extensions_.getAllInternalIds(that_.GetContext(), that_.payload_, Plugins::Convert(resourceType)));
+      that_.ForwardAnswers(target);
+    }
+
+
+
     virtual void GetAllMetadata(std::map<MetadataType, std::string>& target,
                                 int64_t id) ORTHANC_OVERRIDE
     {
@@ -714,6 +711,7 @@
     }
 
 
+    // From the "ILookupResources" interface
     virtual void LookupIdentifierRange(std::list<int64_t>& result,
                                        ResourceType level,
                                        const DicomTag& tag,
@@ -871,6 +869,7 @@
     }
 
 
+    // From the "ISetResourcesContent" interface
     virtual void SetIdentifierTag(int64_t id,
                                   const DicomTag& tag,
                                   const std::string& value) ORTHANC_OVERRIDE
@@ -884,6 +883,7 @@
     }
 
 
+    // From the "ISetResourcesContent" interface
     virtual void SetMainDicomTag(int64_t id,
                                  const DicomTag& tag,
                                  const std::string& value) ORTHANC_OVERRIDE
@@ -913,6 +913,7 @@
     }
 
 
+    // From the "ISetResourcesContent" interface
     virtual void SetResourcesContent(const Orthanc::ResourcesContent& content) ORTHANC_OVERRIDE
     {
       if (that_.extensions_.setResourcesContent == NULL)
@@ -973,6 +974,7 @@
     }
 
 
+    // From the "ICreateInstance" interface
     virtual void TagMostRecentPatient(int64_t patient) ORTHANC_OVERRIDE
     {
       if (that_.extensions_.tagMostRecentPatient != NULL)
@@ -980,7 +982,6 @@
         CheckSuccess(that_.extensions_.tagMostRecentPatient(that_.payload_, patient));
       }
     }
-
   };
 
 
--- a/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp	Mon Mar 15 15:30:42 2021 +0100
+++ b/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp	Mon Mar 15 16:16:42 2021 +0100
@@ -380,6 +380,7 @@
     }
 
 
+    // From the "ICreateInstance" interface
     virtual void AttachChild(int64_t parent,
                              int64_t child) ORTHANC_OVERRIDE
     {
@@ -429,6 +430,7 @@
     }
 
 
+    // From the "ICreateInstance" interface
     virtual int64_t CreateResource(const std::string& publicId,
                                    ResourceType type) ORTHANC_OVERRIDE
     {
@@ -968,6 +970,7 @@
     }
 
 
+    // From the "ISetResourcesContent" interface
     virtual void SetIdentifierTag(int64_t id,
                                   const DicomTag& tag,
                                   const std::string& value) ORTHANC_OVERRIDE
@@ -1003,6 +1006,7 @@
     }
 
 
+    // From the "ISetResourcesContent" interface
     virtual void SetMainDicomTag(int64_t id,
                                  const DicomTag& tag,
                                  const std::string& value) ORTHANC_OVERRIDE
@@ -1034,6 +1038,7 @@
     }
 
 
+    // From the "ICreateInstance" interface
     virtual void TagMostRecentPatient(int64_t patient) ORTHANC_OVERRIDE
     {
       {