diff OrthancServer/OrthancRestApi/OrthancRestApi.cpp @ 796:e7b1ca0f1e04

creation of dicom files
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 06 May 2014 12:09:11 +0200
parents 5197fd35333c
children a811bdf8b8eb
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi/OrthancRestApi.cpp	Tue May 06 11:01:30 2014 +0200
+++ b/OrthancServer/OrthancRestApi/OrthancRestApi.cpp	Tue May 06 12:09:11 2014 +0200
@@ -32,10 +32,30 @@
 
 #include "OrthancRestApi.h"
 
+#include "../DicomModification.h"
+
 #include <glog/logging.h>
 
 namespace Orthanc
 {
+  void OrthancRestApi::AnswerStoredInstance(RestApi::PostCall& call,
+                                            const std::string& publicId,
+                                            StoreStatus status)
+  {
+    Json::Value result = Json::objectValue;
+
+    if (status != StoreStatus_Failure)
+    {
+      result["ID"] = publicId;
+      result["Path"] = GetBasePath(ResourceType_Instance, publicId);
+    }
+
+    result["Status"] = EnumerationToString(status);
+    call.GetOutput().AnswerJson(result);
+  }
+
+
+
   // Upload of DICOM files through HTTP ---------------------------------------
 
   static void UploadDicomFile(RestApi::PostCall& call)
@@ -52,16 +72,8 @@
 
     std::string publicId;
     StoreStatus status = context.Store(publicId, postData);
-    Json::Value result = Json::objectValue;
 
-    if (status != StoreStatus_Failure)
-    {
-      result["ID"] = publicId;
-      result["Path"] = GetBasePath(ResourceType_Instance, publicId);
-    }
-
-    result["Status"] = EnumerationToString(status);
-    call.GetOutput().AnswerJson(result);
+    OrthancRestApi::GetApi(call).AnswerStoredInstance(call, publicId, status);
   }