changeset 2869:2bd87764709c

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 08 Oct 2018 17:20:44 +0200
parents abce036683cd
children 716dd24974ef
files OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp
diffstat 1 files changed, 4 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp	Mon Oct 08 17:05:19 2018 +0200
+++ b/OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp	Mon Oct 08 17:20:44 2018 +0200
@@ -628,11 +628,9 @@
     }
 
     const std::string study = call.GetUriComponent("id", "");
-    int priority = Toolbox::GetJsonIntegerField(request, "Priority", 0);
 
     std::auto_ptr<SplitStudyJob> job(new SplitStudyJob(context, study));    
     job->SetOrigin(call);
-    job->SetDescription("REST API");
 
     std::vector<std::string> series;
     SerializationToolbox::ReadArrayOfStrings(series, request, "Series");
@@ -696,12 +694,8 @@
       }
     }
 
-    std::string id;
-    context.GetJobsEngine().GetRegistry().Submit(id, job.release(), priority);
-    
-    Json::Value v;
-    v["ID"] = id;
-    call.GetOutput().AnswerJson(v);
+    OrthancRestApi::GetApi(call).SubmitCommandsJob
+      (call, job.release(), true /* synchronous by default */, request);
   }
 
 
@@ -717,11 +711,9 @@
     }
 
     const std::string study = call.GetUriComponent("id", "");
-    int priority = Toolbox::GetJsonIntegerField(request, "Priority", 0);
 
     std::auto_ptr<MergeStudyJob> job(new MergeStudyJob(context, study));    
     job->SetOrigin(call);
-    job->SetDescription("REST API");
 
     std::vector<std::string> resources;
     SerializationToolbox::ReadArrayOfStrings(resources, request, "Resources");
@@ -739,12 +731,8 @@
       job->SetKeepSource(SerializationToolbox::ReadBoolean(request, KEEP_SOURCE));
     }
 
-    std::string id;
-    context.GetJobsEngine().GetRegistry().Submit(id, job.release(), priority);
-    
-    Json::Value v;
-    v["ID"] = id;
-    call.GetOutput().AnswerJson(v);
+    OrthancRestApi::GetApi(call).SubmitCommandsJob
+      (call, job.release(), true /* synchronous by default */, request);
   }