diff OrthancServer/Scheduler/ModifyInstanceCommand.cpp @ 1572:904096e7367e

More information about the origin request in OnStoredInstance() callbacks
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 Aug 2015 12:10:12 +0200
parents f967bdf8534e
children 0a2ad4a6858f
line wrap: on
line diff
--- a/OrthancServer/Scheduler/ModifyInstanceCommand.cpp	Tue Aug 25 11:04:19 2015 +0200
+++ b/OrthancServer/Scheduler/ModifyInstanceCommand.cpp	Tue Aug 25 12:10:12 2015 +0200
@@ -37,8 +37,10 @@
 namespace Orthanc
 {
   ModifyInstanceCommand::ModifyInstanceCommand(ServerContext& context,
+                                               RequestOrigin origin,
                                                const DicomModification& modification) :
     context_(context),
+    origin_(origin),
     modification_(modification)
   {
     modification_.SetAllowManualIdentifiers(true);
@@ -59,6 +61,12 @@
     {
       modification_.SetLevel(ResourceType_Instance);
     }
+
+    if (origin_ != RequestOrigin_Lua)
+    {
+      // TODO If issued from HTTP, "remoteIp" and "username" must be provided
+      throw OrthancException(ErrorCode_NotImplemented);
+    }
   }
 
 
@@ -82,6 +90,8 @@
         modification_.Apply(*modified);
 
         DicomInstanceToStore toStore;
+        assert(origin_ == RequestOrigin_Lua);
+        toStore.SetLuaOrigin();
         toStore.SetParsedDicomFile(*modified);
         // TODO other metadata
         toStore.AddMetadata(ResourceType_Instance, MetadataType_ModifiedFrom, *it);