diff OrthancServer/ServerIndex.cpp @ 697:dd1ce9a2844c

access to attachments
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 05 Feb 2014 16:46:59 +0100
parents 2d0a347e8cfc
children 2929e17f8447
line wrap: on
line diff
--- a/OrthancServer/ServerIndex.cpp	Wed Feb 05 15:00:29 2014 +0100
+++ b/OrthancServer/ServerIndex.cpp	Wed Feb 05 16:46:59 2014 +0100
@@ -1224,6 +1224,24 @@
   }
 
 
+  void ServerIndex::ListAvailableAttachments(std::list<FileContentType>& target,
+                                             const std::string& publicId,
+                                             ResourceType expectedType)
+  {
+    boost::mutex::scoped_lock lock(mutex_);
+
+    ResourceType type;
+    int64_t id;
+    if (!db_->LookupResource(publicId, id, type) ||
+        expectedType != type)
+    {
+      throw OrthancException(ErrorCode_UnknownResource);
+    }
+
+    db_->ListAvailableAttachments(target, id);
+  }
+
+
   bool ServerIndex::LookupParent(std::string& target,
                                  const std::string& publicId)
   {