diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java index 9b4a5c7..afe8f19 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java @@ -644,4 +644,38 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen return saveNotification(not); } + + /** + * {@inheritDoc} + */ + @Override + public boolean notifyDeletedCalendarEvent(String userIdToNotify, String eventTitle, String eventType, Date startDate, Date endingDate) { + SimpleDateFormat spf = new SimpleDateFormat("EEE dd MMMMM, yyyy"); + + String endDateToDisplay=""; + if (endingDate != null) { + endDateToDisplay = " to " + spf.format(endingDate); + } + + StringBuilder notificationText = new StringBuilder(); + notificationText.append("deleted the following event in the ").append(aslSession.getGroupName()).append(" shared calendar: ") // has done something + .append("").append(eventTitle).append("
") + .append("
Was planned: ").append(spf.format(startDate)).append(endDateToDisplay).append("
") + .append("
Category: ").append(eventType); + + Notification not = new Notification( + UUID.randomUUID().toString(), + NotificationType.CALENDAR_DELETED_EVENT, + userIdToNotify, //user no notify + "", // + new Date(), + getApplicationUrl(), + notificationText.toString(), + false, + aslSession.getUsername(), + aslSession.getUserFullName(), + aslSession.getUserAvatarId()); + + return saveNotification(not); + } } diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/NotificationsManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/NotificationsManager.java index 8962a69..1c66f96 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/NotificationsManager.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/NotificationsManager.java @@ -126,6 +126,16 @@ public interface NotificationsManager { * @return true if the notification is correctly delivered, false otherwise */ boolean notifyEditedCalendarEvent(String userIdToNotify, String eventTitle, String eventType, Date startDate, Date endingDate); + /** + * + * @param userIdToNotify the user you want to notify + * @param eventTitle the title of the event + * @param eventType the type of the event + * @param startDate staring date + * @param endingDate ending date + * @return true if the notification is correctly delivered, false otherwise + */ + boolean notifyDeletedCalendarEvent(String userIdToNotify, String eventTitle, String eventType, Date startDate, Date endingDate); /** * use to notify a user that someone commented on his post *