comparison OrthancServer/Sources/ServerContext.h @ 4796:94616af363ec filter-store-instance

added ReceivedCStoreInstanceFilter lua callback + OrthancPluginRegisterIncomingCStoreInstanceFilter in sdk
author Alain Mazy <am@osimis.io>
date Fri, 01 Oct 2021 18:36:45 +0200
parents da1edb7d6332
children 7afbb54bd028
comparison
equal deleted inserted replaced
4795:22d5b611dea7 4796:94616af363ec
91 const std::string& instanceId, 91 const std::string& instanceId,
92 const DicomMap& mainDicomTags, 92 const DicomMap& mainDicomTags,
93 const Json::Value* dicomAsJson) = 0; 93 const Json::Value* dicomAsJson) = 0;
94 }; 94 };
95 95
96 struct StoreResult
97 {
98 private:
99 StoreStatus status_;
100 uint16_t cstoreStatusCode_;
101 // uint16_t httpStatusCode_; // for future use
102
103 public:
104 StoreResult();
105
106 void SetStatus(StoreStatus status)
107 {
108 status_ = status;
109 }
110
111 StoreStatus GetStatus()
112 {
113 return status_;
114 }
115
116 void SetCStoreStatusCode(uint16_t statusCode)
117 {
118 cstoreStatusCode_ = statusCode;
119 }
120
121 uint16_t GetCStoreStatusCode()
122 {
123 return cstoreStatusCode_;
124 }
125 };
96 126
97 private: 127 private:
98 class LuaServerListener : public IServerListener 128 class LuaServerListener : public IServerListener
99 { 129 {
100 private: 130 private:
120 150
121 virtual bool FilterIncomingInstance(const DicomInstanceToStore& instance, 151 virtual bool FilterIncomingInstance(const DicomInstanceToStore& instance,
122 const Json::Value& simplified) ORTHANC_OVERRIDE 152 const Json::Value& simplified) ORTHANC_OVERRIDE
123 { 153 {
124 return context_.filterLua_.FilterIncomingInstance(instance, simplified); 154 return context_.filterLua_.FilterIncomingInstance(instance, simplified);
155 }
156
157 virtual uint16_t FilterIncomingCStoreInstance(const DicomInstanceToStore& instance,
158 const Json::Value& simplified) ORTHANC_OVERRIDE
159 {
160 return context_.filterLua_.FilterIncomingCStoreInstance(instance, simplified);
125 } 161 }
126 }; 162 };
127 163
128 class ServerListener 164 class ServerListener
129 { 165 {
229 DicomTransferSyntax preferredTransferSyntax_; 265 DicomTransferSyntax preferredTransferSyntax_;
230 boost::mutex dynamicOptionsMutex_; 266 boost::mutex dynamicOptionsMutex_;
231 bool isUnknownSopClassAccepted_; 267 bool isUnknownSopClassAccepted_;
232 std::set<DicomTransferSyntax> acceptedTransferSyntaxes_; 268 std::set<DicomTransferSyntax> acceptedTransferSyntaxes_;
233 269
234 StoreStatus StoreAfterTranscoding(std::string& resultPublicId, 270 StoreResult StoreAfterTranscoding(std::string& resultPublicId,
235 DicomInstanceToStore& dicom, 271 DicomInstanceToStore& dicom,
236 StoreInstanceMode mode); 272 StoreInstanceMode mode);
237 273
238 void ApplyInternal(ILookupVisitor& visitor, 274 void ApplyInternal(ILookupVisitor& visitor,
239 const DatabaseLookup& lookup, 275 const DatabaseLookup& lookup,
302 size_t size, 338 size_t size,
303 bool hasOldRevision, 339 bool hasOldRevision,
304 int64_t oldRevision, 340 int64_t oldRevision,
305 const std::string& oldMD5); 341 const std::string& oldMD5);
306 342
307 StoreStatus Store(std::string& resultPublicId, 343 StoreResult Store(std::string& resultPublicId,
308 DicomInstanceToStore& dicom, 344 DicomInstanceToStore& dicom,
309 StoreInstanceMode mode); 345 StoreInstanceMode mode);
310 346
311 void AnswerAttachment(RestApiOutput& output, 347 void AnswerAttachment(RestApiOutput& output,
312 const std::string& resourceId, 348 const std::string& resourceId,