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
This commit is contained in:
Massimiliano Assante 2018-06-19 16:57:22 +00:00
parent 97f79e81c0
commit c69f80c0f8
4 changed files with 403 additions and 4 deletions

View File

@ -1,4 +1,8 @@
<ReleaseNotes> <ReleaseNotes>
<Changeset component="org.gcube.applicationsupportlayer.aslsocial.1-4-0"
date="2018-06-19">
<Change>Added support for storage hub model in workspace related notifications</Change>
</Changeset>
<Changeset component="org.gcube.applicationsupportlayer.aslsocial.1-3-0" <Changeset component="org.gcube.applicationsupportlayer.aslsocial.1-3-0"
date="2017-01-16"> date="2017-01-16">
<Change>partially removed portal context dependency (where possible)</Change> <Change>partially removed portal context dependency (where possible)</Change>

View File

@ -10,7 +10,7 @@
<groupId>org.gcube.applicationsupportlayer</groupId> <groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslsocial</artifactId> <artifactId>aslsocial</artifactId>
<version>1.3.0-SNAPSHOT</version> <version>1.4.0-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Social Portal ASL Extension</name> <name>Social Portal ASL Extension</name>
<description> <description>
@ -47,6 +47,11 @@
<artifactId>portal-manager</artifactId> <artifactId>portal-manager</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>storagehub-model</artifactId>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>org.gcube.common</groupId> <groupId>org.gcube.common</groupId>
<artifactId>home-library</artifactId> <artifactId>home-library</artifactId>

View File

