@Override public void sendEmail() { // At this time all data have gathered, if it exists of course if (Configuration.isEmailSendingEnabled()) { if (emailConnectionValidator.isConnectionActivated()) if (emailConnectionValidator.validConnection()) { List<EmailNotification> notifications = emailNotificationModel.getAllByType( EmailTemplateEnum.TEMPLATE_RESOURCE_REMOVED_FROM_TASK); for (int i = 0; i < notifications.size(); i++) if (composeMessageForUser(notifications.get(i))) deleteSingleNotification(notifications.get(i)); } } }
private void deleteSingleNotification(EmailNotification notification) { emailNotificationModel.deleteById(notification); }