Compare commits

...

39 Commits

Author SHA1 Message Date
Ahmed Salah Tawfik Ibrahim 2b523df4fb Maven parent 1.2.0 2024-05-17 11:47:42 +02:00
Ahmed Salah Tawfik Ibrahim 6e17205ed8 Maven parent 1.2.0 2024-05-17 11:47:13 +02:00
Ahmed Salah Tawfik Ibrahim 1bf94640ce 2.0.1 2024-04-17 18:58:14 +02:00
Ahmed Salah Tawfik Ibrahim d770fb89eb 2.0.1 2024-04-17 18:57:43 +02:00
Ahmed Salah Tawfik Ibrahim 0adb1272aa 2.0.0 2024-04-17 17:18:41 +02:00
Ahmed Salah Tawfik Ibrahim 3193f8a98b 2.0.0 2024-04-17 17:17:02 +02:00
Ahmed Salah Tawfik Ibrahim b9215ba78b fixed POM 2024-04-17 13:41:31 +02:00
Ahmed Salah Tawfik Ibrahim d0e441e1d1 fixed POM 2024-04-17 13:41:04 +02:00
Ahmed Salah Tawfik Ibrahim 0528ea2f1b fixed java version 2024-04-17 13:33:12 +02:00
Ahmed Salah Tawfik Ibrahim 5e83765b45 fixed java version 2024-04-17 13:32:53 +02:00
Ahmed Salah Tawfik Ibrahim 461a50d1f1 2.0.1 2024-04-16 15:59:16 +02:00
Ahmed Salah Tawfik Ibrahim 7e1316a45c 2.0.1-SNAPSHOT 2024-04-16 15:58:37 +02:00
Ahmed Salah Tawfik Ibrahim 011fba9c3e snl dependency fixed 2024-04-16 15:40:44 +02:00
Ahmed Salah Tawfik Ibrahim 9a21211184 fixed java version 2024-04-11 15:07:47 +02:00
Ahmed Salah Tawfik Ibrahim b0c2b752b1 fixed dependency snl 2024-04-11 14:56:59 +02:00
Ahmed Salah Tawfik Ibrahim 5772d95c97 fixed dependency snl 2024-04-11 14:54:48 +02:00
Massimiliano Assante 635efcb599 just removed a log 2023-12-21 08:57:19 +01:00
Massimiliano Assante da4789b56b ready to release 2023-12-11 12:56:21 +01:00
Massimiliano Assante 23bd836f2c snapshot 2023-12-11 12:51:45 +01:00
Ahmed Salah Tawfik Ibrahim bb4a4afeaa Ready for release 2023-12-06 12:32:39 +01:00
Ahmed Salah Tawfik Ibrahim 57c3a05bea SNAPSHOT version release 2023-12-06 12:31:39 +01:00
Ahmed Salah Tawfik Ibrahim 54fd5cc71c Merge remote-tracking branch 'origin/master' 2023-12-06 12:30:47 +01:00
Ahmed Salah Tawfik Ibrahim 5f81e7e664 BaseClient service discovery 2023-12-06 12:29:53 +01:00
Massimiliano Assante 995f88cb67 ready to release 2023-12-04 18:02:26 +01:00
Massimiliano Assante cebe0b454a snapshot release 2023-12-04 18:01:03 +01:00
Massimiliano Assante 8ae547a606 releasing 2.0 version 2023-12-04 17:55:33 +01:00
Ahmed Salah Tawfik Ibrahim b3d7ef8c85 Debug notification preferences 2023-12-04 17:12:05 +01:00
Ahmed Salah Tawfik Ibrahim 39b76c1476 Merge remote-tracking branch 'origin/Feature/26044' into Feature/26044 2023-12-04 16:06:39 +01:00
Ahmed Salah Tawfik Ibrahim 48417a3255 Fix notifications 2023-12-04 16:06:26 +01:00
Massimiliano Assante 23daa62c05 version 2.0 Snapshot 2023-12-01 15:17:11 +01:00
Massimiliano Assante 04fef1f26d fixed changelog 2023-12-01 15:14:37 +01:00
Massimiliano Assante 11f052ebef new beta version 2023-12-01 15:13:38 +01:00
Ahmed Salah Tawfik Ibrahim dadf817c3a New social client 2023-12-01 15:01:35 +01:00
Ahmed Salah Tawfik Ibrahim 5088ed448e New social client 2023-11-28 19:41:04 +01:00
Ahmed Salah Tawfik Ibrahim a32f4f8038 Added Author 2023-11-24 11:54:53 +01:00
Ahmed Salah Tawfik Ibrahim 7b97d4f630 API corresponding to each social networking library function. 2023-11-22 19:39:31 +01:00
Ahmed Salah Tawfik Ibrahim 86cf7f6d70 API corresponding to each social networking library function. 2023-11-21 18:36:28 +01:00
Ahmed Salah Tawfik Ibrahim a8aa40c1cd API corresponding to each social networking library function. 2023-11-21 17:58:34 +01:00
Ahmed Salah Tawfik Ibrahim 3400f6539d API corresponding to each social networking library function. 2023-11-21 14:08:50 +01:00
11 changed files with 578 additions and 34 deletions

