[Content] Add deprecation to some not frequently used members
[platform/core/api/webapi-plugins.git] / src / content / content_filter.cc
index cb69310..e17ce5b 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "common/converter.h"
 #include "common/logger.h"
+#include "common/tools.h"
 
 using common::AttributeMatchFlag;
 using common::CompositeFilterType;
@@ -45,9 +46,12 @@ std::map<std::string, std::string> const attributeNameMap = {
     {"createdDate", "MEDIA_ADDED_TIME"},
     {"releaseDate", "MEDIA_DATETAKEN"},
     {"modifiedDate", "MEDIA_MODIFIED_TIME"},
-    {"geolocation.latitude", "MEDIA_LATITUDE"},
-    {"geolocation.longitude", "MEDIA_LONGITUDE"},
-    {"duration", "MEDIA_DURATION"},
+    {"geolocation.latitude",
+     "MEDIA_LATITUDE"},  // Deprecated since 9.0 //TODO remove after 2 versions
+    {"geolocation.longitude",
+     "MEDIA_LONGITUDE"},  // Deprecated since 9.0 //TODO remove after 2 versions
+    {"duration",
+     "MEDIA_DURATION"},  // Deprecated since 9.0 //TODO remove after 2 versions
     {"album", "MEDIA_ALBUM"},
     {"artists", "MEDIA_ARTIST"},
     {"width", "MEDIA_WIDTH"},
@@ -84,6 +88,12 @@ PlatformResult ContentFilter::MapField(const std::string& name, std::string* res
   ScopeLogger();
   auto it = attributeNameMap.find(name);
   if (it != attributeNameMap.end()) {
+    if (name == "rating" || name == "description" ||
+        name == "geolocation.latitude" || name == "geolocation.longitude" ||
+        name == "duration") {
+      std::string warning = "Filtering by attribute '" + name + "'";
+      common::tools::PrintDeprecationWarningFor(warning.c_str());
+    }
     *result = it->second;
   } else {
     return LogAndCreateResult(ErrorCode::INVALID_VALUES_ERR);