use of io.lumeer.engine.api.event.RemoveSelectionList in project engine by Lumeer.
the class PusherFacade method removeSelectionListNotification.
public void removeSelectionListNotification(@Observes final RemoveSelectionList selectionListEvent) {
if (isEnabled()) {
try {
Organization organization = organizationDao.getOrganizationById(selectionListEvent.getOrganizationId());
Project project = projectDao.getProjectById(selectionListEvent.getSelectionList().getProjectId());
ResourceId resourceId = new ResourceId(getAppId(), selectionListEvent.getSelectionList().getId(), organization.getId());
Set<String> users = resourceAdapter.getProjectReaders(organization, project);
List<Event> events = users.stream().map(userId -> createEventForRemove(selectionListEvent.getSelectionList().getClass().getSimpleName(), resourceId, userId)).collect(Collectors.toList());
sendNotificationsBatch(events);
} catch (Exception e) {
log.log(Level.WARNING, "Unable to send push notification: ", e);
}
}
}
use of io.lumeer.engine.api.event.RemoveSelectionList in project engine by Lumeer.
the class MongoSelectionListDao method deleteList.
@Override
public void deleteList(final SelectionList list) {
DeleteResult result = databaseCollection().deleteOne(idFilter(list.getId()));
if (result.getDeletedCount() != 1) {
throw new StorageException("Selection list '" + list.getId() + "' has not been deleted.");
}
if (removeEvent != null) {
mapList(list);
removeEvent.fire(new RemoveSelectionList(getOrganization().get().getId(), list));
}
}
Aggregations