Mercurial > hg > orthanc
comparison OrthancServer/Sources/ServerIndex.cpp @ 5080:d7274e43ea7c attach-custom-data
allow plugins to store a customData in the Attachments table to e.g. store custom paths without requiring an external DB
author | Alain Mazy <am@osimis.io> |
---|---|
date | Thu, 08 Sep 2022 17:42:08 +0200 |
parents | e95fadefeb72 |
children | 8279eaab0d1d |
comparison
equal
deleted
inserted
replaced
5079:4366b4c41441 | 5080:d7274e43ea7c |
---|---|
44 { | 44 { |
45 private: | 45 private: |
46 struct FileToRemove | 46 struct FileToRemove |
47 { | 47 { |
48 private: | 48 private: |
49 std::string uuid_; | 49 std::string uuid_; |
50 FileContentType type_; | 50 std::string customData_; |
51 FileContentType type_; | |
51 | 52 |
52 public: | 53 public: |
53 explicit FileToRemove(const FileInfo& info) : | 54 explicit FileToRemove(const FileInfo& info) : |
54 uuid_(info.GetUuid()), | 55 uuid_(info.GetUuid()), |
56 customData_(info.GetCustomData()), | |
55 type_(info.GetContentType()) | 57 type_(info.GetContentType()) |
56 { | 58 { |
57 } | 59 } |
58 | 60 |
59 const std::string& GetUuid() const | 61 const std::string& GetUuid() const |
60 { | 62 { |
61 return uuid_; | 63 return uuid_; |
64 } | |
65 | |
66 const std::string& GetCustomData() const | |
67 { | |
68 return customData_; | |
62 } | 69 } |
63 | 70 |
64 FileContentType GetContentType() const | 71 FileContentType GetContentType() const |
65 { | 72 { |
66 return type_; | 73 return type_; |
92 it = pendingFilesToRemove_.begin(); | 99 it = pendingFilesToRemove_.begin(); |
93 it != pendingFilesToRemove_.end(); ++it) | 100 it != pendingFilesToRemove_.end(); ++it) |
94 { | 101 { |
95 try | 102 try |
96 { | 103 { |
97 context_.RemoveFile(it->GetUuid(), it->GetContentType()); | 104 context_.RemoveFile(it->GetUuid(), it->GetContentType(), it->GetCustomData()); |
98 } | 105 } |
99 catch (OrthancException& e) | 106 catch (OrthancException& e) |
100 { | 107 { |
101 LOG(ERROR) << "Unable to remove an attachment from the storage area: " | 108 LOG(ERROR) << "Unable to remove an attachment from the storage area: " |
102 << it->GetUuid() << " (type: " << EnumerationToString(it->GetContentType()) << ")"; | 109 << it->GetUuid() << " (type: " << EnumerationToString(it->GetContentType()) << ")"; |