comparison Framework/Plugins/DatabaseBackendAdapterV4.cpp @ 401:a8774581adfc db-protobuf

replaced "WithLabels" and "WithoutLabels", by "Labels" and "LabelsConstraint"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 07 Apr 2023 22:32:15 +0200
parents 7b3acfa95bd8
children 82921a29349a
comparison
equal deleted inserted replaced
400:897253c21208 401:a8774581adfc
566 lookup.push_back(Orthanc::DatabaseConstraint(c)); 566 lookup.push_back(Orthanc::DatabaseConstraint(c));
567 } 567 }
568 568
569 assert(values.size() == countValues); 569 assert(values.size() == countValues);
570 570
571 std::set<std::string> withLabels, withoutLabels; 571 std::set<std::string> labels;
572 572
573 for (int i = 0; i < request.with_labels().size(); i++) 573 for (int i = 0; i < request.labels().size(); i++)
574 { 574 {
575 withLabels.insert(request.with_labels(i)); 575 labels.insert(request.labels(i));
576 } 576 }
577 577
578 for (int i = 0; i < request.without_labels().size(); i++) 578 Orthanc::LabelsConstraint labelsConstraint;
579 { 579 switch (request.labels_constraint())
580 withoutLabels.insert(request.without_labels(i)); 580 {
581 } 581 case Orthanc::DatabasePluginMessages::LABELS_CONSTRAINT_ALL:
582 582 labelsConstraint = Orthanc::LabelsConstraint_All;
583 break;
584
585 case Orthanc::DatabasePluginMessages::LABELS_CONSTRAINT_ANY:
586 labelsConstraint = Orthanc::LabelsConstraint_Any;
587 break;
588
589 case Orthanc::DatabasePluginMessages::LABELS_CONSTRAINT_NONE:
590 labelsConstraint = Orthanc::LabelsConstraint_None;
591 break;
592
593 default:
594 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
595 }
596
583 Output output(response); 597 Output output(response);
584 backend.LookupResources(output, manager, lookup, Convert(request.query_level()), 598 backend.LookupResources(output, manager, lookup, Convert(request.query_level()),
585 withLabels, withoutLabels, request.limit(), request.retrieve_instances_ids()); 599 labels, labelsConstraint, request.limit(), request.retrieve_instances_ids());
586 } 600 }
587 601
588 602
589 static void ProcessTransactionOperation(Orthanc::DatabasePluginMessages::TransactionResponse& response, 603 static void ProcessTransactionOperation(Orthanc::DatabasePluginMessages::TransactionResponse& response,
590 const Orthanc::DatabasePluginMessages::TransactionRequest& request, 604 const Orthanc::DatabasePluginMessages::TransactionRequest& request,