diff Core/DicomNetworking/DicomUserConnection.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 c85808adf04a
children c1e2b91c2ab4
line wrap: on
line diff
--- a/Core/DicomNetworking/DicomUserConnection.cpp	Mon Jan 20 19:09:49 2020 +0100
+++ b/Core/DicomNetworking/DicomUserConnection.cpp	Tue Jan 21 12:53:03 2020 +0100
@@ -1541,7 +1541,7 @@
 
   
   void DicomUserConnection::RequestStorageCommitment(
-    std::string& transactionUid,
+    const std::string& transactionUid,
     const std::vector<std::string>& sopClassUids,
     const std::vector<std::string>& sopInstanceUids)
   {
@@ -1550,6 +1550,12 @@
       throw OrthancException(ErrorCode_ParameterOutOfRange);
     }
 
+    if (transactionUid.size() < 5 ||
+        transactionUid.substr(0, 5) != "2.25.")
+    {
+      throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
+
     if (IsOpen())
     {
       Close();
@@ -1559,8 +1565,6 @@
     {
       OpenInternal(Mode_RequestStorageCommitment);
 
-      transactionUid = Toolbox::GenerateDicomPrivateUniqueIdentifier();
-
       /**
        * N-ACTION
        * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part04/sect_J.3.2.html
@@ -1575,7 +1579,8 @@
        **/
 
       LOG(INFO) << "Request to modality \"" << remoteAet_
-                << "\" about storage commitment for " << sopClassUids.size() << " instances";
+                << "\" about storage commitment for " << sopClassUids.size()
+                << " instances, with transaction UID: " << transactionUid;
       const DIC_US messageId = pimpl_->assoc_->nextMsgID++;
       
       {