changeset 739:696dbb4fd390

api uniformization
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 19 Mar 2014 09:58:20 +0100
parents c60743fadd4e
children 4439091f50d3
files OrthancServer/DatabaseWrapper.cpp OrthancServer/DatabaseWrapper.h OrthancServer/OrthancRestApi.cpp OrthancServer/ServerIndex.cpp OrthancServer/ServerIndex.h
diffstat 5 files changed, 14 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/DatabaseWrapper.cpp	Fri Mar 14 11:28:59 2014 +0100
+++ b/OrthancServer/DatabaseWrapper.cpp	Wed Mar 19 09:58:20 2014 +0100
@@ -388,7 +388,7 @@
     }
   }
 
-  bool DatabaseWrapper::ListAvailableMetadata(std::list<MetadataType>& target,
+  void DatabaseWrapper::ListAvailableMetadata(std::list<MetadataType>& target,
                                               int64_t id)
   {
     target.clear();
@@ -400,8 +400,6 @@
     {
       target.push_back(static_cast<MetadataType>(s.ColumnInt(0)));
     }
-
-    return true;
   }
 
 
--- a/OrthancServer/DatabaseWrapper.h	Fri Mar 14 11:28:59 2014 +0100
+++ b/OrthancServer/DatabaseWrapper.h	Wed Mar 19 09:58:20 2014 +0100
@@ -115,7 +115,7 @@
                         int64_t id,
                         MetadataType type);
 
-    bool ListAvailableMetadata(std::list<MetadataType>& target,
+    void ListAvailableMetadata(std::list<MetadataType>& target,
                                int64_t id);
 
     std::string GetMetadata(int64_t id,
--- a/OrthancServer/OrthancRestApi.cpp	Fri Mar 14 11:28:59 2014 +0100
+++ b/OrthancServer/OrthancRestApi.cpp	Wed Mar 19 09:58:20 2014 +0100
@@ -1668,18 +1668,17 @@
     
     std::string publicId = call.GetUriComponent("id", "");
     std::list<MetadataType> metadata;
-    if (context.GetIndex().ListAvailableMetadata(metadata, publicId))
-    {
-      Json::Value result = Json::arrayValue;
+
+    context.GetIndex().ListAvailableMetadata(metadata, publicId);
+    Json::Value result = Json::arrayValue;
 
-      for (std::list<MetadataType>::const_iterator 
-             it = metadata.begin(); it != metadata.end(); ++it)
-      {
-        result.append(EnumerationToString(*it));
-      }
+    for (std::list<MetadataType>::const_iterator 
+           it = metadata.begin(); it != metadata.end(); ++it)
+    {
+      result.append(EnumerationToString(*it));
+    }
 
-      call.GetOutput().AnswerJson(result);
-    }
+    call.GetOutput().AnswerJson(result);
   }
 
 
--- a/OrthancServer/ServerIndex.cpp	Fri Mar 14 11:28:59 2014 +0100
+++ b/OrthancServer/ServerIndex.cpp	Wed Mar 19 09:58:20 2014 +0100
@@ -1238,7 +1238,7 @@
   }
 
 
-  bool ServerIndex::ListAvailableMetadata(std::list<MetadataType>& target,
+  void ServerIndex::ListAvailableMetadata(std::list<MetadataType>& target,
                                           const std::string& publicId)
   {
     boost::mutex::scoped_lock lock(mutex_);
@@ -1250,7 +1250,7 @@
       throw OrthancException(ErrorCode_UnknownResource);
     }
 
-    return db_->ListAvailableMetadata(target, id);
+    db_->ListAvailableMetadata(target, id);
   }
 
 
--- a/OrthancServer/ServerIndex.h	Fri Mar 14 11:28:59 2014 +0100
+++ b/OrthancServer/ServerIndex.h	Wed Mar 19 09:58:20 2014 +0100
@@ -180,7 +180,7 @@
                         const std::string& publicId,
                         MetadataType type);
 
-    bool ListAvailableMetadata(std::list<MetadataType>& target,
+    void ListAvailableMetadata(std::list<MetadataType>& target,
                                const std::string& publicId);
 
     void ListAvailableAttachments(std::list<FileContentType>& target,