Mercurial > hg > orthanc
comparison OrthancServer/OrthancRestApi/OrthancRestModalities.cpp @ 3611:0ce9c1c6474f storage-commitment
test route in REST API for storage commitment
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 21 Jan 2020 12:53:03 +0100 |
parents | 085283445db0 |
children | c1e2b91c2ab4 |
comparison
equal
deleted
inserted
replaced
3610:c85808adf04a | 3611:0ce9c1c6474f |
---|---|
1271 | 1271 |
1272 Json::Value json; | 1272 Json::Value json; |
1273 if (call.ParseJsonRequest(json)) | 1273 if (call.ParseJsonRequest(json)) |
1274 { | 1274 { |
1275 const std::string& localAet = context.GetDefaultLocalApplicationEntityTitle(); | 1275 const std::string& localAet = context.GetDefaultLocalApplicationEntityTitle(); |
1276 RemoteModalityParameters remote = | 1276 const RemoteModalityParameters remote = |
1277 MyGetModalityUsingSymbolicName(call.GetUriComponent("id", "")); | 1277 MyGetModalityUsingSymbolicName(call.GetUriComponent("id", "")); |
1278 | 1278 |
1279 std::auto_ptr<ParsedDicomFile> query | 1279 std::auto_ptr<ParsedDicomFile> query |
1280 (ParsedDicomFile::CreateFromJson(json, static_cast<DicomFromJsonFlags>(0))); | 1280 (ParsedDicomFile::CreateFromJson(json, static_cast<DicomFromJsonFlags>(0))); |
1281 | 1281 |
1287 connection.FindWorklist(answers, *query); | 1287 connection.FindWorklist(answers, *query); |
1288 } | 1288 } |
1289 | 1289 |
1290 Json::Value result; | 1290 Json::Value result; |
1291 answers.ToJson(result, true); | 1291 answers.ToJson(result, true); |
1292 call.GetOutput().AnswerJson(result); | |
1293 } | |
1294 else | |
1295 { | |
1296 throw OrthancException(ErrorCode_BadFileFormat, "Must provide a JSON object"); | |
1297 } | |
1298 } | |
1299 | |
1300 | |
1301 static void TestStorageCommitment(RestApiPostCall& call) | |
1302 { | |
1303 ServerContext& context = OrthancRestApi::GetContext(call); | |
1304 | |
1305 Json::Value json; | |
1306 if (call.ParseJsonRequest(json)) | |
1307 { | |
1308 const std::string& localAet = context.GetDefaultLocalApplicationEntityTitle(); | |
1309 const RemoteModalityParameters remote = | |
1310 MyGetModalityUsingSymbolicName(call.GetUriComponent("id", "")); | |
1311 | |
1312 { | |
1313 DicomUserConnection scu(localAet, remote); | |
1314 | |
1315 std::vector<std::string> sopClassUids, sopInstanceUids; | |
1316 sopClassUids.push_back("a"); | |
1317 sopInstanceUids.push_back("b"); | |
1318 | |
1319 std::string t = Toolbox::GenerateDicomPrivateUniqueIdentifier(); | |
1320 scu.RequestStorageCommitment(t, sopClassUids, sopInstanceUids); | |
1321 } | |
1322 | |
1323 Json::Value result; | |
1292 call.GetOutput().AnswerJson(result); | 1324 call.GetOutput().AnswerJson(result); |
1293 } | 1325 } |
1294 else | 1326 else |
1295 { | 1327 { |
1296 throw OrthancException(ErrorCode_BadFileFormat, "Must provide a JSON object"); | 1328 throw OrthancException(ErrorCode_BadFileFormat, "Must provide a JSON object"); |
1339 Register("/peers/{id}", DeletePeer); | 1371 Register("/peers/{id}", DeletePeer); |
1340 Register("/peers/{id}/store", PeerStore); | 1372 Register("/peers/{id}/store", PeerStore); |
1341 Register("/peers/{id}/system", PeerSystem); | 1373 Register("/peers/{id}/system", PeerSystem); |
1342 | 1374 |
1343 Register("/modalities/{id}/find-worklist", DicomFindWorklist); | 1375 Register("/modalities/{id}/find-worklist", DicomFindWorklist); |
1376 | |
1377 Register("/modalities/{id}/storage-commitment", TestStorageCommitment); | |
1344 } | 1378 } |
1345 } | 1379 } |