comparison Framework/Plugins/IndexBackend.h @ 391:d14e6ff04a5c db-protobuf

added primitives to handle labels
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 05 Apr 2023 12:09:46 +0200
parents 3d6886f3e5b3
children 7b3acfa95bd8
comparison
equal deleted inserted replaced
390:eb80f7c5e7d8 391:d14e6ff04a5c
300 // New primitive since Orthanc 1.5.2 300 // New primitive since Orthanc 1.5.2
301 virtual void LookupResources(IDatabaseBackendOutput& output, 301 virtual void LookupResources(IDatabaseBackendOutput& output,
302 DatabaseManager& manager, 302 DatabaseManager& manager,
303 const std::vector<Orthanc::DatabaseConstraint>& lookup, 303 const std::vector<Orthanc::DatabaseConstraint>& lookup,
304 OrthancPluginResourceType queryLevel, 304 OrthancPluginResourceType queryLevel,
305 const std::set<std::string>& withLabels,
306 const std::set<std::string>& withoutLabels,
305 uint32_t limit, 307 uint32_t limit,
306 bool requestSomeInstance) ORTHANC_OVERRIDE; 308 bool requestSomeInstance) ORTHANC_OVERRIDE;
307 #endif 309 #endif
308 310
309 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1 311 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1
325 int32_t metadata) ORTHANC_OVERRIDE; 327 int32_t metadata) ORTHANC_OVERRIDE;
326 328
327 virtual void TagMostRecentPatient(DatabaseManager& manager, 329 virtual void TagMostRecentPatient(DatabaseManager& manager,
328 int64_t patient) ORTHANC_OVERRIDE; 330 int64_t patient) ORTHANC_OVERRIDE;
329 331
330 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) // Macro introduced in 1.3.1
331 # if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 4)
332 // New primitive since Orthanc 1.5.4 332 // New primitive since Orthanc 1.5.4
333 virtual bool LookupResourceAndParent(int64_t& id, 333 virtual bool LookupResourceAndParent(int64_t& id,
334 OrthancPluginResourceType& type, 334 OrthancPluginResourceType& type,
335 std::string& parentPublicId, 335 std::string& parentPublicId,
336 DatabaseManager& manager, 336 DatabaseManager& manager,
337 const char* publicId) ORTHANC_OVERRIDE; 337 const char* publicId) ORTHANC_OVERRIDE;
338 # endif 338
339 #endif
340
341 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) // Macro introduced in 1.3.1
342 # if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 4)
343 // New primitive since Orthanc 1.5.4 339 // New primitive since Orthanc 1.5.4
344 virtual void GetAllMetadata(std::map<int32_t, std::string>& result, 340 virtual void GetAllMetadata(std::map<int32_t, std::string>& result,
345 DatabaseManager& manager, 341 DatabaseManager& manager,
346 int64_t id) ORTHANC_OVERRIDE; 342 int64_t id) ORTHANC_OVERRIDE;
347 # endif
348 #endif
349 343
350 virtual bool HasCreateInstance() const ORTHANC_OVERRIDE 344 virtual bool HasCreateInstance() const ORTHANC_OVERRIDE
351 { 345 {
352 // This extension is available in PostgreSQL and MySQL, but is 346 // This extension is available in PostgreSQL and MySQL, but is
353 // emulated by "CreateInstanceGeneric()" in SQLite 347 // emulated by "CreateInstanceGeneric()" in SQLite
385 void SetGlobalIntegerProperty(DatabaseManager& manager, 379 void SetGlobalIntegerProperty(DatabaseManager& manager,
386 const char* serverIdentifier, 380 const char* serverIdentifier,
387 int32_t property, 381 int32_t property,
388 int value); 382 int value);
389 383
384 virtual void AddLabel(int64_t resource,
385 const std::string& label) ORTHANC_OVERRIDE;
386
387 virtual void RemoveLabel(int64_t resource,
388 const std::string& label) ORTHANC_OVERRIDE;
389
390 virtual void ListLabels(std::set<std::string>& target,
391 int64_t resource) ORTHANC_OVERRIDE;
392
390 /** 393 /**
391 * "maxDatabaseRetries" is to handle 394 * "maxDatabaseRetries" is to handle
392 * "OrthancPluginErrorCode_DatabaseCannotSerialize" if there is a 395 * "OrthancPluginErrorCode_DatabaseCannotSerialize" if there is a
393 * collision multiple writers. "countConnections" and 396 * collision multiple writers. "countConnections" and
394 * "maxDatabaseRetries" are only used if Orthanc >= 1.9.2. 397 * "maxDatabaseRetries" are only used if Orthanc >= 1.9.2.