aslsocial/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsMan...

127 lines
3.3 KiB
Java

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;
import org.gcube.portlets.user.homelibrary.home.workspace.sharing.WorkspaceMessage;
/**
*
* @author Massimiliano Assante, ISTI-CNR
* @version 0.1 Dec 2012
*
* 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) {
super(session);
}
/**
* {@inheritDoc}
*/
@Override
public boolean notifyFolderSharing(String userIdToNotify, WorkspaceFolder sharedFolder) {
return true;
}
/**
* {@inheritDoc}
*/
@Override
public boolean notifyFolderAddedUser(String userIdToNotify, WorkspaceFolder sharedFolder, String newAddedUserId) {
return true;
}
/**
* {@inheritDoc}
*/
@Override
public boolean notifyFolderRemovedUser(String userIdToNotify, WorkspaceFolder sharedFolder, String removedUserId) {
return true;
}
/**
* {@inheritDoc}
*/
@Override
public boolean notifyAddedItem(String userIdToNotify, WorkspaceItem newItem) {
return true;
}
/**
* {@inheritDoc}
*/
@Override
public boolean notifyRemovedItem(String userIdToNotify, WorkspaceItem removedItem) {
return true;
}
/**
* {@inheritDoc}
*/
@Override
public boolean notifyUpdatedItem(String userIdToNotify, WorkspaceItem updatedItem) {
return true;
}
/**
* {@inheritDoc}
*/
@Override
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}
*/
@Override
public boolean notifyOwnCommentReply(String userIdToNotify, Comment comment) {
return true;
}
/**
* {@inheritDoc}
*/
@Override
public boolean notifyCommentReply(String userIdToNotify, Comment comment) {
return true;
}
/**
* {@inheritDoc}
*/
@Override
public boolean notifyLikedFeed(String userIdToNotify, Feed likedFeed) {
return true;
}
@Override
public boolean notifyJobStatus(String userIdToNotify,
ApplicationProfile executingJobApId, RunningJob job) {
// TODO Auto-generated method stub
return false;
}
}