diff OrthancServer/Sources/OrthancRestApi/OrthancRestChanges.cpp @ 5804:25df40a274fd find-refactoring

/changes: allowing filtering on multiple changes
author Alain Mazy <am@orthanc.team>
date Mon, 23 Sep 2024 15:40:27 +0200
parents ca06dde85358
children 8a8756b2dd0b
line wrap: on
line diff
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestChanges.cpp	Fri Sep 20 18:18:52 2024 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestChanges.cpp	Mon Sep 23 15:40:27 2024 +0200
@@ -89,7 +89,7 @@
     ServerContext& context = OrthancRestApi::GetContext(call);
 
     int64_t since, to;
-    ChangeType filterType = ChangeType_INTERNAL_All;
+    std::set<ChangeType> filterType; // = ChangeType_INTERNAL_All;
 
     unsigned int limit;
     bool last;
@@ -98,7 +98,13 @@
     std::string filterArgument = call.GetArgument("type", "all");
     if (filterArgument != "all" && filterArgument != "All")
     {
-      filterType = StringToChangeType(filterArgument);
+      std::set<std::string> filterTypeStrings;
+      Toolbox::SplitString(filterTypeStrings, filterArgument, ';');
+
+      for (std::set<std::string>::const_iterator it = filterTypeStrings.begin(); it != filterTypeStrings.end(); ++it)
+      {
+        filterType.insert(StringToChangeType(*it));
+      }
     }
 
     Json::Value result;
@@ -112,7 +118,7 @@
     }
     else
     {
-      if (filterType != ChangeType_INTERNAL_All)
+      if (filterType.size() > 0)
       {
         throw OrthancException(ErrorCode_ParameterOutOfRange, "CAPABILITIES: Trying to filter changes while the Database backend does not support it (requires a DB backend with support for ExtendedChanges)");
       }