changeset 5120:a6fa660ec26e

/system: added MaximumStorageMode and MaximumStorageSize
author Alain Mazy <am@osimis.io>
date Fri, 16 Dec 2022 13:10:35 +0100
parents bdec57f3cbf2
children 77e20ce39d6f 6f41d47ef994
files NEWS OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp OrthancServer/Sources/Search/DatabaseLookup.cpp
diffstat 3 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Wed Dec 14 11:50:43 2022 +0100
+++ b/NEWS	Fri Dec 16 13:10:35 2022 +0100
@@ -27,7 +27,7 @@
   from the configuration file for a specific operation.
 * /tools/metrics-prometheus: added orthanc_last_change and orthanc_up_time_s
 * Tolerance for "image/jpg" MIME type instead of "image/jpeg" in /tools/create-dicom
-
+* /system: added MaximumStorageMode and MaximumStorageSize
 
 OrthancFramework (C++)
 ----------------------
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp	Wed Dec 14 11:50:43 2022 +0100
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp	Fri Dec 16 13:10:35 2022 +0100
@@ -77,7 +77,9 @@
     static const char* const STORAGE_COMPRESSION = "StorageCompression";
     static const char* const OVERWRITE_INSTANCES = "OverwriteInstances";
     static const char* const INGEST_TRANSCODING = "IngestTranscoding";
-    
+    static const char* const MAXIMUM_STORAGE_SIZE = "MaximumStorageSize";
+    static const char* const MAXIMUM_STORAGE_MODE = "MaximumStorageMode";
+
     if (call.IsDocumentation())
     {
       call.GetDocumentation()
@@ -113,6 +115,10 @@
                         "Whether instances are overwritten when re-ingested (new in Orthanc 1.11.0)")
         .SetAnswerField(INGEST_TRANSCODING, RestApiCallDocumentation::Type_String,
                         "Whether instances are transcoded when ingested into Orthanc (`""` if no transcoding is performed) (new in Orthanc 1.11.0)")
+        .SetAnswerField(MAXIMUM_STORAGE_SIZE, RestApiCallDocumentation::Type_Number,
+                        "The configured MaximumStorageSize in MB (new in Orthanc 1.11.3)")
+        .SetAnswerField(MAXIMUM_STORAGE_MODE, RestApiCallDocumentation::Type_String,
+                        "The configured MaximumStorageMode (new in Orthanc 1.11.3)")
         .SetHttpGetSample("https://demo.orthanc-server.com/system", true);
       return;
     }
@@ -137,6 +143,8 @@
       result[OVERWRITE_INSTANCES] = lock.GetConfiguration().GetBooleanParameter(OVERWRITE_INSTANCES, false); // New in Orthanc 1.11.0
       result[INGEST_TRANSCODING] = lock.GetConfiguration().GetStringParameter(INGEST_TRANSCODING, ""); // New in Orthanc 1.11.0
       result[DATABASE_SERVER_IDENTIFIER] = lock.GetConfiguration().GetDatabaseServerIdentifier();
+      result[MAXIMUM_STORAGE_SIZE] = lock.GetConfiguration().GetUnsignedIntegerParameter(MAXIMUM_STORAGE_SIZE, 0); // New in Orthanc 1.11.3
+      result[MAXIMUM_STORAGE_MODE] = lock.GetConfiguration().GetStringParameter(MAXIMUM_STORAGE_MODE, "Recycle"); // New in Orthanc 1.11.3
     }
 
     result[STORAGE_AREA_PLUGIN] = Json::nullValue;
--- a/OrthancServer/Sources/Search/DatabaseLookup.cpp	Wed Dec 14 11:50:43 2022 +0100
+++ b/OrthancServer/Sources/Search/DatabaseLookup.cpp	Fri Dec 16 13:10:35 2022 +0100
@@ -113,6 +113,14 @@
                                         (*element, DicomToJsonFlags_None, 
                                          0, encoding, hasCodeExtensions, ignoreTagLength));
 
+      if (tag.getGroup() == 64 && tag.getElement() == 2)
+      {
+        constraints_[i]->IsMatch(value->GetContent());
+      }
+      if (tag.getGroup() == 64 && tag.getElement() == 3)
+      {
+        constraints_[i]->IsMatch(value->GetContent());
+      }
       // WARNING: Also modify "HierarchicalMatcher::Setup()" if modifying this code
       if (value.get() == NULL ||
           value->IsNull())