Mercurial > hg > orthanc
comparison 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 |
comparison
equal
deleted
inserted
replaced
314:4f17834a50b6 | 315:fc856d175d18 |
---|---|
661 | 661 |
662 // Record the remaining information | 662 // Record the remaining information |
663 result["ID"] = publicId; | 663 result["ID"] = publicId; |
664 MainDicomTagsToJson(result, id); | 664 MainDicomTagsToJson(result, id); |
665 | 665 |
666 std::string tmp; | |
667 | |
668 tmp = db_->GetMetadata(id, MetadataType_AnonymizedFrom); | |
669 if (tmp.size() != 0) | |
670 result["AnonymizedFrom"] = tmp; | |
671 | |
672 tmp = db_->GetMetadata(id, MetadataType_ModifiedFrom); | |
673 if (tmp.size() != 0) | |
674 result["ModifiedFrom"] = tmp; | |
675 | |
666 return true; | 676 return true; |
667 } | 677 } |
668 | 678 |
669 | 679 |
670 bool ServerIndex::LookupAttachment(FileInfo& attachment, | 680 bool ServerIndex::LookupAttachment(FileInfo& attachment, |
1081 uint64_t seq = db_->IncrementGlobalSequence(sequence); | 1091 uint64_t seq = db_->IncrementGlobalSequence(sequence); |
1082 transaction->Commit(); | 1092 transaction->Commit(); |
1083 | 1093 |
1084 return seq; | 1094 return seq; |
1085 } | 1095 } |
1096 | |
1097 | |
1098 | |
1099 void ServerIndex::LogChange(ChangeType changeType, | |
1100 const std::string& publicId) | |
1101 { | |
1102 boost::mutex::scoped_lock lock(mutex_); | |
1103 std::auto_ptr<SQLite::Transaction> transaction(db_->StartTransaction()); | |
1104 transaction->Begin(); | |
1105 | |
1106 int64_t id; | |
1107 ResourceType type; | |
1108 if (!db_->LookupResource(publicId, id, type)) | |
1109 { | |
1110 throw OrthancException(ErrorCode_UnknownResource); | |
1111 } | |
1112 | |
1113 db_->LogChange(changeType, id, type); | |
1114 | |
1115 transaction->Commit(); | |
1116 } | |
1086 } | 1117 } |