Mercurial > hg > orthanc
comparison 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 |
comparison
equal
deleted
inserted
replaced
2654:761031029aa9 | 2655:c196d76cb8fa |
---|---|
116 void SystemCallOperation::Serialize(Json::Value& result) const | 116 void SystemCallOperation::Serialize(Json::Value& result) const |
117 { | 117 { |
118 result = Json::objectValue; | 118 result = Json::objectValue; |
119 result["Type"] = "SystemCall"; | 119 result["Type"] = "SystemCall"; |
120 result["Command"] = command_; | 120 result["Command"] = command_; |
121 IJobUnserializer::WriteArrayOfStrings(result, preArguments_, "PreArguments"); | |
122 IJobUnserializer::WriteArrayOfStrings(result, postArguments_, "PostArguments"); | |
123 } | |
121 | 124 |
122 Json::Value tmp; | |
123 | 125 |
124 tmp = Json::arrayValue; | 126 SystemCallOperation::SystemCallOperation(const Json::Value& serialized) |
125 for (size_t i = 0; i < preArguments_.size(); i++) | 127 { |
128 if (IJobUnserializer::ReadString(serialized, "Type") != "SystemCall") | |
126 { | 129 { |
127 tmp.append(preArguments_[i]); | 130 throw OrthancException(ErrorCode_BadFileFormat); |
128 } | 131 } |
129 | 132 |
130 result["PreArguments"] = tmp; | 133 command_ = IJobUnserializer::ReadString(serialized, "Command"); |
131 | 134 IJobUnserializer::ReadArrayOfStrings(preArguments_, serialized, "PreArguments"); |
132 tmp = Json::arrayValue; | 135 IJobUnserializer::ReadArrayOfStrings(postArguments_, serialized, "PostArguments"); |
133 for (size_t i = 0; i < postArguments_.size(); i++) | |
134 { | |
135 tmp.append(postArguments_[i]); | |
136 } | |
137 | |
138 result["PostArguments"] = tmp; | |
139 } | 136 } |
140 } | 137 } |
141 |