From 2fcfd01353ec25ac52622940255b232e9259aa2e Mon Sep 17 00:00:00 2001 From: "massimiliano.assante" Date: Fri, 12 Jul 2013 14:59:26 +0000 Subject: [PATCH] added support for edited events git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@79115 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../ApplicationNotificationsManager.java | 34 +++++++++++++++++++ .../social/NotificationsManager.java | 10 ++++++ 2 files changed, 44 insertions(+) diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java index 781177e..9b4a5c7 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java @@ -610,4 +610,38 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen return saveNotification(not); } + + /** + * {@inheritDoc} + */ + @Override + public boolean notifyEditedCalendarEvent(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("edited the following event in the ").append(aslSession.getGroupName()).append(" shared calendar: ") // has done something + .append("").append(eventTitle).append("
") + .append("
Time: ").append(spf.format(startDate)).append(endDateToDisplay).append("
") + .append("
Category: ").append(eventType); + + Notification not = new Notification( + UUID.randomUUID().toString(), + NotificationType.CALENDAR_UPDATED_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 e876246..8962a69 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/NotificationsManager.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/NotificationsManager.java @@ -116,6 +116,16 @@ public interface NotificationsManager { * @return true if the notification is correctly delivered, false otherwise */ boolean notifyNewCalendarEvent(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 notifyEditedCalendarEvent(String userIdToNotify, String eventTitle, String eventType, Date startDate, Date endingDate); /** * use to notify a user that someone commented on his post *