use of io.lumeer.engine.api.event.RemoveUserNotification in project engine by Lumeer.
the class MongoUserNotificationDao method removeNotifications.
@Override
public void removeNotifications(final String searchField, final String searchId, final Set<String> users) {
Bson filter = createRemoveNotificationsFilter(searchField, searchId, users);
final List<UserNotification> deletedNotifications = databaseCollection().find(filter).into(new ArrayList<>());
final DeleteResult result = databaseCollection().deleteMany(filter);
if (result.getDeletedCount() > 0 && removeUserNotificationEvent != null) {
deletedNotifications.forEach(notification -> removeUserNotificationEvent.fire(new RemoveUserNotification(notification)));
}
}
use of io.lumeer.engine.api.event.RemoveUserNotification in project engine by Lumeer.
the class PusherFacade method removeUserNotification.
public void removeUserNotification(@Observes final RemoveUserNotification removeUserNotification) {
if (isEnabled()) {
try {
UserNotification notification = removeUserNotification.getUserNotification();
Event event = createEventForRemove(notification.getClass().getSimpleName(), new ResourceId(getAppId(), notification.getId()), notification.getUserId());
sendNotificationsBatch(Collections.singletonList(event));
} catch (Exception e) {
log.log(Level.WARNING, "Unable to send push notification: ", e);
}
}
}
Aggregations