Mercurial > hg > orthanc-databases
comparison Framework/Plugins/DatabaseBackendAdapterV4.cpp @ 396:7b3acfa95bd8 db-protobuf
implementation of list/add/remove labels in postgresql
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 06 Apr 2023 19:00:29 +0200 |
parents | d14e6ff04a5c |
children | a8774581adfc |
comparison
equal
deleted
inserted
replaced
395:a7a029043670 | 396:7b3acfa95bd8 |
---|---|
406 { | 406 { |
407 IndexConnectionsPool::Accessor accessor(pool); | 407 IndexConnectionsPool::Accessor accessor(pool); |
408 response.mutable_get_system_information()->set_database_version(accessor.GetBackend().GetDatabaseVersion(accessor.GetManager())); | 408 response.mutable_get_system_information()->set_database_version(accessor.GetBackend().GetDatabaseVersion(accessor.GetManager())); |
409 response.mutable_get_system_information()->set_supports_flush_to_disk(false); | 409 response.mutable_get_system_information()->set_supports_flush_to_disk(false); |
410 response.mutable_get_system_information()->set_supports_revisions(accessor.GetBackend().HasRevisionsSupport()); | 410 response.mutable_get_system_information()->set_supports_revisions(accessor.GetBackend().HasRevisionsSupport()); |
411 response.mutable_get_system_information()->set_supports_labels(accessor.GetBackend().HasLabelsSupport()); | |
411 break; | 412 break; |
412 } | 413 } |
413 | 414 |
414 case Orthanc::DatabasePluginMessages::OPERATION_OPEN: | 415 case Orthanc::DatabasePluginMessages::OPERATION_OPEN: |
415 { | 416 { |
1164 } | 1165 } |
1165 | 1166 |
1166 break; | 1167 break; |
1167 } | 1168 } |
1168 | 1169 |
1170 case Orthanc::DatabasePluginMessages::OPERATION_ADD_LABEL: | |
1171 { | |
1172 backend.AddLabel(manager, request.add_label().id(), request.add_label().label()); | |
1173 break; | |
1174 } | |
1175 | |
1176 case Orthanc::DatabasePluginMessages::OPERATION_REMOVE_LABEL: | |
1177 { | |
1178 backend.RemoveLabel(manager, request.remove_label().id(), request.remove_label().label()); | |
1179 break; | |
1180 } | |
1181 | |
1182 case Orthanc::DatabasePluginMessages::OPERATION_LIST_LABELS: | |
1183 { | |
1184 std::list<std::string> labels; | |
1185 backend.ListLabels(labels, manager, request.list_labels().id()); | |
1186 | |
1187 response.mutable_list_available_attachments()->mutable_attachments()->Reserve(labels.size()); | |
1188 for (std::list<std::string>::const_iterator it = labels.begin(); it != labels.end(); ++it) | |
1189 { | |
1190 response.mutable_list_labels()->add_labels(*it); | |
1191 } | |
1192 | |
1193 break; | |
1194 } | |
1195 | |
1169 default: | 1196 default: |
1170 LOG(ERROR) << "Not implemented transaction operation from protobuf: " << request.operation(); | 1197 LOG(ERROR) << "Not implemented transaction operation from protobuf: " << request.operation(); |
1171 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | 1198 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
1172 } | 1199 } |
1173 } | 1200 } |