removed portletXClassName for NotificationsManager why was even there?

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@67400 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2013-01-09 16:47:22 +00:00
parent 1bfe6577b0
commit b6cc3f9032
3 changed files with 35 additions and 7 deletions

View File

@ -1,9 +1,15 @@
package org.gcube.applicationsupportlayer.social;
import java.util.Date;
import java.util.UUID;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.common.core.utils.logging.GCUBEClientLog;
import org.gcube.portal.databook.shared.ApplicationProfile;
import org.gcube.portal.databook.shared.Comment;
import org.gcube.portal.databook.shared.Feed;
import org.gcube.portal.databook.shared.Notification;
import org.gcube.portal.databook.shared.NotificationType;
import org.gcube.portal.databook.shared.RunningJob;
import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceFolder;
import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceItem;
@ -16,13 +22,14 @@ import org.gcube.portlets.user.homelibrary.home.workspace.sharing.WorkspaceMessa
* use to notify users from within your application
*/
public class ApplicationNotificationsManager extends SocialPortalBridge implements NotificationsManager {
static GCUBEClientLog _log = new GCUBEClientLog(ApplicationNotificationsManager.class);
/**
*
* @param aslSession the ASLSession instance
* @param portletClassName your portlet class name will be used ad unique identifier for your applicationProfile
*/
public ApplicationNotificationsManager(ASLSession session, String portletClassName) {
super(session, portletClassName);
public ApplicationNotificationsManager(ASLSession session) {
super(session);
}
/**
* {@inheritDoc}
@ -70,8 +77,21 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
* {@inheritDoc}
*/
@Override
public boolean notifyMessageReceived(String userIdToNotify, WorkspaceMessage message) {
return true;
public boolean notifyMessageReceived(String userIdToNotify, String subject) {
Notification not = new Notification(
UUID.randomUUID().toString(),
NotificationType.MESSAGE,
userIdToNotify, //user no notify
"messageid_not_provided", //the
new Date(),
"",
" has sent you a message with subject: " + subject,
false,
aslSession.getUsername(),
aslSession.getUserFullName(),
aslSession.getUserAvatarId());
return getStoreInstance().saveNotification(not);
}
/**
* {@inheritDoc}
@ -101,6 +121,6 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
return false;
}
}

View File

@ -64,10 +64,10 @@ public interface NotificationsManager {
/**
*
* @param userIdToNotify the user you want to notify
* @param message the {@link WorkspaceMessage} sent
* @param subject the subject of the message sent
* @return true if the notification is correctly delivered, false otherwise
*/
boolean notifyMessageReceived(String userIdToNotify, WorkspaceMessage message);
boolean notifyMessageReceived(String userIdToNotify, String subject);
/**
*
* @param userIdToNotify the user you want to notify

View File

@ -39,6 +39,14 @@ public class SocialPortalBridge {
this.aslSession = session;
this.applicationProfile = getProfileFromInfrastrucure(portletClassName);
}
/**
*
* @param session
*/
public SocialPortalBridge(ASLSession session) {
this.aslSession = session;
this.applicationProfile = null;
}
/**
*
* @return the unique instance of the store