Mercurial > hg > orthanc
diff OrthancServer/ServerJobs/Operations/SystemCallOperation.cpp @ 2655:c196d76cb8fa jobs
serialization
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 05 Jun 2018 17:57:49 +0200 |
parents | 761031029aa9 |
children | a6d3e45eeff5 |
line wrap: on
line diff
--- a/OrthancServer/ServerJobs/Operations/SystemCallOperation.cpp Tue Jun 05 17:09:18 2018 +0200 +++ b/OrthancServer/ServerJobs/Operations/SystemCallOperation.cpp Tue Jun 05 17:57:49 2018 +0200 @@ -118,24 +118,20 @@ result = Json::objectValue; result["Type"] = "SystemCall"; result["Command"] = command_; + IJobUnserializer::WriteArrayOfStrings(result, preArguments_, "PreArguments"); + IJobUnserializer::WriteArrayOfStrings(result, postArguments_, "PostArguments"); + } - Json::Value tmp; - tmp = Json::arrayValue; - for (size_t i = 0; i < preArguments_.size(); i++) + SystemCallOperation::SystemCallOperation(const Json::Value& serialized) + { + if (IJobUnserializer::ReadString(serialized, "Type") != "SystemCall") { - tmp.append(preArguments_[i]); + throw OrthancException(ErrorCode_BadFileFormat); } - result["PreArguments"] = tmp; - - tmp = Json::arrayValue; - for (size_t i = 0; i < postArguments_.size(); i++) - { - tmp.append(postArguments_[i]); - } - - result["PostArguments"] = tmp; + command_ = IJobUnserializer::ReadString(serialized, "Command"); + IJobUnserializer::ReadArrayOfStrings(preArguments_, serialized, "PreArguments"); + IJobUnserializer::ReadArrayOfStrings(postArguments_, serialized, "PostArguments"); } } -