Compatible with social model 2.0.0

This commit is contained in:
Ahmed Salah Tawfik Ibrahim 2024-01-18 18:02:07 +01:00
parent 20c03e92e1
commit cd5497507d
5 changed files with 24 additions and 15 deletions

View File

@ -4,6 +4,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v2.0.0] - 2024-01-18
- Compatible with social model 2.0.0
## [v1.5.0] - 2022-06-25
- Ported to git

14
pom.xml
View File

@ -12,7 +12,7 @@
<groupId>org.gcube.portal</groupId>
<artifactId>notifications-common-library</artifactId>
<version>1.5.0</version>
<version>2.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<description>
gCube Notifications Common Library is a common library containing shared code for Notification of social events to users.
@ -58,12 +58,18 @@
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslsocial</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>social-networking-library</artifactId>
<scope>provided</scope>
<groupId>org.gcube.social-networking</groupId>
<artifactId>social-service-model</artifactId>
<version>[1.2.0-SNAPSHOT, 2.0.0)</version>
</dependency>
<dependency>
<groupId>org.gcube.social-networking</groupId>
<artifactId>social-service-client</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
</dependency>
<dependency>
<groupId>org.gcube.dvos</groupId>

View File

@ -5,9 +5,9 @@ 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.social_networking.social_networking_client_library.LibClient;
import org.gcube.social_networking.socialnetworking.model.shared.Comment;
import org.gcube.social_networking.socialnetworking.model.shared.Like;
import org.gcube.vomanagement.usermanagement.UserManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -34,7 +34,7 @@ public class CommentNotificationsThread implements Runnable {
/**
*
* @param storeInstance
* @param libclient
* @param userManager
* @param commenterUserId
* @param commentedPostId
@ -44,8 +44,8 @@ public class CommentNotificationsThread implements Runnable {
* @param commentKey
* @param likes
*/
public CommentNotificationsThread(DatabookStore storeInstance, UserManager userManager, String commenterUserId,
String commentedPostId, String commentText, NotificationsManager nm, String postOwnerId, String commentKey, ArrayList<Like> likes) {
public CommentNotificationsThread(LibClient libclient, UserManager userManager, String commenterUserId,
String commentedPostId, String commentText, NotificationsManager nm, String postOwnerId, String commentKey, ArrayList<Like> likes) {
super();
this.nm = nm;
this.commenterUserId = commenterUserId;
@ -57,7 +57,7 @@ public class CommentNotificationsThread implements Runnable {
this.userManager = userManager;
userIdsToNotify = new HashSet<String>();
List<Comment> postComments = storeInstance.getAllCommentByFeed(commentedPostId);
List<Comment> postComments = libclient.getAllCommentsByPostIdLib(commentedPostId);
for (Comment comment : postComments) {
if (comment.getUserid().compareTo(commenterUserId) != 0) {
userIdsToNotify.add(comment.getUserid());

View File

@ -3,7 +3,7 @@ package org.gcube.portal.notifications.thread;
import java.util.List;
import org.gcube.applicationsupportlayer.social.NotificationsManager;
import org.gcube.portal.databook.shared.RunningJob;
import org.gcube.social_networking.socialnetworking.model.shared.RunningJob;
import org.gcube.portal.notifications.bean.GenericItemBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -22,7 +22,6 @@ public class JobStatusNotificationThread implements Runnable {
/**
* @param jobDescriptor
* @param applicationQualifier
* @param recipients
* @param nm
*/

View File

@ -3,7 +3,7 @@ package org.gcube.portal.notifications.thread;
import java.util.ArrayList;
import org.gcube.applicationsupportlayer.social.NotificationsManager;
import org.gcube.portal.databook.shared.Like;
import org.gcube.social_networking.socialnetworking.model.shared.Like;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -34,7 +34,7 @@ public class LikeNotificationsThread implements Runnable {
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, commentKey);
boolean result = nm.notifyCommentOnFavorite(fav.getUserid(), fav.getPostid(), commentText, commentKey);
_log.trace("Sending Notification for favorited post comment added to: " + fav.getFullName() + " result?"+ result);
}
}