View File

@ -18,9 +18,8 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/Java 8">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>

View File

@ -1,5 +1,14 @@
# Changelog
## [v2.0.1] - 2024-04-16
- fixed dependency versions
## [v2.0.0] - 2023-12-04
- Integrated corresponding API calls for all the public functions in Social Networking Library
## [v1.2.0] - 2022-10-20
- Minor fix on a method name

View File

@ -20,10 +20,12 @@ See [Releases](https://code-repo.d4science.org/gCubeSystem/social-service-client
## Authors
* **Massimiliano Assante** ([ORCID](https://orcid.org/0000-0002-3761-1492)) - [ISTI-CNR Infrascience Group](https://www.isti.cnr.it/People/M.Assante)
* **Ahmed Ibrahim** ([ORCID](https://orcid.org/0009-0001-3009-5755)) - [ISTI-CNR Infrascience Group](https://www.isti.cnr.it/en/about/people-detail/976/Ahmed_Salah_Tawfik_Ibrahim)
## Maintainers
* **Massimiliano Assante** ([ORCID](https://orcid.org/0000-0002-3761-1492)) - [ISTI-CNR Infrascience Group](https://www.isti.cnr.it/People/M.Assante)
* **Ahmed Ibrahim** ([ORCID](https://orcid.org/0009-0001-3009-5755)) - [ISTI-CNR Infrascience Group](https://www.isti.cnr.it/en/about/people-detail/976/Ahmed_Salah_Tawfik_Ibrahim)
## License
@ -38,4 +40,4 @@ by favouring the realisation of reuse oriented policies.
The projects leading to this software have received funding from a series of European Union programmes see [FUNDING.md](FUNDING.md)

28
pom.xml
View File

@ -6,13 +6,13 @@
<parent>
<groupId>org.gcube.tools</groupId>
<artifactId>maven-parent</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
</parent>
<groupId>org.gcube.social-networking</groupId>
<artifactId>social-service-client</artifactId>
<version>1.2.0</version>
<version>2.0.1</version>
<name>social-networking-service-client</name>
<packaging>jar</packaging>
<description>The social networking web service client library</description>
@ -37,7 +37,7 @@
</dependencyManagement>
<properties>
<java-version>1.8</java-version>
<java-version>1.8</java-version>
<jaxrs.version>2.0.1</jaxrs.version>
<distroDirectory>${project.basedir}/distro</distroDirectory>
<gCubeSubsystem>social-networking</gCubeSubsystem>
@ -56,9 +56,29 @@
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>social-networking-library</artifactId>
<version>[1.16.0, 2.0.0)</version>
<version>[2.0.0, 3.0.0)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.8.7</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.8.7</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.7</version>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-generic-clients</artifactId>

View File

@ -10,20 +10,18 @@ import org.slf4j.LoggerFactory;
*/
public abstract class BaseClient {
private static Logger logger = LoggerFactory.getLogger(BaseClient.class);
private String serviceEndpoint;
public BaseClient(String subPath) throws Exception {
ServiceDiscoverer discoverer = new ServiceDiscoverer();
logger.debug("Discovering service...");
serviceEndpoint = discoverer.getEntryPoint();
serviceEndpoint = serviceEndpoint.endsWith("/") ? serviceEndpoint + subPath :
serviceEndpoint + "/" + subPath;
logger.debug("Discovered service " + serviceEndpoint);
}
private static Logger logger = LoggerFactory.getLogger(BaseClient.class);
private String serviceEndpoint;
public String getServiceEndpoint() {
return serviceEndpoint;
}
public BaseClient(String subPath) throws Exception {
ServiceDiscoverer discoverer = new ServiceDiscoverer();
serviceEndpoint = discoverer.getEntryPoint();
logger.debug("Discovering service...");
serviceEndpoint = serviceEndpoint.endsWith("/") ? serviceEndpoint + subPath : serviceEndpoint + "/" + subPath;
logger.info("Discovered service " + serviceEndpoint);
}
public String getServiceEndpoint() {
return serviceEndpoint;
}
}

View File

@ -1,10 +1,16 @@
package org.gcube.social_networking.social_networking_client_library;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ws.rs.core.GenericType;
import org.apache.commons.lang.Validate;
import org.gcube.portal.databook.shared.Feed;
import org.gcube.portal.databook.shared.Post;
import org.gcube.portal.databook.shared.ex.*;
import org.gcube.social_networking.social_networking_client_library.utils.HttpClient;
import org.gcube.social_networking.socialnetworking.model.output.ResponseBean;
import org.slf4j.Logger;
@ -13,6 +19,7 @@ import org.slf4j.LoggerFactory;
/**
* HashTags client.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
* @author Ahmed Ibrahim at ISTI-CNR (ahmed.ibrahim@isti.cnr.it)
*/
public class HashTagClient extends BaseClient{
@ -34,5 +41,4 @@ public class HashTagClient extends BaseClient{
String request = getServiceEndpoint() + thisMethodSignature;
return HttpClient.get(new GenericType<ResponseBean<HashMap<String, Integer>>>(){}, request);
}
}

View File

@ -0,0 +1,487 @@
package org.gcube.social_networking.social_networking_client_library;
import org.apache.commons.lang.Validate;
import org.gcube.portal.databook.shared.*;
import org.gcube.social_networking.social_networking_client_library.utils.HttpClient;
import org.gcube.social_networking.socialnetworking.model.output.ResponseBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.ws.rs.core.GenericType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class LibClient extends BaseClient{
private static final String SUB_SERVICE_PATH = "2/lib/";
private static Logger logger = LoggerFactory.getLogger(LibClient.class);
public LibClient() throws Exception {
super(SUB_SERVICE_PATH);
}
//Comments
public Boolean addCommentLib(Comment comment){
Validate.isTrue(comment != null, "Comment to write cannot be null");
logger.debug("Request for writing comment");
String thisMethodSignature = "add-comment-lib";
String request = getServiceEndpoint() + thisMethodSignature;
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, comment);
}
public Comment readCommentByIdLib(String commentid){
Validate.isTrue(commentid != null, "Commentid to read cannot be null");
logger.debug("Request for reading commentid");
String thisMethodSignature = "read-comment-by-id-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?commentid=" + commentid;
return HttpClient.get(new GenericType<ResponseBean<Comment>>(){}, request);
}
public List<Comment> getAllCommentsByPostIdLib(String postid){
Validate.isTrue(postid != null, "Postid to read cannot be null");
logger.debug("Request for reading comments of post");
String thisMethodSignature = "get-comments-by-post-id-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?postid=" + postid;
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Comment>>>(){}, request);
}
public List<Comment> getRecentCommentsByUserAndDateLib(final String userid,
final long timeInMillis){
Validate.isTrue(userid != null, "username to read cannot be null");
logger.debug("Request for reading recent comments of user");
String thisMethodSignature = "get-recent-comments-by-user-and-date-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?time=" + timeInMillis + "&username=" + userid;
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Comment>>>(){}, request);
}
public Boolean editCommentLib(Comment comment){
Validate.isTrue(comment != null, "Comment to write cannot be null");
logger.debug("Request for writing comment");
String thisMethodSignature = "edit-comment-lib";
String request = getServiceEndpoint() + thisMethodSignature;
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, comment);
}
public boolean deleteCommentLib(String commentid, String postid){
Validate.isTrue(commentid != null, "Comment to write cannot be null");
logger.debug("Request for del comment");
String thisMethodSignature = "delete-comment-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?commentid=" + commentid + "&postid=" + postid;
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, postid);
}
//Hashtags
public boolean saveHashTagsLib(String feedid, String vreid, List<String> hashtags) {
Validate.isTrue(hashtags != null, "hashtags to write cannot be null");
logger.debug("Request for saving hashtags");
String thisMethodSignature = "save-hashtag-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?feedid=" + feedid + "&vreid=" + vreid;
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, hashtags);
}
public boolean deleteHashTagsLib(String feedid, String vreid, List<String> hashtags) {
Validate.isTrue(hashtags != null, "hashtags to delete cannot be null");
logger.debug("Request for deleting hashtags");
String thisMethodSignature = "delete-hashtag-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?feedid=" + feedid + "&vreid=" + vreid;
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, hashtags);
}
public boolean saveHashTagsCommentLib(String commentId, String vreid, List<String> hashtags){
Validate.isTrue(hashtags != null, "hashtags to comment cannot be null");
logger.debug("Request for saving hashtags comment");
String thisMethodSignature = "save-hashtag-comment-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?commentid=" + commentId + "&vreid=" + vreid;
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, hashtags);
}
public boolean deleteHashTagsCommentLib(String commentId, String vreid, List<String> hashtags) {
Validate.isTrue(hashtags != null, "hashtags to comment delete cannot be null");
logger.debug("Request for deleting hashtags comment");
String thisMethodSignature = "delete-hashtag-comment-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?commentid=" + commentId + "&vreid=" + vreid;
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, hashtags);
}
public Map<String, Integer> getVREHashtagsWithOccurrenceLib(String vreid) {
logger.debug("Request for vre hashtags occurrences");
String thisMethodSignature = "get-vre-hashtags-occurrences-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?vreid=" + vreid;
return HttpClient.get(new GenericType<ResponseBean<HashMap<String, Integer>>>(){}, request);
}
public Map<String, Integer> getVREHashtagsWithOccurrenceFilteredByTimeLib(String vreid, long timestamp){
logger.debug("Request for vre hashtags occurrences with time");
String thisMethodSignature = "get-vre-hashtags-occurrences-time-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?vreid=" + vreid + "&time=" + timestamp;
return HttpClient.get(new GenericType<ResponseBean<HashMap<String, Integer>>>(){}, request);
}
public List<Post> getVREPostsByHashtagLib(String vreid, String hashtag){
hashtag = hashtag.substring(1);
logger.debug("Request for vre of hashtags");
String thisMethodSignature = "get-vre-post-by-hashtag-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?vreid=" + vreid + "&hashtag=" + hashtag;
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Post>>>(){}, request);
}
//Invites
public String isExistingInviteLib(String vreid, String email){
Validate.isTrue(email != null, "email to invite cannot be null");
logger.debug("Request for inviting to vre");
String thisMethodSignature = "is-existing-invite-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?vreid=" + vreid + "&email=" + email;
return HttpClient.get(new GenericType<ResponseBean<String>>(){}, request);
}
public InviteOperationResult saveInviteLib(Invite invite){
Validate.isTrue(invite != null, "likeid to unlike cannot be null");
logger.debug("Request for saving invite");
String thisMethodSignature = "save-invite-lib";
String request = getServiceEndpoint() + thisMethodSignature;
return HttpClient.post(new GenericType<ResponseBean<InviteOperationResult>>(){}, request, invite);
}
public Invite readInviteLib(String inviteid){
Validate.isTrue(inviteid != null, "inviteid to read likes cannot be null");
logger.debug("Request for reading invite");
String thisMethodSignature = "read-invite-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?inviteid=" + inviteid;
return HttpClient.get(new GenericType<ResponseBean<Invite>>(){}, request);
}
public boolean setInviteStatusLib(String vreid, String email, InviteStatus status){
Validate.isTrue(status != null, "status to set cannot be null");
logger.debug("Request for setting invite status");
String thisMethodSignature = "set-invite-status-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?vreid=" + vreid + "&email=" + email;
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, status);
}
public List<Invite> getInvitedEmailsByVRELib(String vreid, InviteStatus... status){
Validate.isTrue(status != null, "status to get cannot be null");
logger.debug("Request for getting email invites");
String thisMethodSignature = "get-invited-email-by-vre-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?vreid=" + vreid;
return HttpClient.post(new GenericType<ResponseBean<ArrayList<Invite>>>(){}, request, status);
}
//Likes
public boolean likeLib(Like like){
Validate.isTrue(like != null, "like to write cannot be null");
logger.debug("Request for liking post");
String thisMethodSignature = "like-lib";
String request = getServiceEndpoint() + thisMethodSignature;
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, like);
}
public boolean unlikeLib(String userid, String likeid, String feedid){
Validate.isTrue(likeid != null, "likeid to unlike cannot be null");
logger.debug("Request for unliking post");
String thisMethodSignature = "unlike-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?userid=" + userid + "&likeid=" + likeid + "&feedid=" + feedid ;
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, likeid);
}
public List<String>getAllLikedPostIdsByUserLib(String userid){
Validate.isTrue(userid != null, "userid to read likes cannot be null");
logger.debug("Request for reading likes of user");
String thisMethodSignature = "get-all-liked-posts-by-user-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?userid=" + userid;
return HttpClient.get(new GenericType<ResponseBean<ArrayList<String>>>(){}, request);
}
public List<Like>getAllLikesByPostLib(String postid){
Validate.isTrue(postid != null, "postid to read likes cannot be null");
logger.debug("Request for reading likes of post");
String thisMethodSignature = "get-all-likes-by-post-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?postid=" + postid;
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Like>>>(){}, request);
}
//Notifications
public boolean saveNotificationLib(Notification n){
Validate.isTrue(n != null, "Notification cannot be null");
logger.debug("Request for saving notification");
String thisMethodSignature = "save-notification-lib";
String request = getServiceEndpoint() + thisMethodSignature;
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, n);
}
public Notification readNotificationLib(String notificationid){
logger.debug("Request for getting notification by id");
String thisMethodSignature = "read-notification-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?notid=" + notificationid;
return HttpClient.get(new GenericType<ResponseBean<Notification>>(){}, request);
}
public boolean setNotificationReadLib(String notificationid){
Validate.isTrue(notificationid != null, "Notificationid cannot be null");
logger.debug("Request for setting notification read");
String thisMethodSignature = "set-notification-read-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?notid=" + notificationid;;
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, notificationid);
}
public List<Notification> getAllNotificationByUserLib(String userid, int limit) {
logger.debug("Request for getting notification by user");
String thisMethodSignature = "get-all-notifications-user";
String request = getServiceEndpoint() + thisMethodSignature + "?userid=" + userid + "&limit=" + limit;
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Notification>>>(){}, request);
}
public List<Notification> getUnreadNotificationsByUserLib(String userid) {
logger.debug("Request for getting unread notification by user");
String thisMethodSignature = "get-unread-notifications-user";
String request = getServiceEndpoint() + thisMethodSignature + "?userid=" + userid;
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Notification>>>(){}, request);
}
public List<Notification> getRangeNotificationsByUserLib(String userid,int from, int quantity) {
logger.debug("Request for getting range notification by user");
String thisMethodSignature = "get-range-notifications-user";
String request = getServiceEndpoint() + thisMethodSignature + "?userid=" + userid + "&from=" + from + "&quantity=" + quantity;
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Notification>>>(){}, request);
}
public boolean setAllNotificationReadByUserLib(String userid) {
Validate.isTrue(userid != null, "userid cannot be null");
logger.debug("Request for setting all notification read");
String thisMethodSignature = "set-all-notification-read-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?userid=" + userid;;
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, userid);
}
public boolean checkUnreadNotificationsLib(String userid) {
Validate.isTrue(userid != null, "userid cannot be null");
logger.debug("Request for check unread notifications");
String thisMethodSignature = "check-unread-notification-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?userid=" + userid;;
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, userid);
}
public boolean checkUnreadMessagesNotificationsLib(String userid) {
Validate.isTrue(userid != null, "userid cannot be null");
logger.debug("Request for check unread messages notifications");
String thisMethodSignature = "check-unread-messages-notification-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?userid=" + userid;;
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, userid);
}
public List<NotificationChannelType> getUserNotificationChannelsLib(String userid, NotificationType notificationType) {
Validate.isTrue(userid != null, "userid cannot be null");
logger.debug("Request for get user notification channels");
String thisMethodSignature = "get-user-notification-channels-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?userid=" + userid + "&type=" + notificationType.toString();
return HttpClient.get(new GenericType<ResponseBean<ArrayList<NotificationChannelType>>>(){}, request);
}
public boolean setUserNotificationPreferencesLib(String userid, Map<NotificationType, NotificationChannelType[]> enabledChannels){
Validate.isTrue(userid != null, "userid cannot be null");
logger.debug("Request for set user notification preferences");
String thisMethodSignature = "set-notification-preference-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?userid=" + userid;
for(NotificationType notificationType: enabledChannels.keySet()){
logger.info("Type: " + notificationType.toString());
for(NotificationChannelType channelType: enabledChannels.get(notificationType)){
logger.info(channelType.toString());
}
}
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, enabledChannels);
}
public Map<NotificationType, NotificationChannelType[]> getUserNotificationPreferencesLib(String userid){
Validate.isTrue(userid != null, "userid cannot be null");
logger.debug("Request for getting notification preferences");
String thisMethodSignature = "get-notification-preference-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?userid=" + userid;;
return HttpClient.get(new GenericType<ResponseBean<HashMap<NotificationType, NotificationChannelType[]>>>(){}, request);
}
public boolean saveUserPostLib(Post post){
Validate.isTrue(post != null, "Post to write cannot be null");
logger.debug("Request for save user post");
String thisMethodSignature = "save-user-post-lib";
String request = getServiceEndpoint() + thisMethodSignature;
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, post);
} //bool
public boolean saveAttachmentEntryLib(String postkey, Attachment attachment){
Validate.isTrue(attachment != null, "Attachment to write cannot be null");
logger.debug("Request for save attachment");
String thisMethodSignature = "save-attachment-lib" + "?postid=" + postkey;
String request = getServiceEndpoint() + thisMethodSignature;
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, attachment);
}
public boolean saveUserPostLib(Post post, List<Attachment> attachments ){
Validate.isTrue(post != null, "Post to write cannot be null");
if (attachments != null && !attachments.isEmpty())
post.setMultiFileUpload(true);
boolean savePostResult = saveUserPostLib(post);
if (savePostResult) {
logger.info("Post has been saved");
String postkey = post.getKey();
for (Attachment attachment : attachments) {
boolean attachSaveResult = saveAttachmentEntryLib(postkey, attachment);
if (!attachSaveResult)
logger.info("Some of the attachments failed to be saved: " + attachment.getName());
}
return true;
}
else return false;
}
public boolean saveAppPostLib(Post post, List<Attachment> attachments) {
Validate.isTrue(post != null, "Post to write cannot be null");
if (attachments != null && !attachments.isEmpty())
post.setMultiFileUpload(true);
boolean savePostResult = saveAppPostLib(post);
if (savePostResult) {
logger.info("Post has been saved");
String postkey = post.getKey();
for (Attachment attachment : attachments) {
boolean attachSaveResult = saveAttachmentEntryLib(postkey, attachment);
if (!attachSaveResult)
logger.info("Some of the attachments failed to be saved: " + attachment.getName());
}
return true;
}
else return false;
}
public boolean saveAppPostLib(Post post){
Validate.isTrue(post != null, "Post to write cannot be null");
logger.debug("Request for saving application post");
String thisMethodSignature = "save-app-post-lib";
String request = getServiceEndpoint() + thisMethodSignature;
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, post);
} //bool
public boolean savePostToVRETimelineLib(String postkey, String vreid){
Validate.isTrue(postkey != null, "Post to write cannot be null");
logger.debug("Request for writing post to vretimeline");
String thisMethodSignature = "save-post-to-vretimeline-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?postid=" + postkey + "&vreid=" + vreid;
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, postkey);
} //bool
public Post readPostLib(String postid){
logger.debug("Request for getting post with id");
String thisMethodSignature = "read-post-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?postid=" + postid;
return HttpClient.get(new GenericType<ResponseBean<Post>>(){}, request);
} //post
public List<Post> getRecentPostsByUserAndDateLib(String userid, long timeinmillis){
logger.debug("Request for getting recent posts by user");
String thisMethodSignature = "get-recent-posts-by-user-date-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?userid=" + userid + "&time=" + timeinmillis;
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Post>>>(){}, request);
} //list<post>
public boolean deletePostLib(String postid){
Validate.isTrue(postid != null, "feed to delete cannot be null");
logger.debug("Request for delete user post");
String thisMethodSignature = "delete-post-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?postid=" + postid;
return HttpClient.post(new GenericType<ResponseBean<Boolean>>(){}, request, postid);
} //bool
public List<Post> getAllPostsByUserLib(String userid) {
logger.debug("Request for getting all posts by user");
String thisMethodSignature = "get-all-posts-by-user-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?userid=" + userid ;
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Post>>>(){}, request);
}
public List<Post> getAllPostsByAppLib(String appid) {
logger.debug("Request for getting all posts by app");
String thisMethodSignature = "get-all-posts-by-app-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?appid=" + appid ;
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Post>>>(){}, request);
}
public List<Post> getRecentCommentedPostsByUserAndDateLib(String userid,
long timeInMillis) {
logger.debug("Request for getting recent commented posts by user and date");
String thisMethodSignature = "get-recent-commented-posts-by-user-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?userid=" + userid + "&time=" + timeInMillis;
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Post>>>(){}, request);
}
public List<Post> getAllPortalPrivacyLevelPostsLib(){
logger.debug("Request for getting portal privacy level posts");
String thisMethodSignature = "get-portal-privacy-level-posts-lib";
String request = getServiceEndpoint() + thisMethodSignature;
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Post>>>(){}, request);
} //list<post>
public List<Post> getRecentPostsByUserLib(String userid, int quantity) {
logger.debug("Request for getting recent posts by user");
String thisMethodSignature = "get-recent-posts-by-user-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?userid=" + userid + "&quantity=" + quantity ;
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Post>>>(){}, request);
}
public List<Post> getAllPostsByVRELib(String vreid) {
logger.debug("Request for getting all posts by vre");
String thisMethodSignature = "get-all-posts-by-vre-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?vreid=" + vreid ;
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Post>>>(){}, request);
}
public List<Post> getRecentPostsByVRELib(String vreid, int quantity) {
logger.debug("Request for getting recent posts by vre");
String thisMethodSignature = "get-recent-posts-by-vre-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?vreid=" + vreid + "&quantity=" + quantity ;
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Post>>>(){}, request);
}
public RangePosts getRecentPostsByVREAndRangeLib(String vreid, int from, int quantity) {
logger.debug("Request for getting recent posts by vre and range");
String thisMethodSignature = "get-recent-posts-by-vre-range-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?vreid=" + vreid + "&from=" + from + "&quantity=" + quantity;
return HttpClient.get(new GenericType<ResponseBean<RangePosts>>(){}, request);
}
public List<Attachment> getAttachmentsByFeedIdLib(String feedId) {
logger.debug("Request for getting attachment by postid");
String thisMethodSignature = "get-attachment-by-postid-lib";
String request = getServiceEndpoint() + thisMethodSignature + "?postid=" + feedId ;
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Attachment>>>(){}, request);
}
public List<String> getAllVREIdsLib(){
logger.debug("Request for getting all vre ids");
String thisMethodSignature = "get-all-vre-ids-lib";
String request = getServiceEndpoint() + thisMethodSignature ;
return HttpClient.get(new GenericType<ResponseBean<ArrayList<String>>>(){}, request);
}
}

