changeset 1236:21d84e3acc0d

clean
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 05 Dec 2014 14:53:30 +0100
parents 9b4977e3c19d
children 0f3716b88af7
files OrthancServer/DatabaseWrapper.h OrthancServer/ServerIndex.cpp UnitTestsSources/ServerIndexTests.cpp
diffstat 3 files changed, 17 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/DatabaseWrapper.h	Fri Dec 05 14:31:46 2014 +0100
+++ b/OrthancServer/DatabaseWrapper.h	Fri Dec 05 14:53:30 2014 +0100
@@ -120,7 +120,7 @@
 
     std::string GetMetadata(int64_t id,
                             MetadataType type,
-                            const std::string& defaultValue = "");
+                            const std::string& defaultValue);
 
     bool GetMetadataAsInteger(int& result,
                               int64_t id,
@@ -179,8 +179,7 @@
                              const std::string& studyInstanceUid,
                              const std::string& seriesInstanceUid,
                              const std::string& sopInstanceUid,
-                             const boost::posix_time::ptime& date = 
-                             boost::posix_time::second_clock::local_time());
+                             const boost::posix_time::ptime& date);
     
     void GetExportedResources(Json::Value& target,
                               int64_t since,
--- a/OrthancServer/ServerIndex.cpp	Fri Dec 05 14:31:46 2014 +0100
+++ b/OrthancServer/ServerIndex.cpp	Fri Dec 05 14:53:30 2014 +0100
@@ -718,7 +718,7 @@
   SeriesStatus ServerIndex::GetSeriesStatus(int64_t id)
   {
     // Get the expected number of instances in this series (from the metadata)
-    std::string s = db_->GetMetadata(id, MetadataType_Series_ExpectedNumberOfInstances);
+    std::string s = db_->GetMetadata(id, MetadataType_Series_ExpectedNumberOfInstances, "");
 
     size_t expected;
     try
@@ -739,7 +739,7 @@
            it = children.begin(); it != children.end(); ++it)
     {
       // Get the index of this instance in the series
-      s = db_->GetMetadata(*it, MetadataType_Instance_IndexInSeries);
+      s = db_->GetMetadata(*it, MetadataType_Instance_IndexInSeries, "");
       size_t index;
       try
       {
@@ -923,13 +923,17 @@
 
     std::string tmp;
 
-    tmp = db_->GetMetadata(id, MetadataType_AnonymizedFrom);
+    tmp = db_->GetMetadata(id, MetadataType_AnonymizedFrom, "");
     if (tmp.size() != 0)
+    {
       result["AnonymizedFrom"] = tmp;
+    }
 
-    tmp = db_->GetMetadata(id, MetadataType_ModifiedFrom);
+    tmp = db_->GetMetadata(id, MetadataType_ModifiedFrom, "");
     if (tmp.size() != 0)
+    {
       result["ModifiedFrom"] = tmp;
+    }
 
     if (type == ResourceType_Patient ||
         type == ResourceType_Study ||
@@ -937,9 +941,11 @@
     {
       result["IsStable"] = !unstableResources_.Contains(id);
 
-      tmp = db_->GetMetadata(id, MetadataType_LastUpdate);
+      tmp = db_->GetMetadata(id, MetadataType_LastUpdate, "");
       if (tmp.size() != 0)
+      {
         result["LastUpdate"] = tmp;
+      }
     }
 
     return true;
@@ -1065,7 +1071,8 @@
                              patientId,
                              studyInstanceUid,
                              seriesInstanceUid,
-                             sopInstanceUid);
+                             sopInstanceUid,
+                             boost::posix_time::second_clock::local_time());
   }
 
 
@@ -1852,7 +1859,7 @@
            it = metadata.begin(); it != metadata.end(); it++)
     {
       std::string key = EnumerationToString(*it);
-      std::string value = db_->GetMetadata(id, *it);
+      std::string value = db_->GetMetadata(id, *it, "");
       target[key] = value;
     }
 
--- a/UnitTestsSources/ServerIndexTests.cpp	Fri Dec 05 14:31:46 2014 +0100
+++ b/UnitTestsSources/ServerIndexTests.cpp	Fri Dec 05 14:53:30 2014 +0100
@@ -268,7 +268,7 @@
   ASSERT_TRUE(index_->LookupMetadata(s, a[4], MetadataType_Instance_RemoteAet));
   ASSERT_FALSE(index_->LookupMetadata(s, a[4], MetadataType_Instance_IndexInSeries));
   ASSERT_EQ("PINNACLE", s);
-  ASSERT_EQ("PINNACLE", index_->GetMetadata(a[4], MetadataType_Instance_RemoteAet));
+  ASSERT_EQ("PINNACLE", index_->GetMetadata(a[4], MetadataType_Instance_RemoteAet, ""));
   ASSERT_EQ("None", index_->GetMetadata(a[4], MetadataType_Instance_IndexInSeries, "None"));
 
   ASSERT_TRUE(index_->LookupGlobalProperty(s, GlobalProperty_FlushSleep));