integrated notifications for set/unset shared folder administrator
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@100278 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
7431c1575e
commit
c66fec20ab
|
@ -164,6 +164,51 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
|
|||
|
||||
return saveNotification(not);
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public boolean notifyAdministratorUpgrade(String userIdToNotify, WorkspaceSharedFolder sharedFolder) throws Exception {
|
||||
String sharedFolderName = sharedFolder.getName();
|
||||
Notification not = new Notification(
|
||||
UUID.randomUUID().toString(),
|
||||
NotificationType.WP_ADMIN_UPGRADE,
|
||||
userIdToNotify, //user no notify
|
||||
sharedFolder.getId(),
|
||||
new Date(),
|
||||
getApplicationUrl()+"?itemid="+sharedFolder.getId(),
|
||||
"upgraded you to Administrator of the workspace folder \""+ sharedFolderName+"\"",
|
||||
false,
|
||||
aslSession.getUsername(),
|
||||
aslSession.getUserFullName(),
|
||||
aslSession.getUserAvatarId());
|
||||
|
||||
return saveNotification(not);
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public boolean notifyAdministratorDowngrade(String userIdToNotify, WorkspaceSharedFolder sharedFolder) throws Exception {
|
||||
String sharedFolderName = sharedFolder.getName();
|
||||
Notification not = new Notification(
|
||||
UUID.randomUUID().toString(),
|
||||
NotificationType.WP_ADMIN_DOWNGRADE,
|
||||
userIdToNotify, //user no notify
|
||||
sharedFolder.getId(),
|
||||
new Date(),
|
||||
getApplicationUrl()+"?itemid="+sharedFolder.getId(),
|
||||
"downgraded you from Administrator of the workspace folder \""+ sharedFolderName+"\"",
|
||||
false,
|
||||
aslSession.getUsername(),
|
||||
aslSession.getUserFullName(),
|
||||
aslSession.getUserAvatarId());
|
||||
|
||||
return saveNotification(not);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @throws InternalErrorException
|
||||
|
@ -817,6 +862,6 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
|
|||
_log.debug("Returning SENDER_EMAIL: " + toReturn );
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,11 +3,11 @@ package org.gcube.applicationsupportlayer.social;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portal.databook.shared.ApplicationProfile;
|
||||
import org.gcube.portal.databook.shared.RunningJob;
|
||||
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.portal.databook.shared.ApplicationProfile;
|
||||
import org.gcube.portal.databook.shared.RunningJob;
|
||||
/**
|
||||
*
|
||||
* @author Massimiliano Assante, ISTI-CNR
|
||||
|
@ -31,6 +31,22 @@ public interface NotificationsManager {
|
|||
* @return true if the notification is correctly delivered, false otherwise
|
||||
*/
|
||||
boolean notifyFolderUnsharing(String userIdToNotify, String unsharedFolderId, String unsharedFolderName) 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 WorkspaceSharedFolder}
|
||||
* @return true if the notification is correctly delivered, false otherwise
|
||||
*/
|
||||
boolean notifyAdministratorUpgrade(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 WorkspaceSharedFolder}
|
||||
* @return true if the notification is correctly delivered, false otherwise
|
||||
*/
|
||||
boolean notifyAdministratorDowngrade(String userIdToNotify, WorkspaceSharedFolder sharedFolder) throws Exception;
|
||||
/**
|
||||
* use to notify a user he got a workspace folder renamed
|
||||
*
|
||||
|
|
|
@ -20,7 +20,6 @@ import org.gcube.common.portal.PortalContext;
|
|||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.portal.databook.shared.ex.TooManyRunningClustersException;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
import org.slf4j.Logger;
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
package org.gcube.applicationsupportlayer.social.mailing;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.mail.Message;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.Multipart;
|
||||
import javax.mail.Session;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
|
@ -258,6 +256,10 @@ public class EmailPlugin {
|
|||
return notification2Save.getSenderFullName()+ " shared a folder with you";
|
||||
case WP_FOLDER_UNSHARE:
|
||||
return notification2Save.getSenderFullName()+ " unshared a folder of yours";
|
||||
case WP_ADMIN_UPGRADE:
|
||||
return notification2Save.getSenderFullName()+ " upgraded you as a folder administrator";
|
||||
case WP_ADMIN_DOWNGRADE:
|
||||
return notification2Save.getSenderFullName()+ " downgraded you as from folder administrator";
|
||||
case WP_ITEM_NEW:
|
||||
return notification2Save.getSenderFullName()+ " added an item in a shared folder";
|
||||
case WP_ITEM_DELETE:
|
||||
|
|
Loading…
Reference in New Issue