View File

@ -1,12 +1,20 @@
package org.gcube.social_networking.social_networking_client_library;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ws.rs.core.GenericType;
import org.apache.commons.lang.Validate;
import org.gcube.portal.databook.shared.Notification;
import org.gcube.portal.databook.shared.NotificationChannelType;
import org.gcube.portal.databook.shared.NotificationType;
import org.gcube.portal.databook.shared.ex.ColumnNameNotFoundException;
import org.gcube.portal.databook.shared.ex.NotificationChannelTypeNotFoundException;
import org.gcube.portal.databook.shared.ex.NotificationIDNotFoundException;
import org.gcube.portal.databook.shared.ex.NotificationTypeNotFoundException;
import org.gcube.social_networking.social_networking_client_library.utils.HttpClient;
import org.gcube.social_networking.socialnetworking.model.beans.JobNotificationBean;
import org.gcube.social_networking.socialnetworking.model.beans.catalogue.CatalogueEvent;
@ -20,6 +28,7 @@ import org.slf4j.LoggerFactory;
/**
* Notifications client.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
* @author Ahmed Ibrahim at ISTI-CNR (ahmed.ibrahim@isti.cnr.it)
*/
public class NotificationClient extends BaseClient{
@ -40,7 +49,7 @@ public class NotificationClient extends BaseClient{
public List<Notification> getNotifications(int from, int quantity){
Validate.isTrue(from >= 1, "From cannot be negative");
Validate.isTrue(from >= 0, "Quantity cannot be negative");
Validate.isTrue(quantity >= 0, "Quantity cannot be negative");
logger.debug("Request for getting notifications");
String thisMethodSignature = "get-range-notifications";
@ -89,5 +98,4 @@ public class NotificationClient extends BaseClient{
HttpClient.post(new GenericType<ResponseBean<String>>(){}, request, event);
}
}

View File

@ -3,13 +3,15 @@ package org.gcube.social_networking.social_networking_client_library;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ws.rs.core.GenericType;
import org.apache.commons.lang.Validate;
import org.gcube.portal.databook.shared.Feed;
import org.gcube.portal.databook.shared.Post;
import org.gcube.portal.databook.shared.*;
import org.gcube.social_networking.social_networking_client_library.utils.HttpClient;
import org.gcube.social_networking.socialnetworking.model.beans.PostInputBean;
import org.gcube.social_networking.socialnetworking.model.output.ResponseBean;
@ -19,6 +21,7 @@ import org.slf4j.LoggerFactory;
/**
* Posts client.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
* @author Ahmed Ibrahim at ISTI-CNR (ahmed.ibrahim@isti.cnr.it)
*/
public class PostClient extends BaseClient{
@ -183,5 +186,4 @@ public class PostClient extends BaseClient{
return HttpClient.get(new GenericType<ResponseBean<ArrayList<String>>>(){}, request);
}
}

View File

@ -135,7 +135,7 @@ public class UserClient extends BaseClient{
Validate.isTrue(localRole != null, "role cannot be null");
logger.debug("Request for getting usernames with global role");
logger.debug("Request for getting usernames by role role");
String thisMethodSignature = "get-usernames-by-role";
String request = getServiceEndpoint() + thisMethodSignature + "?role-name=" + localRole;
return HttpClient.get(new GenericType<ResponseBean<ArrayList<String>>>(){}, request);

View File

@ -3,6 +3,7 @@ package org.gcube.portal.social_networking_client_library;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -54,8 +55,11 @@ public class TestClientServices {
@Before
public void setContextAndToken(){
//ScopeProvider.instance.set("/d4science.research-infrastructures.eu/gCubeApps/gCube");
//String umaToken = "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJySUJPYjZZY3p2ZE4xNVpuNHFkUTRLdEQ5VUhyY1dwNWJCT3NaLXpYbXM0In0.eyJleHAiOjE2NjM2NjU2NTgsImlhdCI6MTY2MzY2NTM1OCwiYXV0aF90aW1lIjoxNjYzNjY0MTg1LCJqdGkiOiIxMjNhYmY0MS1lZmE1LTQ4ZjEtYmE2Zi03MjNkOWZjNDAwMWQiLCJpc3MiOiJodHRwczovL2FjY291bnRzLmQ0c2NpZW5jZS5vcmcvYXV0aC9yZWFsbXMvZDRzY2llbmNlIiwiYXVkIjoiJTJGZDRzY2llbmNlLnJlc2VhcmNoLWluZnJhc3RydWN0dXJlcy5ldSUyRmdDdWJlQXBwcyUyRmdDdWJlIiwic3ViIjoiMzM4OGQwZjgtM2E0OS00ZGEwLWE3OGUtN2I2MjI1O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wXINntUVTVPVfPaXZ_ZbOw";
AccessTokenProvider.instance.set(umaToken);
SecurityTokenProvider.instance.set("");
}
@ -220,6 +224,12 @@ public class TestClientServices {
Set<String> vreManagers = userClient.getAllUsernamesByRole("Data-Manager");
assert(vreManagers != null && !vreManagers.isEmpty());
System.out.println("Data Managers are " + vreManagers);
List<String> moderators = userClient.getAllUsernamesByLocalRole("VRE-Managers");
assert(moderators != null && !moderators.isEmpty());
System.out.println("Catalogue-Moderators are " + moderators);
String myEmail = userClient.getEmail();
@ -301,13 +311,16 @@ public class TestClientServices {
}
}
//@Test
@Test
public void writeUserPost() throws Exception{
PostClient postClient = new PostClient();
PostInputBean toWrite = new PostInputBean("Testing social networking rest client", null, null, null, null, null, false, null);
Post written = postClient.writeUserPost(toWrite);
logger.debug("Written post is " + written);
PostInputBean postInputBean = new PostInputBean();
postInputBean.setText("Testing social networking rest client at " + new Date());
//Post post = postClient.writeApplicationPost(postInputBean);
PostInputBean post = new PostInputBean("Testing social networking rest client", null, null, null, null, null, false, null);
Post written = postClient.writeUserPost(postInputBean);
logger.debug("Written post is " + post);
}