@ -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.exceptions.InternalErrorException;
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem; import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder; 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.Notification;
import org.gcube.portal.databook.shared.NotificationChannelType; import org.gcube.portal.databook.shared.NotificationChannelType;
import org.gcube.portal.databook.shared.NotificationType; import org.gcube.portal.databook.shared.NotificationType;
@ -217,6 +219,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
* @throws InternalErrorException * @throws InternalErrorException
*/ */
@Override @Override
@Deprecated
public boolean notifyFolderSharing(String userIdToNotify, WorkspaceSharedFolder sharedFolder) throws InternalErrorException { public boolean notifyFolderSharing(String userIdToNotify, WorkspaceSharedFolder sharedFolder) throws InternalErrorException {
String sharedFolderName = sharedFolder.getName(); String sharedFolderName = sharedFolder.getName();
if (sharedFolder.isShared()) { if (sharedFolder.isShared()) {
@ -239,6 +242,34 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
return saveNotification(not); 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} * {@inheritDoc}
* @throws Exception * @throws Exception
@ -265,6 +296,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
* @throws Exception * @throws Exception
*/ */
@Override @Override
@Deprecated
public boolean notifyAdministratorUpgrade(String userIdToNotify, WorkspaceSharedFolder sharedFolder) throws Exception { public boolean notifyAdministratorUpgrade(String userIdToNotify, WorkspaceSharedFolder sharedFolder) throws Exception {
String sharedFolderName = sharedFolder.getName(); String sharedFolderName = sharedFolder.getName();
Notification not = new Notification( Notification not = new Notification(
@ -287,6 +319,29 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
* @throws Exception * @throws Exception
*/ */
@Override @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 { public boolean notifyAdministratorDowngrade(String userIdToNotify, WorkspaceSharedFolder sharedFolder) throws Exception {
String sharedFolderName = sharedFolder.getName(); String sharedFolderName = sharedFolder.getName();
Notification not = new Notification( Notification not = new Notification(
@ -304,6 +359,28 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
return saveNotification(not); 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} * {@inheritDoc}
@ -333,6 +410,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
* @throws UserManagementSystemException * @throws UserManagementSystemException
*/ */
@Override @Override
@Deprecated
public boolean notifyFolderAddedUser(String userIdToNotify, WorkspaceSharedFolder sharedFolder, String newAddedUserId) throws InternalErrorException, UserManagementSystemException, UserRetrievalFault, UserManagementPortalException { public boolean notifyFolderAddedUser(String userIdToNotify, WorkspaceSharedFolder sharedFolder, String newAddedUserId) throws InternalErrorException, UserManagementSystemException, UserRetrievalFault, UserManagementPortalException {
UserManager um = new LiferayUserManager(); UserManager um = new LiferayUserManager();
GCubeUser user = um.getUserByUsername(newAddedUserId); GCubeUser user = um.getUserByUsername(newAddedUserId);
@ -358,6 +436,32 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
* @throws UserManagementSystemException * @throws UserManagementSystemException
*/ */
@Override @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<String> newAddedUserIds) throws InternalErrorException, UserManagementSystemException, UserRetrievalFault, UserManagementPortalException { public boolean notifyFolderAddedUsers(String userIdToNotify, WorkspaceSharedFolder sharedFolder, List<String> newAddedUserIds) throws InternalErrorException, UserManagementSystemException, UserRetrievalFault, UserManagementPortalException {
if (newAddedUserIds != null && newAddedUserIds.size() > 0) { if (newAddedUserIds != null && newAddedUserIds.size() > 0) {
if (newAddedUserIds.size() == 1) if (newAddedUserIds.size() == 1)
@ -387,8 +491,43 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
* @throws UserManagementPortalException
* @throws UserRetrievalFault
* @throws UserManagementSystemException
*/ */
@Override @Override
public boolean notifyFolderAddedUsers(String userIdToNotify, SharedFolder sharedFolder, List<String> 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 { public boolean notifyFolderRemovedUser(String userIdToNotify, WorkspaceSharedFolder sharedFolder) throws InternalErrorException, UserManagementSystemException, UserRetrievalFault, UserManagementPortalException {
Notification not = new Notification( Notification not = new Notification(
UUID.randomUUID().toString(), UUID.randomUUID().toString(),
@ -405,11 +544,32 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
return saveNotification(not); 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} * {@inheritDoc}
* @throws InternalErrorException * @throws InternalErrorException
*/ */
@Override @Override
@Deprecated
public boolean notifyAddedItem(String userIdToNotify, WorkspaceItem item, WorkspaceSharedFolder sharedFolder) throws InternalErrorException { public boolean notifyAddedItem(String userIdToNotify, WorkspaceItem item, WorkspaceSharedFolder sharedFolder) throws InternalErrorException {
String notifyText = sharedFolder.isVreFolder() ? String notifyText = sharedFolder.isVreFolder() ?
"added "+ item.getName() +" to the workspace group folder " + sharedFolder.getDisplayName() : "added "+ item.getName() +" to the workspace group folder " + sharedFolder.getDisplayName() :
@ -435,6 +595,32 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
* @throws InternalErrorException * @throws InternalErrorException
*/ */
@Override @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 { 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(): 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()+"\""; "removed item "+ item.getName() +" from your workspace shared folder \""+ sharedFolder.getName()+"\"";
@ -452,6 +638,29 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
currUser.getFullname(), currUser.getFullname(),
currUser.getUserAvatarId()); 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); return saveNotification(not);
} }
/** /**
@ -459,6 +668,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
* @throws InternalErrorException * @throws InternalErrorException
*/ */
@Override @Override
@Deprecated
public boolean notifyRemovedItem(String userIdToNotify, String itemName, WorkspaceSharedFolder sharedFolder) throws InternalErrorException { 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(): String notifyText = sharedFolder.isVreFolder() ? "deleted item \""+ itemName +"\" from the workspace group folder " + sharedFolder.getDisplayName():
" deleted item \""+ itemName +"\" from your workspace shared folder \""+ sharedFolder.getName()+"\""; " deleted item \""+ itemName +"\" from your workspace shared folder \""+ sharedFolder.getName()+"\"";
@ -483,6 +693,31 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
* @throws InternalErrorException * @throws InternalErrorException
*/ */
@Override @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 { 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()+"\"": 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('/'))+"\""; " 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 * @throws InternalErrorException
*/ */
@Override @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 { 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(): 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('/'))+"\""; "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); 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} * {@inheritDoc}
*/ */

View File

@ -7,6 +7,8 @@ import java.util.Set;
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder; import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem; import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder; 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.NotificationType;
import org.gcube.portal.databook.shared.RunningJob; import org.gcube.portal.databook.shared.RunningJob;
/** /**
@ -21,8 +23,17 @@ public interface NotificationsManager {
* @param userIdToNotify the user you want to notify * @param userIdToNotify the user you want to notify
* @param sharedFolder the shared {@link WorkspaceSharedFolder} * @param sharedFolder the shared {@link WorkspaceSharedFolder}
* @return true if the notification is correctly delivered, false otherwise * @return true if the notification is correctly delivered, false otherwise
* @deprecated use {@link SharedFolder}
*/ */
boolean notifyFolderSharing(String userIdToNotify, WorkspaceSharedFolder sharedFolder) throws Exception; 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 * 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 userIdToNotify the user you want to notify
* @param sharedFolder the shared {@link WorkspaceSharedFolder} * @param sharedFolder the shared {@link WorkspaceSharedFolder}
* @return true if the notification is correctly delivered, false otherwise * @return true if the notification is correctly delivered, false otherwise
* @deprecated use {@link SharedFolder}
*/ */
boolean notifyAdministratorUpgrade(String userIdToNotify, WorkspaceSharedFolder sharedFolder) throws Exception; 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 * use to notify a user he got downgraded from Administrator of a folder shared
* *
* @param userIdToNotify the user you want to notify * @param userIdToNotify the user you want to notify
* @param sharedFolder the shared {@link WorkspaceSharedFolder} * @param sharedFolder the shared {@link WorkspaceSharedFolder}
* @return true if the notification is correctly delivered, false otherwise * @return true if the notification is correctly delivered, false otherwise
* @deprecated use {@link SharedFolder}
*/ */
boolean notifyAdministratorDowngrade(String userIdToNotify, WorkspaceSharedFolder sharedFolder) throws Exception; 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 * 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 sharedFolder the shared {@link WorkspaceSharedFolder}
* @param newAddedUserId the new user that was added * @param newAddedUserId the new user that was added
* @return true if the notification is correctly delivered, false otherwise * @return true if the notification is correctly delivered, false otherwise
* @deprecated use {@link SharedFolder}
*/ */
boolean notifyFolderAddedUser(String userIdToNotify, WorkspaceSharedFolder sharedFolder, String newAddedUserId) throws Exception; 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 * 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 sharedFolder the shared {@link WorkspaceSharedFolder}
* @param newAddedUserIds List of new users that were added * @param newAddedUserIds List of new users that were added
* @return true if the notification is correctly delivered, false otherwise * @return true if the notification is correctly delivered, false otherwise
* @deprecated use {@link SharedFolder}
*/ */
boolean notifyFolderAddedUsers(String userIdToNotify, WorkspaceSharedFolder sharedFolder, List<String> newAddedUserIds) throws Exception; boolean notifyFolderAddedUsers(String userIdToNotify, WorkspaceSharedFolder sharedFolder, List<String> 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<String> newAddedUserIds) throws Exception;
/** /**
* use to notify a user that an existing user was removed from one of his workspace shared folder * 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 userIdToNotify the user you want to notify
* @param sharedFolder the shared {@link WorkspaceSharedFolder} * @param sharedFolder the shared {@link WorkspaceSharedFolder}
* @return true if the notification is correctly delivered, false otherwise * @return true if the notification is correctly delivered, false otherwise
* @deprecated use {@link SharedFolder}
*/ */
boolean notifyFolderRemovedUser(String userIdToNotify, WorkspaceSharedFolder sharedFolder) throws Exception; 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 * 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 userIdToNotify the user you want to notify
* @param newItem the new shared {@link WorkspaceItem} * @param newItem the new shared {@link WorkspaceItem}
* @param sharedFolder the shared folder {@link WorkspaceSharedFolder} * @param sharedFolder the shared folder {@link WorkspaceSharedFolder}
* @return true if the notification is correctly delivered, false otherwise * @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; 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 * 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 userIdToNotify the user you want to notify
* @param removedItem the removed {@link WorkspaceItem} * @param removedItem the removed {@link WorkspaceItem}
* @param sharedFolder the shared folder {@link WorkspaceSharedFolder} * @param sharedFolder the shared folder {@link WorkspaceSharedFolder}
* @return true if the notification is correctly delivered, false otherwise * @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; 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 * 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 userIdToNotify the user you want to notify
@ -107,16 +194,24 @@ public interface NotificationsManager {
* @param sharedFolder the shared folder {@link WorkspaceSharedFolder} * @param sharedFolder the shared folder {@link WorkspaceSharedFolder}
* @return true if the notification is correctly delivered, false otherwise * @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 * 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 userIdToNotify the user you want to notify
* @param updatedItem the updated shared {@link WorkspaceItem} * @param updatedItem the updated shared {@link WorkspaceItem}
* @param sharedFolder the shared folder {@link WorkspaceFolder} * @param sharedFolder the shared folder {@link WorkspaceFolder}
* @return true if the notification is correctly delivered, false otherwise * @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; 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 * 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 renamedItem the renamed {@link WorkspaceItem}
* @param rootSharedFolder the root shared {@link WorkspaceSharedFolder} of the {@link WorkspaceItem} * @param rootSharedFolder the root shared {@link WorkspaceSharedFolder} of the {@link WorkspaceItem}
* @return true if the notification is correctly delivered, false otherwise * @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 * @param userIdToNotify the user you want to notify