comparison OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp @ 4623:95ffe3b6ef7c db-changes

handling of revisions for metadata
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 16 Apr 2021 17:13:03 +0200
parents f75c63aa9de0
children f7d5372b59b3
comparison
equal deleted inserted replaced
4622:9086aeb9d9d2 4623:95ffe3b6ef7c
770 it = answerInt32_.begin(); it != answerInt32_.end(); ++it) 770 it = answerInt32_.begin(); it != answerInt32_.end(); ++it)
771 { 771 {
772 MetadataType type = static_cast<MetadataType>(*it); 772 MetadataType type = static_cast<MetadataType>(*it);
773 773
774 std::string value; 774 std::string value;
775 if (LookupMetadata(value, id, type)) 775 int64_t revision; // Ignored
776 if (LookupMetadata(value, revision, id, type))
776 { 777 {
777 target[type] = value; 778 target[type] = value;
778 } 779 }
779 } 780 }
780 } 781 }
1172 } 1173 }
1173 } 1174 }
1174 1175
1175 1176
1176 virtual bool LookupMetadata(std::string& target, 1177 virtual bool LookupMetadata(std::string& target,
1178 int64_t& revision,
1177 int64_t id, 1179 int64_t id,
1178 MetadataType type) ORTHANC_OVERRIDE 1180 MetadataType type) ORTHANC_OVERRIDE
1179 { 1181 {
1180 ResetAnswers(); 1182 ResetAnswers();
1181 CheckSuccess(that_.backend_.lookupMetadata(that_.GetContext(), that_.payload_, id, static_cast<int32_t>(type))); 1183 CheckSuccess(that_.backend_.lookupMetadata(that_.GetContext(), that_.payload_, id, static_cast<int32_t>(type)));
1184 revision = 0; // Dummy value, as revisions were added in Orthanc 1.9.2
1182 return ForwardSingleAnswer(target); 1185 return ForwardSingleAnswer(target);
1183 } 1186 }
1184 1187
1185 1188
1186 virtual bool LookupParent(int64_t& parentId, 1189 virtual bool LookupParent(int64_t& parentId,
1334 } 1337 }
1335 1338
1336 1339
1337 virtual void SetMetadata(int64_t id, 1340 virtual void SetMetadata(int64_t id,
1338 MetadataType type, 1341 MetadataType type,
1339 const std::string& value) ORTHANC_OVERRIDE 1342 const std::string& value,
1340 { 1343 int64_t revision) ORTHANC_OVERRIDE
1344 {
1345 // "revision" is not used, as it was added in Orthanc 1.9.2
1341 CheckSuccess(that_.backend_.setMetadata 1346 CheckSuccess(that_.backend_.setMetadata
1342 (that_.payload_, id, static_cast<int32_t>(type), value.c_str())); 1347 (that_.payload_, id, static_cast<int32_t>(type), value.c_str()));
1343 } 1348 }
1344 1349
1345 1350