removed notification threads as they were moved into a shared library
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@117110 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
8e37675225
commit
88c2e4bb72
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/news-feed-1.9.1-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/news-feed-1.10.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
@ -31,5 +31,5 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/news-feed-1.9.1-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/news-feed-1.10.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
<dependent-module archiveName="session-checker-0.3.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/session-checker/session-checker">
|
<dependent-module archiveName="session-checker-0.3.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/session-checker/session-checker">
|
||||||
<dependency-type>uses</dependency-type>
|
<dependency-type>uses</dependency-type>
|
||||||
</dependent-module>
|
</dependent-module>
|
||||||
<dependent-module archiveName="workspace-light-tree-2.13.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/workspace-light-tree/workspace-light-tree">
|
<dependent-module archiveName="notifications-common-library-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/notifications-common-library/notifications-common-library">
|
||||||
<dependency-type>uses</dependency-type>
|
<dependency-type>uses</dependency-type>
|
||||||
</dependent-module>
|
</dependent-module>
|
||||||
<dependent-module archiveName="wsmail-widget-1.8.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/wsmail-widget/wsmail-widget">
|
<dependent-module archiveName="workspace-light-tree-2.14.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/workspace-light-tree/workspace-light-tree">
|
||||||
<dependency-type>uses</dependency-type>
|
<dependency-type>uses</dependency-type>
|
||||||
</dependent-module>
|
</dependent-module>
|
||||||
<dependent-module archiveName="gcube-widgets-1.9.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-widgets/gcube-widgets">
|
<dependent-module archiveName="gcube-widgets-1.9.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-widgets/gcube-widgets">
|
||||||
|
|
9
pom.xml
9
pom.xml
|
@ -13,7 +13,7 @@
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>news-feed</artifactId>
|
<artifactId>news-feed</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<version>1.9.1-SNAPSHOT</version>
|
<version>1.10.0-SNAPSHOT</version>
|
||||||
|
|
||||||
<name>gCube News Feed Portlet</name>
|
<name>gCube News Feed Portlet</name>
|
||||||
<description>
|
<description>
|
||||||
|
@ -95,6 +95,11 @@
|
||||||
<artifactId>social-networking-library</artifactId>
|
<artifactId>social-networking-library</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.portal</groupId>
|
||||||
|
<artifactId>notifications-common-library</artifactId>
|
||||||
|
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portlets.widgets</groupId>
|
<groupId>org.gcube.portlets.widgets</groupId>
|
||||||
<artifactId>user-selection-dialog</artifactId>
|
<artifactId>user-selection-dialog</artifactId>
|
||||||
|
@ -104,7 +109,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portlets.widgets</groupId>
|
<groupId>org.gcube.portlets.widgets</groupId>
|
||||||
<artifactId>workspace-light-tree</artifactId>
|
<artifactId>workspace-light-tree</artifactId>
|
||||||
<version>[2.13.1-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
<version>[2.14.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portlets.widgets</groupId>
|
<groupId>org.gcube.portlets.widgets</groupId>
|
||||||
|
|
|
@ -1,82 +0,0 @@
|
||||||
package org.gcube.portlets.user.newsfeed.server;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
|
||||||
import org.gcube.portal.databook.server.DatabookStore;
|
|
||||||
import org.gcube.portal.databook.shared.Comment;
|
|
||||||
import org.gcube.portal.databook.shared.Like;
|
|
||||||
import org.gcube.vomanagement.usermanagement.UserManager;
|
|
||||||
import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayUserManager;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Massimiliano Assante ISTI-CNR
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class CommentNotificationsThread implements Runnable {
|
|
||||||
|
|
||||||
private static final Logger _log = LoggerFactory.getLogger(CommentNotificationsThread.class);
|
|
||||||
|
|
||||||
String commenterUserId;
|
|
||||||
String commentedFeedId;
|
|
||||||
private String commentText;
|
|
||||||
private String feedOwnerId;
|
|
||||||
private NotificationsManager nm;
|
|
||||||
private HashSet<String> userIdsToNotify;
|
|
||||||
//needed to avoid sending notification twice (the user who favorited gets the notification anyways)
|
|
||||||
private ArrayList<Like> favorites;
|
|
||||||
|
|
||||||
|
|
||||||
public CommentNotificationsThread(DatabookStore storeInstance, String commenterUserId,
|
|
||||||
String commentedFeedId, String commentText, NotificationsManager nm, String feedOwnerId, ArrayList<Like> favorites) {
|
|
||||||
super();
|
|
||||||
this.nm = nm;
|
|
||||||
this.commenterUserId = commenterUserId;
|
|
||||||
this.commentedFeedId = commentedFeedId;
|
|
||||||
this.commentText = commentText;
|
|
||||||
this.feedOwnerId = feedOwnerId;
|
|
||||||
this.favorites = favorites;
|
|
||||||
|
|
||||||
userIdsToNotify = new HashSet<String>();
|
|
||||||
List<Comment> feedComments = storeInstance.getAllCommentByFeed(commentedFeedId);
|
|
||||||
for (Comment comment : feedComments) {
|
|
||||||
if (comment.getUserid().compareTo(commenterUserId) != 0) {
|
|
||||||
userIdsToNotify.add(comment.getUserid());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//clean
|
|
||||||
//this.comments = comments;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
String feedOwnerFullName = "";
|
|
||||||
UserManager um = new LiferayUserManager();
|
|
||||||
try {
|
|
||||||
feedOwnerFullName = um.getUserByScreenName(feedOwnerId).getFullname();
|
|
||||||
} catch (Exception e) {
|
|
||||||
feedOwnerFullName = feedOwnerId;
|
|
||||||
}
|
|
||||||
//get the list of userid who liked the post
|
|
||||||
ArrayList<String> favoriteUserIds = new ArrayList<>();
|
|
||||||
for (Like favorite : favorites) {
|
|
||||||
favoriteUserIds.add(favorite.getUserid());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (userIdsToNotify != null) {
|
|
||||||
for (String userId : userIdsToNotify) {
|
|
||||||
if (userId.compareTo(feedOwnerId) != 0 && !(favoriteUserIds.contains(userId)) ) { //avoid notifying the owner and the user who liked twice
|
|
||||||
boolean result = nm.notifyCommentReply(userId, commentedFeedId, commentText, feedOwnerFullName, feedOwnerId);
|
|
||||||
_log.trace("Sending Notification for also commented to: " + feedOwnerFullName + " result?"+ result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,44 +0,0 @@
|
||||||
package org.gcube.portlets.user.newsfeed.server;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
|
||||||
import org.gcube.portal.databook.shared.Like;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Massimiliano Assante ISTI-CNR
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class LikeNotificationsThread implements Runnable {
|
|
||||||
private static final Logger _log = LoggerFactory.getLogger(LikeNotificationsThread.class);
|
|
||||||
private String commentText;
|
|
||||||
|
|
||||||
private NotificationsManager nm;
|
|
||||||
private ArrayList<Like> likes;
|
|
||||||
private String feedOwnerId;
|
|
||||||
|
|
||||||
|
|
||||||
public LikeNotificationsThread(String commentText, NotificationsManager nm, ArrayList<Like> likes, String feedOwnerId) {
|
|
||||||
super();
|
|
||||||
this.feedOwnerId = feedOwnerId;
|
|
||||||
this.commentText = commentText;
|
|
||||||
this.nm = nm;
|
|
||||||
this.likes = likes;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
for (Like fav : likes) {
|
|
||||||
if (fav.getUserid().compareTo(feedOwnerId) != 0) { //avoid notifying the owner twice (if the post owner commented he gets the notification regardless)
|
|
||||||
boolean result = nm.notifyCommentOnFavorite(fav.getUserid(), fav.getFeedid(), commentText);
|
|
||||||
_log.trace("Sending Notification for favorited post comment added to: " + fav.getFullName() + " result?"+ result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,39 +0,0 @@
|
||||||
package org.gcube.portlets.user.newsfeed.server;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
|
||||||
import org.gcube.portlets.widgets.pickitem.shared.ItemBean;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Massimiliano Assante ISTI-CNR
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class MentionNotificationsThread implements Runnable {
|
|
||||||
private static Logger _log = LoggerFactory.getLogger(MentionNotificationsThread.class);
|
|
||||||
|
|
||||||
private String postText;
|
|
||||||
private String postId;
|
|
||||||
private NotificationsManager nm;
|
|
||||||
private ArrayList<ItemBean> users;
|
|
||||||
|
|
||||||
|
|
||||||
public MentionNotificationsThread(String postId, String postText, NotificationsManager nm, ArrayList<ItemBean> users) {
|
|
||||||
super();
|
|
||||||
this.postId = postId;
|
|
||||||
this.postText = postText;
|
|
||||||
this.nm = nm;
|
|
||||||
this.users = users;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
for (ItemBean userToNotify : users) {
|
|
||||||
boolean result = nm.notifyUserTag(userToNotify.getName(), postId, postText);
|
|
||||||
_log.trace("Sending Notification for post mention to: " + userToNotify.getName() + " result?"+ result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -35,6 +35,10 @@ import org.gcube.portal.databook.shared.ex.FeedIDNotFoundException;
|
||||||
import org.gcube.portal.databook.shared.ex.FeedTypeNotFoundException;
|
import org.gcube.portal.databook.shared.ex.FeedTypeNotFoundException;
|
||||||
import org.gcube.portal.databook.shared.ex.LikeIDNotFoundException;
|
import org.gcube.portal.databook.shared.ex.LikeIDNotFoundException;
|
||||||
import org.gcube.portal.databook.shared.ex.PrivacyLevelTypeNotFoundException;
|
import org.gcube.portal.databook.shared.ex.PrivacyLevelTypeNotFoundException;
|
||||||
|
import org.gcube.portal.notifications.bean.GenericItemBean;
|
||||||
|
import org.gcube.portal.notifications.thread.CommentNotificationsThread;
|
||||||
|
import org.gcube.portal.notifications.thread.LikeNotificationsThread;
|
||||||
|
import org.gcube.portal.notifications.thread.MentionNotificationsThread;
|
||||||
import org.gcube.portlets.user.newsfeed.client.NewsService;
|
import org.gcube.portlets.user.newsfeed.client.NewsService;
|
||||||
import org.gcube.portlets.user.newsfeed.shared.EnhancedFeed;
|
import org.gcube.portlets.user.newsfeed.shared.EnhancedFeed;
|
||||||
import org.gcube.portlets.user.newsfeed.shared.MoreFeedsBean;
|
import org.gcube.portlets.user.newsfeed.shared.MoreFeedsBean;
|
||||||
|
@ -645,7 +649,11 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
|
|
||||||
//send the notification to the mentioned users, if any
|
//send the notification to the mentioned users, if any
|
||||||
if (mentionedUsers != null && mentionedUsers.size() > 0) {
|
if (mentionedUsers != null && mentionedUsers.size() > 0) {
|
||||||
Thread thread = new Thread(new MentionNotificationsThread(comment.getFeedid(), commentText, nm, mentionedUsers));
|
ArrayList<GenericItemBean> toPass = new ArrayList<GenericItemBean>();
|
||||||
|
for (ItemBean u : mentionedUsers) {
|
||||||
|
toPass.add(new GenericItemBean(u.getId(), u.getName(), u.getAlternativeName(), u.getThumbnailURL()));
|
||||||
|
}
|
||||||
|
Thread thread = new Thread(new MentionNotificationsThread(comment.getFeedid(), commentText, nm, toPass));
|
||||||
thread.start();
|
thread.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<inherits name='com.google.gwt.user.User' />
|
<inherits name='com.google.gwt.user.User' />
|
||||||
|
|
||||||
<!-- To Comment out -->
|
<!-- To Comment out -->
|
||||||
<set-property name="user.agent" value="safari,gecko1_8" />
|
<!-- <set-property name="user.agent" value="safari,gecko1_8" /> -->
|
||||||
|
|
||||||
<!-- Other module inherits -->
|
<!-- Other module inherits -->
|
||||||
<inherits name="net.eliasbalasis.tibcopagebus4gwt.tibcopagebus4gwt" />
|
<inherits name="net.eliasbalasis.tibcopagebus4gwt.tibcopagebus4gwt" />
|
||||||
|
|
Loading…
Reference in New Issue