From c69f80c0f81fd824ad9771159e25f42e6f6cae38 Mon Sep 17 00:00:00 2001 From: "massimiliano.assante" Date: Tue, 19 Jun 2018 16:57:22 +0000 Subject: [PATCH] Added support for storage hub model in workspace related notifications git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@169335 82a268e6-3cf1-43bd-a215-b396298e98cf --- distro/changelog.xml | 4 + pom.xml | 7 +- .../ApplicationNotificationsManager.java | 284 ++++++++++++++++++ .../social/NotificationsManager.java | 112 ++++++- 4 files changed, 403 insertions(+), 4 deletions(-) diff --git a/distro/changelog.xml b/distro/changelog.xml index 0effdd9..16a3485 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -1,4 +1,8 @@ + + Added support for storage hub model in workspace related notifications + partially removed portal context dependency (where possible) diff --git a/pom.xml b/pom.xml index 63919a3..a49c8d1 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.gcube.applicationsupportlayer aslsocial - 1.3.0-SNAPSHOT + 1.4.0-SNAPSHOT jar Social Portal ASL Extension @@ -47,6 +47,11 @@ portal-manager provided + + org.gcube.common + storagehub-model + provided + org.gcube.common home-library diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java index 2024b7c..88ee379 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java @@ -12,6 +12,8 @@ import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser; import org.gcube.common.homelibrary.home.exceptions.InternalErrorException; import org.gcube.common.homelibrary.home.workspace.WorkspaceItem; import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder; +import org.gcube.common.storagehub.model.items.Item; +import org.gcube.common.storagehub.model.items.SharedFolder; import org.gcube.portal.databook.shared.Notification; import org.gcube.portal.databook.shared.NotificationChannelType; import org.gcube.portal.databook.shared.NotificationType; @@ -217,6 +219,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen * @throws InternalErrorException */ @Override + @Deprecated public boolean notifyFolderSharing(String userIdToNotify, WorkspaceSharedFolder sharedFolder) throws InternalErrorException { String sharedFolderName = sharedFolder.getName(); if (sharedFolder.isShared()) { @@ -239,6 +242,34 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen return saveNotification(not); } + /** + * {@inheritDoc} + * @throws InternalErrorException + */ + @Override + public boolean notifyFolderSharing(String userIdToNotify, SharedFolder sharedFolder) throws InternalErrorException { + String sharedFolderName = sharedFolder.getTitle(); + if (sharedFolder.isShared()) { + SharedFolder sharedWSFolder = (SharedFolder) sharedFolder; + sharedFolderName = sharedWSFolder.isVreFolder()?sharedWSFolder.getDisplayName():sharedFolder.getTitle(); + if (sharedWSFolder.isVreFolder()) + sharedFolderName = sharedWSFolder.getDisplayName(); + } + Notification not = new Notification( + UUID.randomUUID().toString(), + NotificationType.WP_FOLDER_SHARE, + userIdToNotify, //user no notify + sharedFolder.getId(), + new Date(), + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), + "shared the workspace folder \""+ sharedFolderName +"\" with you", + false, + currUser.getUsername(), + currUser.getFullname(), + currUser.getUserAvatarId()); + + return saveNotification(not); + } /** * {@inheritDoc} * @throws Exception @@ -265,6 +296,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen * @throws Exception */ @Override + @Deprecated public boolean notifyAdministratorUpgrade(String userIdToNotify, WorkspaceSharedFolder sharedFolder) throws Exception { String sharedFolderName = sharedFolder.getName(); Notification not = new Notification( @@ -287,6 +319,29 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen * @throws Exception */ @Override + public boolean notifyAdministratorUpgrade(String userIdToNotify, SharedFolder sharedFolder) throws Exception { + String sharedFolderName = sharedFolder.getTitle(); + Notification not = new Notification( + UUID.randomUUID().toString(), + NotificationType.WP_ADMIN_UPGRADE, + userIdToNotify, //user no notify + sharedFolder.getId(), + new Date(), + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), + "upgraded you to Administrator of the workspace folder \""+ sharedFolderName+"\"", + false, + currUser.getUsername(), + currUser.getFullname(), + currUser.getUserAvatarId()); + + return saveNotification(not); + } + /** + * {@inheritDoc} + * @throws Exception + */ + @Override + @Deprecated public boolean notifyAdministratorDowngrade(String userIdToNotify, WorkspaceSharedFolder sharedFolder) throws Exception { String sharedFolderName = sharedFolder.getName(); Notification not = new Notification( @@ -304,6 +359,28 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen return saveNotification(not); } + /** + * {@inheritDoc} + * @throws Exception + */ + @Override + public boolean notifyAdministratorDowngrade(String userIdToNotify, SharedFolder sharedFolder) throws Exception { + String sharedFolderName = sharedFolder.getTitle(); + Notification not = new Notification( + UUID.randomUUID().toString(), + NotificationType.WP_ADMIN_DOWNGRADE, + userIdToNotify, //user no notify + sharedFolder.getId(), + new Date(), + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), + "downgraded you from Administrator of the workspace folder \""+ sharedFolderName+"\"", + false, + currUser.getUsername(), + currUser.getFullname(), + currUser.getUserAvatarId()); + + return saveNotification(not); + } /** * {@inheritDoc} @@ -333,6 +410,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen * @throws UserManagementSystemException */ @Override + @Deprecated public boolean notifyFolderAddedUser(String userIdToNotify, WorkspaceSharedFolder sharedFolder, String newAddedUserId) throws InternalErrorException, UserManagementSystemException, UserRetrievalFault, UserManagementPortalException { UserManager um = new LiferayUserManager(); GCubeUser user = um.getUserByUsername(newAddedUserId); @@ -358,6 +436,32 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen * @throws UserManagementSystemException */ @Override + public boolean notifyFolderAddedUser(String userIdToNotify, SharedFolder sharedFolder, String newAddedUserId) throws InternalErrorException, UserManagementSystemException, UserRetrievalFault, UserManagementPortalException { + UserManager um = new LiferayUserManager(); + GCubeUser user = um.getUserByUsername(newAddedUserId); + Notification not = new Notification( + UUID.randomUUID().toString(), + NotificationType.WP_FOLDER_ADDEDUSER, + userIdToNotify, //user no notify + sharedFolder.getId(), //the + new Date(), + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), + "added "+ user.getFullname() +" to your workspace shared folder \""+ sharedFolder.getTitle()+"\"", + false, + currUser.getUsername(), + currUser.getFullname(), + currUser.getUserAvatarId()); + + return saveNotification(not); + } + /** + * {@inheritDoc} + * @throws UserManagementPortalException + * @throws UserRetrievalFault + * @throws UserManagementSystemException + */ + @Override + @Deprecated public boolean notifyFolderAddedUsers(String userIdToNotify, WorkspaceSharedFolder sharedFolder, List newAddedUserIds) throws InternalErrorException, UserManagementSystemException, UserRetrievalFault, UserManagementPortalException { if (newAddedUserIds != null && newAddedUserIds.size() > 0) { if (newAddedUserIds.size() == 1) @@ -387,8 +491,43 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen } /** * {@inheritDoc} + * @throws UserManagementPortalException + * @throws UserRetrievalFault + * @throws UserManagementSystemException */ @Override + public boolean notifyFolderAddedUsers(String userIdToNotify, SharedFolder sharedFolder, List newAddedUserIds) throws InternalErrorException, UserManagementSystemException, UserRetrievalFault, UserManagementPortalException { + if (newAddedUserIds != null && newAddedUserIds.size() > 0) { + if (newAddedUserIds.size() == 1) + return notifyFolderAddedUser(userIdToNotify, sharedFolder, newAddedUserIds.get(0)); + StringBuilder addedUsersFullNames = new StringBuilder(); + UserManager um = new LiferayUserManager(); + for (String userId : newAddedUserIds) + addedUsersFullNames.append(um.getUserByUsername(userId).getFullname()).append(" "); + + Notification not = new Notification( + UUID.randomUUID().toString(), + NotificationType.WP_FOLDER_ADDEDUSER, + userIdToNotify, //user no notify + sharedFolder.getId(), //the + new Date(), + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), + "added "+ addedUsersFullNames +" to your workspace shared folder \""+ sharedFolder.getTitle()+"\"", + false, + currUser.getUsername(), + currUser.getFullname(), + currUser.getUserAvatarId()); + + return saveNotification(not); + } + + return false; + } + /** + * {@inheritDoc} + */ + @Override + @Deprecated public boolean notifyFolderRemovedUser(String userIdToNotify, WorkspaceSharedFolder sharedFolder) throws InternalErrorException, UserManagementSystemException, UserRetrievalFault, UserManagementPortalException { Notification not = new Notification( UUID.randomUUID().toString(), @@ -405,11 +544,32 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen return saveNotification(not); } + /** + * {@inheritDoc} + */ + @Override + public boolean notifyFolderRemovedUser(String userIdToNotify, SharedFolder sharedFolder) throws InternalErrorException, UserManagementSystemException, UserRetrievalFault, UserManagementPortalException { + Notification not = new Notification( + UUID.randomUUID().toString(), + NotificationType.WP_FOLDER_REMOVEDUSER, + userIdToNotify, //user no notify + sharedFolder.getId(), //the + new Date(), + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), + "unshared his shared folder \""+ sharedFolder.getTitle() + "\" from your workspace", + false, + currUser.getUsername(), + currUser.getFullname(), + currUser.getUserAvatarId()); + + return saveNotification(not); + } /** * {@inheritDoc} * @throws InternalErrorException */ @Override + @Deprecated public boolean notifyAddedItem(String userIdToNotify, WorkspaceItem item, WorkspaceSharedFolder sharedFolder) throws InternalErrorException { String notifyText = sharedFolder.isVreFolder() ? "added "+ item.getName() +" to the workspace group folder " + sharedFolder.getDisplayName() : @@ -435,6 +595,32 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen * @throws InternalErrorException */ @Override + public boolean notifyAddedItem(String userIdToNotify, Item item, SharedFolder sharedFolder) throws InternalErrorException { + String notifyText = sharedFolder.isVreFolder() ? + "added "+ item.getTitle() +" to the workspace group folder " + sharedFolder.getDisplayName() : + "added "+ item.getTitle() +" to your workspace shared folder "+ item.getPath().substring(0,item.getPath().lastIndexOf('/')); + + Notification not = new Notification( + UUID.randomUUID().toString(), + NotificationType.WP_ITEM_NEW, + userIdToNotify, //user no notify + item.getId(), //the + new Date(), + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+item.getParentId(), + notifyText, + false, + currUser.getUsername(), + currUser.getFullname(), + currUser.getUserAvatarId()); + + return saveNotification(not); + } + /** + * {@inheritDoc} + * @throws InternalErrorException + */ + @Override + @Deprecated public boolean notifyMovedItem(String userIdToNotify, WorkspaceItem item, WorkspaceSharedFolder sharedFolder) throws InternalErrorException { String notifyText = sharedFolder.isVreFolder() ? "removed item "+ item.getName() +" from the workspace group folder " + sharedFolder.getDisplayName(): "removed item "+ item.getName() +" from your workspace shared folder \""+ sharedFolder.getName()+"\""; @@ -452,6 +638,29 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen currUser.getFullname(), currUser.getUserAvatarId()); + return saveNotification(not); + }/** + * {@inheritDoc} + * @throws InternalErrorException + */ + @Override + public boolean notifyMovedItem(String userIdToNotify, Item item, SharedFolder sharedFolder) throws InternalErrorException { + String notifyText = sharedFolder.isVreFolder() ? "removed item "+ item.getName() +" from the workspace group folder " + sharedFolder.getDisplayName(): + "removed item "+ item.getName() +" from your workspace shared folder \""+ sharedFolder.getTitle()+"\""; + + Notification not = new Notification( + UUID.randomUUID().toString(), + NotificationType.WP_ITEM_DELETE, + userIdToNotify, //user no notify + item.getId(), //the + new Date(), + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), + notifyText, + false, + currUser.getUsername(), + currUser.getFullname(), + currUser.getUserAvatarId()); + return saveNotification(not); } /** @@ -459,6 +668,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen * @throws InternalErrorException */ @Override + @Deprecated public boolean notifyRemovedItem(String userIdToNotify, String itemName, WorkspaceSharedFolder sharedFolder) throws InternalErrorException { String notifyText = sharedFolder.isVreFolder() ? "deleted item \""+ itemName +"\" from the workspace group folder " + sharedFolder.getDisplayName(): " deleted item \""+ itemName +"\" from your workspace shared folder \""+ sharedFolder.getName()+"\""; @@ -483,6 +693,31 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen * @throws InternalErrorException */ @Override + public boolean notifyRemovedItem(String userIdToNotify, String itemName, SharedFolder sharedFolder) throws InternalErrorException { + String notifyText = sharedFolder.isVreFolder() ? "deleted item \""+ itemName +"\" from the workspace group folder " + sharedFolder.getDisplayName(): + " deleted item \""+ itemName +"\" from your workspace shared folder \""+ sharedFolder.getTitle()+"\""; + + Notification not = new Notification( + UUID.randomUUID().toString(), + NotificationType.WP_ITEM_DELETE, + userIdToNotify, //user no notify + sharedFolder.getId(), //the + new Date(), + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), + notifyText, + false, + currUser.getUsername(), + currUser.getFullname(), + currUser.getUserAvatarId()); + + return saveNotification(not); + } + /** + * {@inheritDoc} + * @throws InternalErrorException + */ + @Override + @Deprecated public boolean notifyUpdatedItem(String userIdToNotify, WorkspaceItem item, WorkspaceSharedFolder sharedFolder) throws InternalErrorException { String notifyText = sharedFolder.isVreFolder() ? " updated \""+ item.getName() +"\" from the workspace group folder \"" + sharedFolder.getDisplayName()+"\"": " updated \""+ item.getName() +"\" to your workspace shared folder \""+ item.getPath().substring(0,item.getPath().lastIndexOf('/'))+"\""; @@ -507,6 +742,31 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen * @throws InternalErrorException */ @Override + public boolean notifyUpdatedItem(String userIdToNotify, Item item, SharedFolder sharedFolder) throws InternalErrorException { + String notifyText = sharedFolder.isVreFolder() ? " updated \""+ item.getName() +"\" from the workspace group folder \"" + sharedFolder.getDisplayName()+"\"": + " updated \""+ item.getName() +"\" to your workspace shared folder \""+ item.getPath().substring(0,item.getPath().lastIndexOf('/'))+"\""; + + Notification not = new Notification( + UUID.randomUUID().toString(), + NotificationType.WP_ITEM_UPDATED, + userIdToNotify, //user no notify + item.getId(), //the + new Date(), + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+item.getParentId(), + notifyText, + false, + currUser.getUsername(), + currUser.getFullname(), + currUser.getUserAvatarId()); + + return saveNotification(not); + } + /** + * {@inheritDoc} + * @throws InternalErrorException + */ + @Override + @Deprecated public boolean notifyItemRenaming(String userIdToNotify, String previousName, WorkspaceItem renamedItem, WorkspaceSharedFolder rootSharedFolder) throws InternalErrorException { String notifyText = rootSharedFolder.isVreFolder() ? "renamed \""+ previousName +"\" as \"" + renamedItem.getName() +"\" in the workspace group folder " + rootSharedFolder.getDisplayName(): "renamed \"" + previousName +"\" as \"" + renamedItem.getName() +"\" in your shared folder \"" + renamedItem.getPath().substring(0, renamedItem.getPath().lastIndexOf('/'))+"\""; @@ -526,6 +786,30 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen return saveNotification(not); } + /** + * {@inheritDoc} + * @throws InternalErrorException + */ + @Override + public boolean notifyItemRenaming(String userIdToNotify, String previousName, Item renamedItem, SharedFolder rootSharedFolder) throws InternalErrorException { + String notifyText = rootSharedFolder.isVreFolder() ? "renamed \""+ previousName +"\" as \"" + renamedItem.getName() +"\" in the workspace group folder " + rootSharedFolder.getDisplayName(): + "renamed \"" + previousName +"\" as \"" + renamedItem.getName() +"\" in your shared folder \"" + renamedItem.getPath().substring(0, renamedItem.getPath().lastIndexOf('/'))+"\""; + + Notification not = new Notification( + UUID.randomUUID().toString(), + NotificationType.WP_ITEM_RENAMED, + userIdToNotify, //user no notify + renamedItem.getId(), //the + new Date(), + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+renamedItem.getParentId(), + notifyText, + false, + currUser.getUsername(), + currUser.getFullname(), + currUser.getUserAvatarId()); + + return saveNotification(not); + } /** * {@inheritDoc} */ diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/NotificationsManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/NotificationsManager.java index f09f7ec..ff7df60 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/NotificationsManager.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/NotificationsManager.java @@ -7,6 +7,8 @@ import java.util.Set; import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder; import org.gcube.common.homelibrary.home.workspace.WorkspaceItem; import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder; +import org.gcube.common.storagehub.model.items.Item; +import org.gcube.common.storagehub.model.items.SharedFolder; import org.gcube.portal.databook.shared.NotificationType; import org.gcube.portal.databook.shared.RunningJob; /** @@ -21,8 +23,17 @@ public interface NotificationsManager { * @param userIdToNotify the user you want to notify * @param sharedFolder the shared {@link WorkspaceSharedFolder} * @return true if the notification is correctly delivered, false otherwise + * @deprecated use {@link SharedFolder} */ boolean notifyFolderSharing(String userIdToNotify, WorkspaceSharedFolder sharedFolder) throws Exception; + /** + * use to notify a user he got a workspace folder shared + * + * @param userIdToNotify the user you want to notify + * @param sharedFolder the shared {@link SharedFolder} instance + * @return true if the notification is correctly delivered, false otherwise + */ + boolean notifyFolderSharing(String userIdToNotify, SharedFolder sharedFolder) throws Exception; /** * use to notify a user he got a workspace folder shared * @@ -38,16 +49,35 @@ public interface NotificationsManager { * @param userIdToNotify the user you want to notify * @param sharedFolder the shared {@link WorkspaceSharedFolder} * @return true if the notification is correctly delivered, false otherwise + * @deprecated use {@link SharedFolder} */ boolean notifyAdministratorUpgrade(String userIdToNotify, WorkspaceSharedFolder sharedFolder) throws Exception; + /** + * use to notify a user he got upgraded to Administrator of a folder shared + * + * @param userIdToNotify the user you want to notify + * @param sharedFolder the shared {@link SharedFolder} instance + * @return true if the notification is correctly delivered, false otherwise + * + */ + boolean notifyAdministratorUpgrade(String userIdToNotify, SharedFolder sharedFolder) throws Exception; /** * use to notify a user he got downgraded from Administrator of a folder shared * * @param userIdToNotify the user you want to notify * @param sharedFolder the shared {@link WorkspaceSharedFolder} * @return true if the notification is correctly delivered, false otherwise + * @deprecated use {@link SharedFolder} */ boolean notifyAdministratorDowngrade(String userIdToNotify, WorkspaceSharedFolder sharedFolder) throws Exception; + /** + * use to notify a user he got downgraded from Administrator of a folder shared + * + * @param userIdToNotify the user you want to notify + * @param sharedFolder the shared {@link SharedFolder} + * @return true if the notification is correctly delivered, false otherwise + */ + boolean notifyAdministratorDowngrade(String userIdToNotify, SharedFolder sharedFolder) throws Exception; /** * use to notify a user he got a workspace folder renamed * @@ -65,8 +95,18 @@ public interface NotificationsManager { * @param sharedFolder the shared {@link WorkspaceSharedFolder} * @param newAddedUserId the new user that was added * @return true if the notification is correctly delivered, false otherwise + * @deprecated use {@link SharedFolder} */ boolean notifyFolderAddedUser(String userIdToNotify, WorkspaceSharedFolder sharedFolder, String newAddedUserId) throws Exception; + /** + * use to notify a user that a new user was added in on of his workspace shared folder + * + * @param userIdToNotify the user you want to notify + * @param sharedFolder the shared {@link SharedFolder} instance + * @param newAddedUserId the new user that was added + * @return true if the notification is correctly delivered, false otherwise + */ + boolean notifyFolderAddedUser(String userIdToNotify, SharedFolder sharedFolder, String newAddedUserId) throws Exception; /** * use to notify a user that a new user was added in on of his workspace shared folder * @@ -74,32 +114,79 @@ public interface NotificationsManager { * @param sharedFolder the shared {@link WorkspaceSharedFolder} * @param newAddedUserIds List of new users that were added * @return true if the notification is correctly delivered, false otherwise + * @deprecated use {@link SharedFolder} */ boolean notifyFolderAddedUsers(String userIdToNotify, WorkspaceSharedFolder sharedFolder, List newAddedUserIds) throws Exception; + /** + * use to notify a user that a new user was added in on of his workspace shared folder + * + * @param userIdToNotify the user you want to notify + * @param sharedFolder the shared {@link SharedFolder} instance + * @param newAddedUserIds List of new users that were added + * @return true if the notification is correctly delivered, false otherwise + */ + boolean notifyFolderAddedUsers(String userIdToNotify, SharedFolder sharedFolder, List newAddedUserIds) throws Exception; + /** * use to notify a user that an existing user was removed from one of his workspace shared folder * * @param userIdToNotify the user you want to notify * @param sharedFolder the shared {@link WorkspaceSharedFolder} * @return true if the notification is correctly delivered, false otherwise + * @deprecated use {@link SharedFolder} */ boolean notifyFolderRemovedUser(String userIdToNotify, WorkspaceSharedFolder sharedFolder) throws Exception; + /** + * use to notify a user that an existing user was removed from one of his workspace shared folder + * + * @param userIdToNotify the user you want to notify + * @param sharedFolder the shared {@link SharedFolder} + * @return true if the notification is correctly delivered, false otherwise + */ + boolean notifyFolderRemovedUser(String userIdToNotify, SharedFolder sharedFolder) throws Exception; /** * use to notify a user he got a workspace item new in some of his workspace shared folder * @param userIdToNotify the user you want to notify * @param newItem the new shared {@link WorkspaceItem} * @param sharedFolder the shared folder {@link WorkspaceSharedFolder} * @return true if the notification is correctly delivered, false otherwise + * @deprecated use {@link SharedFolder} and {@link Item} */ boolean notifyAddedItem(String userIdToNotify, WorkspaceItem item, WorkspaceSharedFolder sharedFolder) throws Exception; + /** + * use to notify a user he got a workspace item new in some of his workspace shared folder + * @param userIdToNotify the user you want to notify + * @param newItem the new shared {@link Item} instance + * @param sharedFolder the shared folder {@link SharedFolder} instance + * @return true if the notification is correctly delivered, false otherwise + */ + boolean notifyAddedItem(String userIdToNotify, Item item, SharedFolder sharedFolder) throws Exception; /** * use to notify a user he got a workspace item deleted from one of his workspace shared folder * @param userIdToNotify the user you want to notify * @param removedItem the removed {@link WorkspaceItem} * @param sharedFolder the shared folder {@link WorkspaceSharedFolder} * @return true if the notification is correctly delivered, false otherwise + * @deprecated use {@link SharedFolder} and {@link Item} */ boolean notifyMovedItem(String userIdToNotify, WorkspaceItem item, WorkspaceSharedFolder sharedFolder) throws Exception; + /** + * use to notify a user he got a workspace item deleted from one of his workspace shared folder + * @param userIdToNotify the user you want to notify + * @param removedItem the removed {@link Item} + * @param sharedFolder the shared folder {@link haredFolder} + * @return true if the notification is correctly delivered, false otherwise + */ + boolean notifyMovedItem(String userIdToNotify, Item item, SharedFolder sharedFolder) throws Exception; + /** + * use to notify a user he got a workspace item deleted from one of his workspace shared folder + * @param userIdToNotify the user you want to notify + * @param removedItem the removed {@link WorkspaceItem} + * @param sharedFolder the shared folder {@link WorkspaceSharedFolder} + * @return true if the notification is correctly delivered, false otherwise + * @deprecated use {@link SharedFolder} + */ + boolean notifyRemovedItem(String userIdToNotify, String item, WorkspaceSharedFolder sharedFolder) throws Exception; /** * use to notify a user he got a workspace item deleted from one of his workspace shared folder * @param userIdToNotify the user you want to notify @@ -107,16 +194,24 @@ public interface NotificationsManager { * @param sharedFolder the shared folder {@link WorkspaceSharedFolder} * @return true if the notification is correctly delivered, false otherwise */ - boolean notifyRemovedItem(String userIdToNotify, String item, WorkspaceSharedFolder sharedFolder) throws Exception; - + boolean notifyRemovedItem(String userIdToNotify, String item, SharedFolder sharedFolder) throws Exception; /** * use to notify a user he got a workspace item updated from one of his workspace shared folder * @param userIdToNotify the user you want to notify * @param updatedItem the updated shared {@link WorkspaceItem} * @param sharedFolder the shared folder {@link WorkspaceFolder} * @return true if the notification is correctly delivered, false otherwise + * @deprecated use {@link SharedFolder} and {@link Item} */ boolean notifyUpdatedItem(String userIdToNotify, WorkspaceItem item, WorkspaceSharedFolder sharedFolder) throws Exception; + /** + * use to notify a user he got a workspace item updated from one of his workspace shared folder + * @param userIdToNotify the user you want to notify + * @param updatedItem the updated shared {@link Item} + * @param sharedFolder the shared folder {@link SharedFolder} + * @return true if the notification is correctly delivered, false otherwise + */ + boolean notifyUpdatedItem(String userIdToNotify, Item item, SharedFolder sharedFolder) throws Exception; /** * use to notify a user he got a workspace item renamed * @@ -125,8 +220,19 @@ public interface NotificationsManager { * @param renamedItem the renamed {@link WorkspaceItem} * @param rootSharedFolder the root shared {@link WorkspaceSharedFolder} of the {@link WorkspaceItem} * @return true if the notification is correctly delivered, false otherwise + * @deprecated use {@link SharedFolder} and {@link Item} */ - boolean notifyItemRenaming(String userIdToNotify, String previousName, WorkspaceItem renamedItem, WorkspaceSharedFolder rootSharedFolder) throws Exception; + boolean notifyItemRenaming(String userIdToNotify, String previousName, WorkspaceItem renamedItem, WorkspaceSharedFolder rootSharedFolder) 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 Item} + * @param rootSharedFolder the root shared {@link SharedFolder} of the {@link Item} + * @return true if the notification is correctly delivered, false otherwise + */ + boolean notifyItemRenaming(String userIdToNotify, String previousName,Item renamedItem, SharedFolder rootSharedFolder) throws Exception; /** * * @param userIdToNotify the user you want to notify