changeset 1980:ebce5f456b8e

new error code: ErrorCode_AlreadyExistingTag
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 22 Apr 2016 08:57:33 +0200
parents 9e0f408db796
children 4b545a8b1f95
files Core/Enumerations.cpp Core/Enumerations.h OrthancServer/ParsedDicomFile.cpp OrthancServer/main.cpp Plugins/Include/orthanc/OrthancCPlugin.h Resources/ErrorCodes.json
diffstat 6 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Core/Enumerations.cpp	Fri Apr 22 08:47:43 2016 +0200
+++ b/Core/Enumerations.cpp	Fri Apr 22 08:57:33 2016 +0200
@@ -328,6 +328,9 @@
       case ErrorCode_NoWorklistHandler:
         return "No request handler factory for DICOM C-Find Modality SCP";
 
+      case ErrorCode_AlreadyExistingTag:
+        return "Cannot override the value of a tag that already exists";
+
       default:
         if (error >= ErrorCode_START_PLUGINS)
         {
--- a/Core/Enumerations.h	Fri Apr 22 08:47:43 2016 +0200
+++ b/Core/Enumerations.h	Fri Apr 22 08:57:33 2016 +0200
@@ -139,6 +139,7 @@
     ErrorCode_SslDisabled = 2039    /*!< Orthanc has been built without SSL support */,
     ErrorCode_CannotOrderSlices = 2040    /*!< Unable to order the slices of the series */,
     ErrorCode_NoWorklistHandler = 2041    /*!< No request handler factory for DICOM C-Find Modality SCP */,
+    ErrorCode_AlreadyExistingTag = 2042    /*!< Cannot override the value of a tag that already exists */,
     ErrorCode_START_PLUGINS = 1000000
   };
 
--- a/OrthancServer/ParsedDicomFile.cpp	Fri Apr 22 08:47:43 2016 +0200
+++ b/OrthancServer/ParsedDicomFile.cpp	Fri Apr 22 08:57:33 2016 +0200
@@ -576,6 +576,11 @@
                                const Json::Value& value,
                                bool decodeDataUriScheme)
   {
+    if (pimpl_->file_->getDataset()->tagExists(ToDcmtkBridge::Convert(tag)))
+    {
+      throw OrthancException(ErrorCode_AlreadyExistingTag);
+    }
+
     InvalidateCache();
 
     std::auto_ptr<DcmElement> element(FromDcmtkBridge::FromJson(tag, value, decodeDataUriScheme, GetEncoding()));
--- a/OrthancServer/main.cpp	Fri Apr 22 08:47:43 2016 +0200
+++ b/OrthancServer/main.cpp	Fri Apr 22 08:57:33 2016 +0200
@@ -592,6 +592,7 @@
     PrintErrorCode(ErrorCode_SslDisabled, "Orthanc has been built without SSL support");
     PrintErrorCode(ErrorCode_CannotOrderSlices, "Unable to order the slices of the series");
     PrintErrorCode(ErrorCode_NoWorklistHandler, "No request handler factory for DICOM C-Find Modality SCP");
+    PrintErrorCode(ErrorCode_AlreadyExistingTag, "Cannot override the value of a tag that already exists");
   }
 
   std::cout << std::endl;
--- a/Plugins/Include/orthanc/OrthancCPlugin.h	Fri Apr 22 08:47:43 2016 +0200
+++ b/Plugins/Include/orthanc/OrthancCPlugin.h	Fri Apr 22 08:57:33 2016 +0200
@@ -278,6 +278,7 @@
     OrthancPluginErrorCode_SslDisabled = 2039    /*!< Orthanc has been built without SSL support */,
     OrthancPluginErrorCode_CannotOrderSlices = 2040    /*!< Unable to order the slices of the series */,
     OrthancPluginErrorCode_NoWorklistHandler = 2041    /*!< No request handler factory for DICOM C-Find Modality SCP */,
+    OrthancPluginErrorCode_AlreadyExistingTag = 2042    /*!< Cannot override the value of a tag that already exists */,
 
     _OrthancPluginErrorCode_INTERNAL = 0x7fffffff
   } OrthancPluginErrorCode;
--- a/Resources/ErrorCodes.json	Fri Apr 22 08:47:43 2016 +0200
+++ b/Resources/ErrorCodes.json	Fri Apr 22 08:57:33 2016 +0200
@@ -518,5 +518,10 @@
     "Code": 2041, 
     "Name": "NoWorklistHandler", 
     "Description": "No request handler factory for DICOM C-Find Modality SCP"
+  },
+  {
+    "Code": 2042,
+    "Name": "AlreadyExistingTag",
+    "Description": "Cannot override the value of a tag that already exists"
   }
 ]