comparison OrthancServer/Sources/Database/StatelessDatabaseOperations.h @ 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 2684544ff03c
children f7d5372b59b3
comparison
equal deleted inserted replaced
4622:9086aeb9d9d2 4623:95ffe3b6ef7c
252 { 252 {
253 return transaction_.LookupGlobalProperty(target, property, shared); 253 return transaction_.LookupGlobalProperty(target, property, shared);
254 } 254 }
255 255
256 bool LookupMetadata(std::string& target, 256 bool LookupMetadata(std::string& target,
257 int64_t& revision,
257 int64_t id, 258 int64_t id,
258 MetadataType type) 259 MetadataType type)
259 { 260 {
260 return transaction_.LookupMetadata(target, id, type); 261 return transaction_.LookupMetadata(target, revision, id, type);
261 } 262 }
262 263
263 bool LookupParent(int64_t& parentId, 264 bool LookupParent(int64_t& parentId,
264 int64_t resourceId) 265 int64_t resourceId)
265 { 266 {
357 transaction_.SetGlobalProperty(property, shared, value); 358 transaction_.SetGlobalProperty(property, shared, value);
358 } 359 }
359 360
360 void SetMetadata(int64_t id, 361 void SetMetadata(int64_t id,
361 MetadataType type, 362 MetadataType type,
362 const std::string& value) 363 const std::string& value,
363 { 364 int64_t revision)
364 return transaction_.SetMetadata(id, type, value); 365 {
366 return transaction_.SetMetadata(id, type, value, revision);
365 } 367 }
366 368
367 void SetProtectedPatient(int64_t internalId, 369 void SetProtectedPatient(int64_t internalId,
368 bool isProtected) 370 bool isProtected)
369 { 371 {
501 503
502 void GetChildInstances(std::list<std::string>& result, 504 void GetChildInstances(std::list<std::string>& result,
503 const std::string& publicId); 505 const std::string& publicId);
504 506
505 bool LookupMetadata(std::string& target, 507 bool LookupMetadata(std::string& target,
508 int64_t& revision,
506 const std::string& publicId, 509 const std::string& publicId,
507 ResourceType expectedType, 510 ResourceType expectedType,
508 MetadataType type); 511 MetadataType type);
509 512
510 void ListAvailableAttachments(std::set<FileContentType>& target, 513 void ListAvailableAttachments(std::set<FileContentType>& target,
567 const std::string& remoteModality); 570 const std::string& remoteModality);
568 571
569 void SetProtectedPatient(const std::string& publicId, 572 void SetProtectedPatient(const std::string& publicId,
570 bool isProtected); 573 bool isProtected);
571 574
572 void SetMetadata(const std::string& publicId, 575 void SetMetadata(int64_t& newRevision /*out*/,
576 const std::string& publicId,
573 MetadataType type, 577 MetadataType type,
574 const std::string& value); 578 const std::string& value,
575 579 bool hasOldRevision,
576 void DeleteMetadata(const std::string& publicId, 580 int64_t oldRevision);
577 MetadataType type); 581
582 // Same as "SetMetadata()", but doesn't care about revisions
583 void OverwriteMetadata(const std::string& publicId,
584 MetadataType type,
585 const std::string& value);
586
587 bool DeleteMetadata(const std::string& publicId,
588 MetadataType type,
589 bool hasRevision,
590 int64_t revision);
578 591
579 uint64_t IncrementGlobalSequence(GlobalProperty sequence, 592 uint64_t IncrementGlobalSequence(GlobalProperty sequence,
580 bool shared); 593 bool shared);
581 594
582 void DeleteChanges(); 595 void DeleteChanges();