changeset 3666:6e5b3ae8825c storage-commitment

handling of StorageCommitmentFailureReason_ClassInstanceConflict in the default SCP
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 13 Feb 2020 11:34:00 +0100
parents 4c1d2ff7ddd0
children adb6d8b49283
files OrthancServer/ServerJobs/StorageCommitmentScpJob.cpp
diffstat 1 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/ServerJobs/StorageCommitmentScpJob.cpp	Thu Feb 13 10:42:30 2020 +0100
+++ b/OrthancServer/ServerJobs/StorageCommitmentScpJob.cpp	Thu Feb 13 11:34:00 2020 +0100
@@ -275,8 +275,7 @@
     {
       throw OrthancException(ErrorCode_InternalError);
     }
-
-    if (lookupHandler_.get() != NULL)
+    else if (lookupHandler_.get() != NULL)
     {
       return lookupHandler_->Lookup(sopClassUids_[index], sopInstanceUids_[index]);
     }
@@ -285,6 +284,8 @@
       // This is the default implementation of Orthanc (if no storage
       // commitment plugin is installed)
       bool success = false;
+      StorageCommitmentFailureReason reason =
+        StorageCommitmentFailureReason_NoSuchObjectInstance /* 0x0112 == 274 */;
       
       try
       {
@@ -301,10 +302,18 @@
           ServerContext::DicomCacheLocker locker(context_, orthancId[0]);
           if (locker.GetDicom().GetTagValue(a, DICOM_TAG_SOP_CLASS_UID) &&
               locker.GetDicom().GetTagValue(b, DICOM_TAG_SOP_INSTANCE_UID) &&
-              a == sopClassUids_[index] &&
               b == sopInstanceUids_[index])
           {
-            success = true;
+            if (a == sopClassUids_[index])
+            {
+              success = true;
+              reason = StorageCommitmentFailureReason_Success;
+            }
+            else
+            {
+              // Mismatch in the SOP class UID
+              reason = StorageCommitmentFailureReason_ClassInstanceConflict /* 0x0119 */;
+            }
           }
         }
       }
@@ -315,9 +324,7 @@
       LOG(INFO) << "  Storage commitment SCP job: " << (success ? "Success" : "Failure")
                 << " while looking for " << sopClassUids_[index] << " / " << sopInstanceUids_[index];
 
-      return (success ?
-              StorageCommitmentFailureReason_Success : 
-              StorageCommitmentFailureReason_NoSuchObjectInstance /* 0x0112 == 274 */);
+      return reason;
     }
   }