changeset 3375:73d60d80a74a

merge
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 14 May 2019 16:38:20 +0200
parents d0d6bd633e4c (diff) 4a8e8a96b233 (current diff)
children 56ea9c476dba
files
diffstat 4 files changed, 27 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Core/JobsEngine/SetOfInstancesJob.cpp	Tue May 14 13:47:35 2019 +0200
+++ b/Core/JobsEngine/SetOfInstancesJob.cpp	Tue May 14 16:38:20 2019 +0200
@@ -193,17 +193,22 @@
   }
 
 
+  static const char* KEY_TRAILING_STEP = "TrailingStep";
+  static const char* KEY_FAILED_INSTANCES = "FailedInstances";
+  static const char* KEY_PARENT_RESOURCES = "ParentResources";
+
   void SetOfInstancesJob::GetPublicContent(Json::Value& target)
   {
     SetOfCommandsJob::GetPublicContent(target);
     target["InstancesCount"] = static_cast<uint32_t>(GetInstancesCount());
     target["FailedInstancesCount"] = static_cast<uint32_t>(failedInstances_.size());
-  }    
-
 
+    if (!parentResources_.empty())
+    {
+      SerializationToolbox::WriteSetOfStrings(target, parentResources_, KEY_PARENT_RESOURCES);
+    }
+  }
 
-  static const char* KEY_TRAILING_STEP = "TrailingStep";
-  static const char* KEY_FAILED_INSTANCES = "FailedInstances";
 
   bool SetOfInstancesJob::Serialize(Json::Value& target) 
   {
@@ -211,6 +216,7 @@
     {
       target[KEY_TRAILING_STEP] = hasTrailingStep_;
       SerializationToolbox::WriteSetOfStrings(target, failedInstances_, KEY_FAILED_INSTANCES);
+      SerializationToolbox::WriteSetOfStrings(target, parentResources_, KEY_PARENT_RESOURCES);
       return true;
     }
     else
@@ -225,6 +231,12 @@
   {
     SerializationToolbox::ReadSetOfStrings(failedInstances_, source, KEY_FAILED_INSTANCES);
 
+    if (source.isMember(KEY_PARENT_RESOURCES))
+    {
+      // Backward compatibility with Orthanc <= 1.5.6
+      SerializationToolbox::ReadSetOfStrings(parentResources_, source, KEY_PARENT_RESOURCES);
+    }
+    
     if (source.isMember(KEY_TRAILING_STEP))
     {
       hasTrailingStep_ = SerializationToolbox::ReadBoolean(source, KEY_TRAILING_STEP);
--- a/Core/JobsEngine/SetOfInstancesJob.h	Tue May 14 13:47:35 2019 +0200
+++ b/Core/JobsEngine/SetOfInstancesJob.h	Tue May 14 16:38:20 2019 +0200
@@ -49,6 +49,7 @@
     
     bool                   hasTrailingStep_;
     std::set<std::string>  failedInstances_;
+    std::set<std::string>  parentResources_;
 
   protected:
     virtual bool HandleInstance(const std::string& instance) = 0;
@@ -63,6 +64,13 @@
 
     SetOfInstancesJob(const Json::Value& source);  // Unserialization
 
+    // Only used for reporting in the public content
+    // https://groups.google.com/d/msg/orthanc-users/9GCV88GLEzw/6wAgP_PRAgAJ
+    void AddParentResource(const std::string& resource)
+    {
+      parentResources_.insert(resource);
+    }
+    
     void AddInstance(const std::string& instance);
 
     void AddTrailingStep(); 
--- a/NEWS	Tue May 14 13:47:35 2019 +0200
+++ b/NEWS	Tue May 14 16:38:20 2019 +0200
@@ -7,6 +7,7 @@
 
 * "/modalities/{id}/query": New argument "Normalize" can be set to "false"
   to bypass the automated correction of outgoing C-FIND queries
+* Reporting of "ParentResources" in "DicomModalityStore" and "DicomModalityStore" jobs
 
 Maintenance
 -----------
--- a/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp	Tue May 14 13:47:35 2019 +0200
+++ b/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp	Tue May 14 16:38:20 2019 +0200
@@ -927,6 +927,8 @@
                                "This string is not a valid Orthanc identifier: " + stripped);
       }
 
+      job.AddParentResource(stripped);  // New in Orthanc 1.5.7
+      
       context.AddChildInstances(job, stripped);
 
       if (logExportedResources)