comparison Core/JobsEngine/JobInfo.cpp @ 2589:a3fdfb6979ed jobs

getting rid of ReusableDicomConnection in REST API
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 15 May 2018 16:10:03 +0200
parents 3372c5255333
children 7b72061157b1
comparison
equal deleted inserted replaced
2587:bf14b037731f 2589:a3fdfb6979ed
114 throw OrthancException(ErrorCode_BadSequenceOfCalls); 114 throw OrthancException(ErrorCode_BadSequenceOfCalls);
115 } 115 }
116 } 116 }
117 117
118 118
119 void JobInfo::Serialize(Json::Value& target) const 119 void JobInfo::Serialize(Json::Value& target,
120 bool includeInternalContent) const
120 { 121 {
121 target = Json::objectValue; 122 target = Json::objectValue;
122 target["ID"] = id_; 123 target["ID"] = id_;
123 target["Priority"] = priority_; 124 target["Priority"] = priority_;
124 target["ErrorCode"] = static_cast<int>(status_.GetErrorCode()); 125 target["ErrorCode"] = static_cast<int>(status_.GetErrorCode());
129 target["EffectiveRuntime"] = static_cast<double>(runtime_.total_milliseconds()) / 1000.0; 130 target["EffectiveRuntime"] = static_cast<double>(runtime_.total_milliseconds()) / 1000.0;
130 target["Progress"] = boost::math::iround(status_.GetProgress() * 100.0f); 131 target["Progress"] = boost::math::iround(status_.GetProgress() * 100.0f);
131 132
132 target["Type"] = status_.GetJobType(); 133 target["Type"] = status_.GetJobType();
133 target["PublicContent"] = status_.GetPublicContent(); 134 target["PublicContent"] = status_.GetPublicContent();
134 target["InternalContent"] = status_.GetInternalContent(); 135
136 if (includeInternalContent)
137 {
138 target["InternalContent"] = status_.GetInternalContent();
139 }
135 140
136 if (HasEstimatedTimeOfArrival()) 141 if (HasEstimatedTimeOfArrival())
137 { 142 {
138 target["EstimatedTimeOfArrival"] = boost::posix_time::to_iso_string(GetEstimatedTimeOfArrival()); 143 target["EstimatedTimeOfArrival"] = boost::posix_time::to_iso_string(GetEstimatedTimeOfArrival());
139 } 144 }