diff OrthancServer/ServerIndex.cpp @ 315:fc856d175d18

modifications
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 21 Dec 2012 17:18:04 +0100
parents 26efccdff583
children d1ea72f1c967
line wrap: on
line diff
--- a/OrthancServer/ServerIndex.cpp	Fri Dec 21 13:53:24 2012 +0100
+++ b/OrthancServer/ServerIndex.cpp	Fri Dec 21 17:18:04 2012 +0100
@@ -663,6 +663,16 @@
     result["ID"] = publicId;
     MainDicomTagsToJson(result, id);
 
+    std::string tmp;
+
+    tmp = db_->GetMetadata(id, MetadataType_AnonymizedFrom);
+    if (tmp.size() != 0)
+      result["AnonymizedFrom"] = tmp;
+
+    tmp = db_->GetMetadata(id, MetadataType_ModifiedFrom);
+    if (tmp.size() != 0)
+      result["ModifiedFrom"] = tmp;
+
     return true;
   }
 
@@ -1083,4 +1093,25 @@
 
     return seq;
   }
+
+
+
+  void ServerIndex::LogChange(ChangeType changeType,
+                              const std::string& publicId)
+  {
+    boost::mutex::scoped_lock lock(mutex_);
+    std::auto_ptr<SQLite::Transaction> transaction(db_->StartTransaction());
+    transaction->Begin();
+
+    int64_t id;
+    ResourceType type;
+    if (!db_->LookupResource(publicId, id, type))
+    {
+      throw OrthancException(ErrorCode_UnknownResource);
+    }
+
+    db_->LogChange(changeType, id, type);
+
+    transaction->Commit();
+  }
 }