comparison Plugins/Engine/OrthancPlugins.cpp @ 2956:bfee0b9f3209

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 03 Dec 2018 15:11:42 +0100
parents f395460af74d
children ccf61f6e22ef
comparison
equal deleted inserted replaced
2955:bbfd95a0c429 2956:bfee0b9f3209
731 else 731 else
732 { 732 {
733 OrthancPluginErrorCode error = apply_(driver_); 733 OrthancPluginErrorCode error = apply_(driver_);
734 if (error != OrthancPluginErrorCode_Success) 734 if (error != OrthancPluginErrorCode_Success)
735 { 735 {
736 LOG(ERROR) << "Error while doing C-Move from plugin: " << EnumerationToString(static_cast<ErrorCode>(error)); 736 LOG(ERROR) << "Error while doing C-Move from plugin: "
737 << EnumerationToString(static_cast<ErrorCode>(error));
737 return Status_Failure; 738 return Status_Failure;
738 } 739 }
739 else 740 else
740 { 741 {
741 pos_++; 742 pos_++;
814 targetAet.c_str(), 815 targetAet.c_str(),
815 originatorId); 816 originatorId);
816 817
817 if (driver == NULL) 818 if (driver == NULL)
818 { 819 {
819 LOG(ERROR) << "Plugin cannot create a driver for an incoming C-MOVE request"; 820 throw OrthancException(ErrorCode_Plugin,
820 throw OrthancException(ErrorCode_Plugin); 821 "Plugin cannot create a driver for an incoming C-MOVE request");
821 } 822 }
822 823
823 unsigned int size = params_.getMoveSize(driver); 824 unsigned int size = params_.getMoveSize(driver);
824 825
825 return new Driver(driver, size, params_.applyMove, params_.freeMove); 826 return new Driver(driver, size, params_.applyMove, params_.freeMove);
1142 1143
1143 boost::mutex::scoped_lock lock(pimpl_->worklistCallbackMutex_); 1144 boost::mutex::scoped_lock lock(pimpl_->worklistCallbackMutex_);
1144 1145
1145 if (pimpl_->worklistCallback_ != NULL) 1146 if (pimpl_->worklistCallback_ != NULL)
1146 { 1147 {
1147 LOG(ERROR) << "Can only register one plugin to handle modality worklists"; 1148 throw OrthancException(ErrorCode_Plugin,
1148 throw OrthancException(ErrorCode_Plugin); 1149 "Can only register one plugin to handle modality worklists");
1149 } 1150 }
1150 else 1151 else
1151 { 1152 {
1152 LOG(INFO) << "Plugin has registered a callback to handle modality worklists"; 1153 LOG(INFO) << "Plugin has registered a callback to handle modality worklists";
1153 pimpl_->worklistCallback_ = p.callback; 1154 pimpl_->worklistCallback_ = p.callback;
1162 1163
1163 boost::mutex::scoped_lock lock(pimpl_->findCallbackMutex_); 1164 boost::mutex::scoped_lock lock(pimpl_->findCallbackMutex_);
1164 1165
1165 if (pimpl_->findCallback_ != NULL) 1166 if (pimpl_->findCallback_ != NULL)
1166 { 1167 {
1167 LOG(ERROR) << "Can only register one plugin to handle C-FIND requests"; 1168 throw OrthancException(ErrorCode_Plugin,
1168 throw OrthancException(ErrorCode_Plugin); 1169 "Can only register one plugin to handle C-FIND requests");
1169 } 1170 }
1170 else 1171 else
1171 { 1172 {
1172 LOG(INFO) << "Plugin has registered a callback to handle C-FIND requests"; 1173 LOG(INFO) << "Plugin has registered a callback to handle C-FIND requests";
1173 pimpl_->findCallback_ = p.callback; 1174 pimpl_->findCallback_ = p.callback;
1182 const _OrthancPluginMoveCallback& p = 1183 const _OrthancPluginMoveCallback& p =
1183 *reinterpret_cast<const _OrthancPluginMoveCallback*>(parameters); 1184 *reinterpret_cast<const _OrthancPluginMoveCallback*>(parameters);
1184 1185
1185 if (pimpl_->moveCallbacks_.callback != NULL) 1186 if (pimpl_->moveCallbacks_.callback != NULL)
1186 { 1187 {
1187 LOG(ERROR) << "Can only register one plugin to handle C-MOVE requests"; 1188 throw OrthancException(ErrorCode_Plugin,
1188 throw OrthancException(ErrorCode_Plugin); 1189 "Can only register one plugin to handle C-MOVE requests");
1189 } 1190 }
1190 else 1191 else
1191 { 1192 {
1192 LOG(INFO) << "Plugin has registered a callback to handle C-MOVE requests"; 1193 LOG(INFO) << "Plugin has registered a callback to handle C-MOVE requests";
1193 pimpl_->moveCallbacks_ = p; 1194 pimpl_->moveCallbacks_ = p;
2318 { 2319 {
2319 pimpl_->database_->AnswerReceived(p); 2320 pimpl_->database_->AnswerReceived(p);
2320 } 2321 }
2321 else 2322 else
2322 { 2323 {
2323 LOG(ERROR) << "Cannot invoke this service without a custom database back-end"; 2324 throw OrthancException(ErrorCode_BadRequest,
2324 throw OrthancException(ErrorCode_BadRequest); 2325 "Cannot invoke this service without a custom database back-end");
2325 } 2326 }
2326 } 2327 }
2327 2328
2328 2329
2329 namespace 2330 namespace
3193 const _OrthancPluginReconstructMainDicomTags& p = 3194 const _OrthancPluginReconstructMainDicomTags& p =
3194 *reinterpret_cast<const _OrthancPluginReconstructMainDicomTags*>(parameters); 3195 *reinterpret_cast<const _OrthancPluginReconstructMainDicomTags*>(parameters);
3195 3196
3196 if (pimpl_->database_.get() == NULL) 3197 if (pimpl_->database_.get() == NULL)
3197 { 3198 {
3198 LOG(ERROR) << "The service ReconstructMainDicomTags can only be invoked by custom database plugins"; 3199 throw OrthancException(ErrorCode_DatabasePlugin,
3199 throw OrthancException(ErrorCode_DatabasePlugin); 3200 "The service ReconstructMainDicomTags can only be invoked by custom database plugins");
3200 } 3201 }
3201 3202
3202 IStorageArea& storage = *reinterpret_cast<IStorageArea*>(p.storageArea); 3203 IStorageArea& storage = *reinterpret_cast<IStorageArea*>(p.storageArea);
3203 ServerToolbox::ReconstructMainDicomTags(*pimpl_->database_, storage, Plugins::Convert(p.level)); 3204 ServerToolbox::ReconstructMainDicomTags(*pimpl_->database_, storage, Plugins::Convert(p.level));
3204 3205