comparison Core/DicomNetworking/RemoteModalityParameters.cpp @ 3602:085283445db0 storage-commitment

AllowNAction in remote modality parameters
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 16 Jan 2020 15:28:32 +0100
parents 4e43e67f8ecf
children c1e2b91c2ab4
comparison
equal deleted inserted replaced
3601:a77e7839012a 3602:085283445db0
46 static const char* KEY_ALLOW_ECHO = "AllowEcho"; 46 static const char* KEY_ALLOW_ECHO = "AllowEcho";
47 static const char* KEY_ALLOW_FIND = "AllowFind"; 47 static const char* KEY_ALLOW_FIND = "AllowFind";
48 static const char* KEY_ALLOW_GET = "AllowGet"; 48 static const char* KEY_ALLOW_GET = "AllowGet";
49 static const char* KEY_ALLOW_MOVE = "AllowMove"; 49 static const char* KEY_ALLOW_MOVE = "AllowMove";
50 static const char* KEY_ALLOW_STORE = "AllowStore"; 50 static const char* KEY_ALLOW_STORE = "AllowStore";
51 static const char* KEY_ALLOW_N_ACTION = "AllowNAction";
51 static const char* KEY_HOST = "Host"; 52 static const char* KEY_HOST = "Host";
52 static const char* KEY_MANUFACTURER = "Manufacturer"; 53 static const char* KEY_MANUFACTURER = "Manufacturer";
53 static const char* KEY_PORT = "Port"; 54 static const char* KEY_PORT = "Port";
54 55
55 56
64 allowEcho_ = true; 65 allowEcho_ = true;
65 allowStore_ = true; 66 allowStore_ = true;
66 allowFind_ = true; 67 allowFind_ = true;
67 allowMove_ = true; 68 allowMove_ = true;
68 allowGet_ = true; 69 allowGet_ = true;
70 allowNAction_ = true; // For storage commitment
69 } 71 }
70 72
71 73
72 RemoteModalityParameters::RemoteModalityParameters(const std::string& aet, 74 RemoteModalityParameters::RemoteModalityParameters(const std::string& aet,
73 const std::string& host, 75 const std::string& host,
209 211
210 if (serialized.isMember(KEY_ALLOW_MOVE)) 212 if (serialized.isMember(KEY_ALLOW_MOVE))
211 { 213 {
212 allowMove_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_MOVE); 214 allowMove_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_MOVE);
213 } 215 }
216
217 if (serialized.isMember(KEY_ALLOW_N_ACTION))
218 {
219 allowNAction_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_N_ACTION);
220 }
214 } 221 }
215 222
216 223
217 bool RemoteModalityParameters::IsRequestAllowed(DicomRequestType type) const 224 bool RemoteModalityParameters::IsRequestAllowed(DicomRequestType type) const
218 { 225 {
231 return allowMove_; 238 return allowMove_;
232 239
233 case DicomRequestType_Store: 240 case DicomRequestType_Store:
234 return allowStore_; 241 return allowStore_;
235 242
243 case DicomRequestType_NAction:
244 return allowNAction_;
245
236 default: 246 default:
237 throw OrthancException(ErrorCode_ParameterOutOfRange); 247 throw OrthancException(ErrorCode_ParameterOutOfRange);
238 } 248 }
239 } 249 }
240 250
260 allowMove_ = allowed; 270 allowMove_ = allowed;
261 break; 271 break;
262 272
263 case DicomRequestType_Store: 273 case DicomRequestType_Store:
264 allowStore_ = allowed; 274 allowStore_ = allowed;
275 break;
276
277 case DicomRequestType_NAction:
278 allowNAction_ = allowed;
265 break; 279 break;
266 280
267 default: 281 default:
268 throw OrthancException(ErrorCode_ParameterOutOfRange); 282 throw OrthancException(ErrorCode_ParameterOutOfRange);
269 } 283 }
274 { 288 {
275 return (!allowEcho_ || 289 return (!allowEcho_ ||
276 !allowStore_ || 290 !allowStore_ ||
277 !allowFind_ || 291 !allowFind_ ||
278 !allowGet_ || 292 !allowGet_ ||
279 !allowMove_); 293 !allowMove_ ||
294 !allowNAction_);
280 } 295 }
281 296
282 297
283 void RemoteModalityParameters::Serialize(Json::Value& target, 298 void RemoteModalityParameters::Serialize(Json::Value& target,
284 bool forceAdvancedFormat) const 299 bool forceAdvancedFormat) const
294 target[KEY_ALLOW_ECHO] = allowEcho_; 309 target[KEY_ALLOW_ECHO] = allowEcho_;
295 target[KEY_ALLOW_STORE] = allowStore_; 310 target[KEY_ALLOW_STORE] = allowStore_;
296 target[KEY_ALLOW_FIND] = allowFind_; 311 target[KEY_ALLOW_FIND] = allowFind_;
297 target[KEY_ALLOW_GET] = allowGet_; 312 target[KEY_ALLOW_GET] = allowGet_;
298 target[KEY_ALLOW_MOVE] = allowMove_; 313 target[KEY_ALLOW_MOVE] = allowMove_;
314 target[KEY_ALLOW_N_ACTION] = allowNAction_;
299 } 315 }
300 else 316 else
301 { 317 {
302 target = Json::arrayValue; 318 target = Json::arrayValue;
303 target.append(GetApplicationEntityTitle()); 319 target.append(GetApplicationEntityTitle());