diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java index 5b3de43..c2cc905 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java @@ -26,7 +26,6 @@ import org.gcube.vomanagement.usermanagement.model.UserModel; /** * * @author Massimiliano Assante, ISTI-CNR - * @version 0.1 Dec 2012 * * use to notify users from within your application */ @@ -119,7 +118,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen public boolean notifyFolderRenaming(String userIdToNotify, String previousName, String newName, String renamedFolderId) throws InternalErrorException { Notification not = new Notification( UUID.randomUUID().toString(), - NotificationType.WP_FOLDER_SHARE, + NotificationType.WP_FOLDER_RENAMED, userIdToNotify, //user no notify renamedFolderId, //the new Date(), @@ -274,6 +273,27 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen return saveNotification(not); } + /** + * {@inheritDoc} + * @throws InternalErrorException + */ + @Override + public boolean notifyItemRenaming(String userIdToNotify, String previousName, WorkspaceItem renamedItem) throws InternalErrorException { + Notification not = new Notification( + UUID.randomUUID().toString(), + NotificationType.WP_ITEM_RENAMED, + userIdToNotify, //user no notify + renamedItem.getId(), //the + new Date(), + "?oid="+renamedItem.getId(), + "renamed " + previousName +" as " + renamedItem.getName() +" in your shared folder " + renamedItem.getParent().getName(), + false, + aslSession.getUsername(), + aslSession.getUserFullName(), + aslSession.getUserAvatarId()); + + return saveNotification(not); + } /** * {@inheritDoc} */ @@ -487,5 +507,5 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen 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 3cb483a..d9bc61a 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/NotificationsManager.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/NotificationsManager.java @@ -80,6 +80,15 @@ public interface NotificationsManager { * @return true if the notification is correctly delivered, false otherwise */ boolean notifyUpdatedItem(String userIdToNotify, WorkspaceItem item, WorkspaceFolder sharedFolder) throws Exception; + /** + * use to notify a user he got a workspace item renamed + * + * @param userIdToNotify the user you want to notify + * @param previousName the previous name of the folder + * @param renamedItem the renamed {@link WorkspaceItem} + * @return true if the notification is correctly delivered, false otherwise + */ + boolean notifyItemRenaming(String userIdToNotify, String previousName, WorkspaceItem renamedItem) throws Exception; /** * * @param userIdToNotify the user you want to notify