fixed notifications for VRE SHared Folders

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@91554 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2014-02-13 16:46:34 +00:00
parent 07ab86fd8e
commit e16de78048
2 changed files with 55 additions and 12 deletions

View File

@ -12,16 +12,16 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/> <attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>
</classpath> </classpath>

View File

@ -15,6 +15,7 @@ import org.gcube.portal.databook.shared.RunningJob;
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException; import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
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.vomanagement.usermanagement.UserManager; import org.gcube.vomanagement.usermanagement.UserManager;
import org.gcube.vomanagement.usermanagement.exception.UserManagementPortalException; import org.gcube.vomanagement.usermanagement.exception.UserManagementPortalException;
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException; import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
@ -103,6 +104,12 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
*/ */
@Override @Override
public boolean notifyFolderSharing(String userIdToNotify, WorkspaceFolder sharedFolder) throws InternalErrorException { public boolean notifyFolderSharing(String userIdToNotify, WorkspaceFolder sharedFolder) throws InternalErrorException {
String sharedFolderName = sharedFolder.getName();
if (sharedFolder.isShared()) {
WorkspaceSharedFolder sharedWSFolder = (WorkspaceSharedFolder) sharedFolder;
if (sharedWSFolder.isVreFolder())
sharedFolderName = sharedWSFolder.getDisplayName();
}
Notification not = new Notification( Notification not = new Notification(
UUID.randomUUID().toString(), UUID.randomUUID().toString(),
NotificationType.WP_FOLDER_SHARE, NotificationType.WP_FOLDER_SHARE,
@ -110,7 +117,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
sharedFolder.getId(), //the sharedFolder.getId(), //the
new Date(), new Date(),
getApplicationUrl()+"?itemid="+sharedFolder.getId(), getApplicationUrl()+"?itemid="+sharedFolder.getId(),
"shared the workspace folder "+ sharedFolder.getName() +" with you", "shared the workspace folder "+ sharedFolderName +" with you",
false, false,
aslSession.getUsername(), aslSession.getUsername(),
aslSession.getUserFullName(), aslSession.getUserFullName(),
@ -224,6 +231,14 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
*/ */
@Override @Override
public boolean notifyAddedItem(String userIdToNotify, WorkspaceItem item, WorkspaceFolder sharedFolder) throws InternalErrorException { public boolean notifyAddedItem(String userIdToNotify, WorkspaceItem item, WorkspaceFolder sharedFolder) throws InternalErrorException {
String notifyText = "added "+ item.getName() +" to your workspace shared folder "+ item.getPath().substring(0,item.getPath().lastIndexOf('/'));
if (sharedFolder.isShared()) {
WorkspaceSharedFolder sharedWSFolder = (WorkspaceSharedFolder) sharedFolder;
if (sharedWSFolder.isVreFolder()) {
notifyText = "added "+ item.getName() +" to the workspace group folder " + sharedWSFolder.getDisplayName();
}
}
Notification not = new Notification( Notification not = new Notification(
UUID.randomUUID().toString(), UUID.randomUUID().toString(),
NotificationType.WP_ITEM_NEW, NotificationType.WP_ITEM_NEW,
@ -231,7 +246,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
item.getId(), //the item.getId(), //the
new Date(), new Date(),
getApplicationUrl()+"?itemid="+item.getParent().getId(), getApplicationUrl()+"?itemid="+item.getParent().getId(),
"added "+ item.getName() +" to your workspace shared folder "+ item.getPath().substring(0,item.getPath().lastIndexOf('/')), notifyText,
false, false,
aslSession.getUsername(), aslSession.getUsername(),
aslSession.getUserFullName(), aslSession.getUserFullName(),
@ -245,6 +260,13 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
*/ */
@Override @Override
public boolean notifyMovedItem(String userIdToNotify, WorkspaceItem item, WorkspaceFolder sharedFolder) throws InternalErrorException { public boolean notifyMovedItem(String userIdToNotify, WorkspaceItem item, WorkspaceFolder sharedFolder) throws InternalErrorException {
String notifyText = "removed item "+ item.getName() +" from your workspace shared folder "+ sharedFolder.getName();
if (sharedFolder.isShared()) {
WorkspaceSharedFolder sharedWSFolder = (WorkspaceSharedFolder) sharedFolder;
if (sharedWSFolder.isVreFolder()) {
notifyText = "removed item "+ item.getName() +" from the workspace group folder " + sharedWSFolder.getDisplayName();
}
}
Notification not = new Notification( Notification not = new Notification(
UUID.randomUUID().toString(), UUID.randomUUID().toString(),
NotificationType.WP_ITEM_DELETE, NotificationType.WP_ITEM_DELETE,
@ -252,7 +274,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
item.getId(), //the item.getId(), //the
new Date(), new Date(),
getApplicationUrl()+"?itemid="+sharedFolder.getId(), getApplicationUrl()+"?itemid="+sharedFolder.getId(),
"removed item "+ item.getName() +" from your workspace shared folder "+ sharedFolder.getName(), notifyText,
false, false,
aslSession.getUsername(), aslSession.getUsername(),
aslSession.getUserFullName(), aslSession.getUserFullName(),
@ -266,6 +288,13 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
*/ */
@Override @Override
public boolean notifyRemovedItem(String userIdToNotify, String itemName, WorkspaceFolder sharedFolder) throws InternalErrorException { public boolean notifyRemovedItem(String userIdToNotify, String itemName, WorkspaceFolder sharedFolder) throws InternalErrorException {
String notifyText = "deleted item "+ itemName +" from your workspace shared folder "+ sharedFolder.getName();
if (sharedFolder.isShared()) {
WorkspaceSharedFolder sharedWSFolder = (WorkspaceSharedFolder) sharedFolder;
if (sharedWSFolder.isVreFolder()) {
notifyText = "deleted item "+ itemName +" from the workspace group folder " + sharedWSFolder.getDisplayName();
}
}
Notification not = new Notification( Notification not = new Notification(
UUID.randomUUID().toString(), UUID.randomUUID().toString(),
NotificationType.WP_ITEM_DELETE, NotificationType.WP_ITEM_DELETE,
@ -273,7 +302,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
sharedFolder.getId(), //the sharedFolder.getId(), //the
new Date(), new Date(),
getApplicationUrl()+"?itemid="+sharedFolder.getId(), getApplicationUrl()+"?itemid="+sharedFolder.getId(),
"deleted item "+ itemName +" from your workspace shared folder "+ sharedFolder.getName(), notifyText,
false, false,
aslSession.getUsername(), aslSession.getUsername(),
aslSession.getUserFullName(), aslSession.getUserFullName(),
@ -287,6 +316,13 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
*/ */
@Override @Override
public boolean notifyUpdatedItem(String userIdToNotify, WorkspaceItem item, WorkspaceFolder sharedFolder) throws InternalErrorException { public boolean notifyUpdatedItem(String userIdToNotify, WorkspaceItem item, WorkspaceFolder sharedFolder) throws InternalErrorException {
String notifyText = " updated "+ item.getName() +" to your workspace shared folder "+ item.getPath().substring(0,item.getPath().lastIndexOf('/'));
if (sharedFolder.isShared()) {
WorkspaceSharedFolder sharedWSFolder = (WorkspaceSharedFolder) sharedFolder;
if (sharedWSFolder.isVreFolder()) {
notifyText = " updated "+ item.getName() +" from the workspace group folder " + sharedWSFolder.getDisplayName();
}
}
Notification not = new Notification( Notification not = new Notification(
UUID.randomUUID().toString(), UUID.randomUUID().toString(),
NotificationType.WP_ITEM_UPDATED, NotificationType.WP_ITEM_UPDATED,
@ -294,7 +330,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
item.getId(), //the item.getId(), //the
new Date(), new Date(),
getApplicationUrl()+"?itemid="+item.getParent().getId(), getApplicationUrl()+"?itemid="+item.getParent().getId(),
" updated "+ item.getName() +" to your workspace shared folder "+ item.getPath().substring(0,item.getPath().lastIndexOf('/')), notifyText,
false, false,
aslSession.getUsername(), aslSession.getUsername(),
aslSession.getUserFullName(), aslSession.getUserFullName(),
@ -308,6 +344,13 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
*/ */
@Override @Override
public boolean notifyItemRenaming(String userIdToNotify, String previousName, WorkspaceItem renamedItem) throws InternalErrorException { public boolean notifyItemRenaming(String userIdToNotify, String previousName, WorkspaceItem renamedItem) throws InternalErrorException {
String notifyText = "renamed " + previousName +" as " + renamedItem.getName() +" in your shared folder " + renamedItem.getParent().getName();
if (renamedItem.getParent().isShared()) {
WorkspaceSharedFolder sharedWSFolder = (WorkspaceSharedFolder) renamedItem.getParent();
if (sharedWSFolder.isVreFolder()) {
notifyText = "renamed "+ previousName +" as " + renamedItem.getName() +" in the workspace group folder " + sharedWSFolder.getDisplayName();
}
}
Notification not = new Notification( Notification not = new Notification(
UUID.randomUUID().toString(), UUID.randomUUID().toString(),
NotificationType.WP_ITEM_RENAMED, NotificationType.WP_ITEM_RENAMED,
@ -315,7 +358,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
renamedItem.getId(), //the renamedItem.getId(), //the
new Date(), new Date(),
getApplicationUrl()+"?itemid="+renamedItem.getParent().getId(), getApplicationUrl()+"?itemid="+renamedItem.getParent().getId(),
"renamed " + previousName +" as " + renamedItem.getName() +" in your shared folder " + renamedItem.getParent().getName(), notifyText,
false, false,
aslSession.getUsername(), aslSession.getUsername(),
aslSession.getUserFullName(), aslSession.getUserFullName(),