Merge branch 'tizen' into tizen_5.5
[platform/core/api/notification.git] / notification-ex / reporter.cc
index c8ce91a..d423682 100644 (file)
@@ -122,6 +122,14 @@ int Reporter::DeleteAll() {
   return info.GetRequestId();
 }
 
+int Reporter::DeleteByChannel(string channel) {
+  Bundle serialized;
+  EventInfo info(EventInfo::DeleteAll, util::GetAppId(), channel);
+  list<Bundle> serialized_list {serialized};
+  impl_->sender_->Notify(info, serialized_list, util::GetAppId());
+  return info.GetRequestId();
+}
+
 std::unique_ptr<AbstractItem> Reporter::FindByRootID(std::string id) {
   Bundle serialized;
   EventInfo info(EventInfo::Get, util::GetAppId(), "", id);
@@ -135,6 +143,38 @@ std::unique_ptr<AbstractItem> Reporter::FindByRootID(std::string id) {
   return gen_item;
 }
 
+list<unique_ptr<AbstractItem>> Reporter::FindByChannel(string channel) {
+  Bundle serialized;
+  EventInfo info(EventInfo::Get, util::GetAppId(), channel, "");
+  list<Bundle> result = impl_->sender_->Request(info);
+  if (result.size() == 0) {
+    LOGE("Fail to get noti");
+    return list<unique_ptr<item::AbstractItem>>{};
+  }
+
+  list<unique_ptr<AbstractItem>> gen_item_list;
+  for (auto& i : result)
+    gen_item_list.push_back(ItemInflator::Create(i));
+
+  return gen_item_list;
+}
+
+list<unique_ptr<AbstractItem>> Reporter::FindAll() {
+  Bundle serialized;
+  EventInfo info(EventInfo::Get, util::GetAppId(), "", "");
+  list<Bundle> result = impl_->sender_->Request(info);
+  if (result.size() == 0) {
+    LOGE("Fail to get noti");
+    return list<unique_ptr<item::AbstractItem>>{};
+  }
+
+  list<unique_ptr<AbstractItem>> gen_item_list;
+  for (auto& i : result)
+    gen_item_list.push_back(ItemInflator::Create(i));
+
+  return gen_item_list;
+}
+
 int Reporter::SendEvent(const IEventInfo& info,
     shared_ptr<item::AbstractItem> noti) {
   Bundle serialized = noti->Serialize();