Compare commits
No commits in common. "master" and "Feature/23186" have entirely different histories.
master
...
Feature/23
|
@ -0,0 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
<attribute name="test" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
|
<attributes>
|
||||||
|
<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/JavaSE-1.8">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
|
</classpath>
|
|
@ -1,174 +1 @@
|
||||||
#
|
/target/
|
||||||
ignore_me
|
|
||||||
tomcat
|
|
||||||
|
|
||||||
target
|
|
||||||
.classpath
|
|
||||||
.visual
|
|
||||||
.project
|
|
||||||
.settings
|
|
||||||
/**/.DS_Store
|
|
||||||
|
|
||||||
# Created by https://www.toptal.com/developers/gitignore/api/java,macos,linux,visualstudiocode,eclipse
|
|
||||||
# Edit at https://www.toptal.com/developers/gitignore?templates=java,macos,linux,visualstudiocode,eclipse
|
|
||||||
|
|
||||||
### Eclipse ###
|
|
||||||
.metadata
|
|
||||||
bin/
|
|
||||||
tmp/
|
|
||||||
*.tmp
|
|
||||||
*.bak
|
|
||||||
*.swp
|
|
||||||
*~.nib
|
|
||||||
local.properties
|
|
||||||
.settings/
|
|
||||||
.loadpath
|
|
||||||
.recommenders
|
|
||||||
|
|
||||||
# External tool builders
|
|
||||||
.externalToolBuilders/
|
|
||||||
|
|
||||||
# Locally stored "Eclipse launch configurations"
|
|
||||||
*.launch
|
|
||||||
|
|
||||||
# PyDev specific (Python IDE for Eclipse)
|
|
||||||
*.pydevproject
|
|
||||||
|
|
||||||
# CDT-specific (C/C++ Development Tooling)
|
|
||||||
.cproject
|
|
||||||
|
|
||||||
# CDT- autotools
|
|
||||||
.autotools
|
|
||||||
|
|
||||||
# Java annotation processor (APT)
|
|
||||||
.factorypath
|
|
||||||
|
|
||||||
# PDT-specific (PHP Development Tools)
|
|
||||||
.buildpath
|
|
||||||
|
|
||||||
# sbteclipse plugin
|
|
||||||
.target
|
|
||||||
|
|
||||||
# Tern plugin
|
|
||||||
.tern-project
|
|
||||||
|
|
||||||
# TeXlipse plugin
|
|
||||||
.texlipse
|
|
||||||
|
|
||||||
# STS (Spring Tool Suite)
|
|
||||||
.springBeans
|
|
||||||
|
|
||||||
# Code Recommenders
|
|
||||||
.recommenders/
|
|
||||||
|
|
||||||
# Annotation Processing
|
|
||||||
.apt_generated/
|
|
||||||
.apt_generated_test/
|
|
||||||
|
|
||||||
# Scala IDE specific (Scala & Java development for Eclipse)
|
|
||||||
.cache-main
|
|
||||||
.scala_dependencies
|
|
||||||
.worksheet
|
|
||||||
|
|
||||||
# Uncomment this line if you wish to ignore the project description file.
|
|
||||||
# Typically, this file would be tracked if it contains build/dependency configurations:
|
|
||||||
#.project
|
|
||||||
|
|
||||||
### Eclipse Patch ###
|
|
||||||
# Spring Boot Tooling
|
|
||||||
.sts4-cache/
|
|
||||||
|
|
||||||
### Java ###
|
|
||||||
# Compiled class file
|
|
||||||
*.class
|
|
||||||
|
|
||||||
# Log file
|
|
||||||
*.log
|
|
||||||
|
|
||||||
# BlueJ files
|
|
||||||
*.ctxt
|
|
||||||
|
|
||||||
# Mobile Tools for Java (J2ME)
|
|
||||||
.mtj.tmp/
|
|
||||||
|
|
||||||
# Package Files #
|
|
||||||
*.jar
|
|
||||||
*.war
|
|
||||||
*.nar
|
|
||||||
*.ear
|
|
||||||
*.zip
|
|
||||||
*.tar.gz
|
|
||||||
*.rar
|
|
||||||
|
|
||||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
|
||||||
hs_err_pid*
|
|
||||||
replay_pid*
|
|
||||||
|
|
||||||
### Linux ###
|
|
||||||
*~
|
|
||||||
|
|
||||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
|
||||||
.fuse_hidden*
|
|
||||||
|
|
||||||
# KDE directory preferences
|
|
||||||
.directory
|
|
||||||
|
|
||||||
# Linux trash folder which might appear on any partition or disk
|
|
||||||
.Trash-*
|
|
||||||
|
|
||||||
# .nfs files are created when an open file is removed but is still being accessed
|
|
||||||
.nfs*
|
|
||||||
|
|
||||||
### macOS ###
|
|
||||||
# General
|
|
||||||
.DS_Store
|
|
||||||
.AppleDouble
|
|
||||||
.LSOverride
|
|
||||||
|
|
||||||
# Icon must end with two \r
|
|
||||||
Icon
|
|
||||||
|
|
||||||
|
|
||||||
# Thumbnails
|
|
||||||
._*
|
|
||||||
|
|
||||||
# Files that might appear in the root of a volume
|
|
||||||
.DocumentRevisions-V100
|
|
||||||
.fseventsd
|
|
||||||
.Spotlight-V100
|
|
||||||
.TemporaryItems
|
|
||||||
.Trashes
|
|
||||||
.VolumeIcon.icns
|
|
||||||
.com.apple.timemachine.donotpresent
|
|
||||||
|
|
||||||
# Directories potentially created on remote AFP share
|
|
||||||
.AppleDB
|
|
||||||
.AppleDesktop
|
|
||||||
Network Trash Folder
|
|
||||||
Temporary Items
|
|
||||||
.apdisk
|
|
||||||
|
|
||||||
### macOS Patch ###
|
|
||||||
# iCloud generated files
|
|
||||||
*.icloud
|
|
||||||
|
|
||||||
### VisualStudioCode ###
|
|
||||||
.vscode/*
|
|
||||||
!.vscode/settings.json
|
|
||||||
!.vscode/tasks.json
|
|
||||||
!.vscode/launch.json
|
|
||||||
!.vscode/extensions.json
|
|
||||||
!.vscode/*.code-snippets
|
|
||||||
|
|
||||||
# Local History for Visual Studio Code
|
|
||||||
.history/
|
|
||||||
|
|
||||||
# Built Visual Studio Code Extensions
|
|
||||||
*.vsix
|
|
||||||
|
|
||||||
### VisualStudioCode Patch ###
|
|
||||||
# Ignore all local history of files
|
|
||||||
.history
|
|
||||||
.ionide
|
|
||||||
|
|
||||||
# End of https://www.toptal.com/developers/gitignore/api/java,macos,linux,visualstudiocode,eclipse
|
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>social-service-client</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -0,0 +1,4 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding//src/main/java=UTF-8
|
||||||
|
encoding//src/test/java=UTF-8
|
||||||
|
encoding/<project>=UTF-8
|
|
@ -0,0 +1,8 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.release=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.8
|
|
@ -0,0 +1,4 @@
|
||||||
|
activeProfiles=
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
resolveWorkspaceProjects=true
|
||||||
|
version=1
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"java.configuration.updateBuildConfiguration": "interactive"
|
|
||||||
}
|
|
26
CHANGELOG.md
26
CHANGELOG.md
|
@ -1,30 +1,8 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## [v2.1.0-SNAPSHOT]
|
## [v1.0.0] - 2022-04-06
|
||||||
|
|
||||||
- Feature #27999 [StorageHub] downstream components to upgrade in order to work with storagehub 1.5.0
|
First release
|
||||||
- moved to gcube-smartgears-bom 2.5.1-SNAPSHOT
|
|
||||||
|
|
||||||
|
|
||||||
## [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
|
|
||||||
- Feature #23887 possibility to get-usernames-by-role in UserClient
|
|
||||||
- Feature #23995 Social Service add support for set Message read / unread
|
|
||||||
|
|
||||||
## [v1.1.0] - 2022-04-06
|
|
||||||
|
|
||||||
- First release
|
|
||||||
- Feature #23186 - Full notifications support for social service
|
|
||||||
|
|
||||||
|
|
||||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
@ -20,12 +20,10 @@ See [Releases](https://code-repo.d4science.org/gCubeSystem/social-service-client
|
||||||
## Authors
|
## Authors
|
||||||
|
|
||||||
* **Massimiliano Assante** ([ORCID](https://orcid.org/0000-0002-3761-1492)) - [ISTI-CNR Infrascience Group](https://www.isti.cnr.it/People/M.Assante)
|
* **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
|
## Maintainers
|
||||||
|
|
||||||
* **Massimiliano Assante** ([ORCID](https://orcid.org/0000-0002-3761-1492)) - [ISTI-CNR Infrascience Group](https://www.isti.cnr.it/People/M.Assante)
|
* **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
|
## License
|
||||||
|
|
||||||
|
|
48
pom.xml
48
pom.xml
|
@ -1,29 +1,33 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.gcube.tools</groupId>
|
<groupId>org.gcube.tools</groupId>
|
||||||
<artifactId>maven-parent</artifactId>
|
<artifactId>maven-parent</artifactId>
|
||||||
<version>1.2.0</version>
|
<version>1.1.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
||||||
<groupId>org.gcube.social-networking</groupId>
|
<groupId>org.gcube.social-networking</groupId>
|
||||||
<artifactId>social-service-client</artifactId>
|
<artifactId>social-service-client</artifactId>
|
||||||
<version>2.1.0-SNAPSHOT</version>
|
<version>1.1.0-SNAPSHOT</version>
|
||||||
<name>social-networking-service-client</name>
|
<name>social-networking-service-client</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<description>The social networking web service client library</description>
|
<description>The social networking web service client library</description>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.distribution</groupId>
|
||||||
|
<artifactId>gcube-bom</artifactId>
|
||||||
|
<version>2.0.1</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.distribution</groupId>
|
<groupId>org.gcube.distribution</groupId>
|
||||||
<artifactId>gcube-smartgears-bom</artifactId>
|
<artifactId>gcube-smartgears-bom</artifactId>
|
||||||
<version>2.5.1-SNAPSHOT</version>
|
<version>2.1.0</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -50,29 +54,9 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portal</groupId>
|
<groupId>org.gcube.portal</groupId>
|
||||||
<artifactId>social-networking-library</artifactId>
|
<artifactId>social-networking-library</artifactId>
|
||||||
<version>[2.0.0, 3.0.0)</version>
|
<version>[1.16.0, 2.0.0)</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</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>
|
<dependency>
|
||||||
<groupId>org.gcube.core</groupId>
|
<groupId>org.gcube.core</groupId>
|
||||||
<artifactId>common-generic-clients</artifactId>
|
<artifactId>common-generic-clients</artifactId>
|
||||||
|
@ -81,13 +65,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.social-networking</groupId>
|
<groupId>org.gcube.social-networking</groupId>
|
||||||
<artifactId>social-service-model</artifactId>
|
<artifactId>social-service-model</artifactId>
|
||||||
<version>[1.2.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
<version>[1.0.0-SNAPSHOT, 2.0.0)</version>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
<version>1.18.2</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-lang</groupId>
|
<groupId>commons-lang</groupId>
|
||||||
|
|
|
@ -15,13 +15,15 @@ public abstract class BaseClient {
|
||||||
|
|
||||||
public BaseClient(String subPath) throws Exception {
|
public BaseClient(String subPath) throws Exception {
|
||||||
ServiceDiscoverer discoverer = new ServiceDiscoverer();
|
ServiceDiscoverer discoverer = new ServiceDiscoverer();
|
||||||
serviceEndpoint = discoverer.getEntryPoint();
|
|
||||||
logger.debug("Discovering service...");
|
logger.debug("Discovering service...");
|
||||||
serviceEndpoint = serviceEndpoint.endsWith("/") ? serviceEndpoint + subPath : serviceEndpoint + "/" + subPath;
|
serviceEndpoint = discoverer.getEntryPoint();
|
||||||
logger.info("Discovered service " + serviceEndpoint);
|
serviceEndpoint = serviceEndpoint.endsWith("/") ? serviceEndpoint + subPath :
|
||||||
|
serviceEndpoint + "/" + subPath;
|
||||||
|
logger.debug("Discovered service " + serviceEndpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getServiceEndpoint() {
|
public String getServiceEndpoint() {
|
||||||
return serviceEndpoint;
|
return serviceEndpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,10 @@
|
||||||
package org.gcube.social_networking.social_networking_client_library;
|
package org.gcube.social_networking.social_networking_client_library;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.ws.rs.core.GenericType;
|
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.social_networking_client_library.utils.HttpClient;
|
||||||
import org.gcube.social_networking.socialnetworking.model.output.ResponseBean;
|
import org.gcube.social_networking.socialnetworking.model.output.ResponseBean;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -19,7 +13,6 @@ import org.slf4j.LoggerFactory;
|
||||||
/**
|
/**
|
||||||
* HashTags client.
|
* HashTags client.
|
||||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
* @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{
|
public class HashTagClient extends BaseClient{
|
||||||
|
|
||||||
|
@ -41,4 +34,5 @@ public class HashTagClient extends BaseClient{
|
||||||
String request = getServiceEndpoint() + thisMethodSignature;
|
String request = getServiceEndpoint() + thisMethodSignature;
|
||||||
return HttpClient.get(new GenericType<ResponseBean<HashMap<String, Integer>>>(){}, request);
|
return HttpClient.get(new GenericType<ResponseBean<HashMap<String, Integer>>>(){}, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,487 +0,0 @@
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,13 +3,12 @@ package org.gcube.social_networking.social_networking_client_library;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.ws.rs.core.Form;
|
|
||||||
import javax.ws.rs.core.GenericType;
|
import javax.ws.rs.core.GenericType;
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.gcube.social_networking.social_networking_client_library.utils.HttpClient;
|
import org.gcube.social_networking.social_networking_client_library.utils.HttpClient;
|
||||||
|
import org.gcube.social_networking.socialnetworking.model.beans.Message;
|
||||||
import org.gcube.social_networking.socialnetworking.model.beans.MessageInbox;
|
import org.gcube.social_networking.socialnetworking.model.beans.MessageInbox;
|
||||||
import org.gcube.social_networking.socialnetworking.model.beans.MessageInputBean;
|
|
||||||
import org.gcube.social_networking.socialnetworking.model.output.ResponseBean;
|
import org.gcube.social_networking.socialnetworking.model.output.ResponseBean;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -58,7 +57,7 @@ public class MessageClient extends BaseClient{
|
||||||
* Write message
|
* Write message
|
||||||
* @return message id
|
* @return message id
|
||||||
*/
|
*/
|
||||||
public String writeMessage(MessageInputBean m){
|
public String writeMessage(Message m){
|
||||||
|
|
||||||
Validate.isTrue(m != null, "Message cannot be null");
|
Validate.isTrue(m != null, "Message cannot be null");
|
||||||
|
|
||||||
|
@ -68,26 +67,4 @@ public class MessageClient extends BaseClient{
|
||||||
return HttpClient.post(new GenericType<ResponseBean<String>>(){}, request, m);
|
return HttpClient.post(new GenericType<ResponseBean<String>>(){}, request, m);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* mark the message read or not
|
|
||||||
* @param messageId the message identifier
|
|
||||||
* @param read true to set read, false to set unread
|
|
||||||
* @return the result of the operation
|
|
||||||
*/
|
|
||||||
public String markMessageRead(String messageId, boolean read) {
|
|
||||||
|
|
||||||
Validate.isTrue(messageId != null, "Message id cannot be null");
|
|
||||||
|
|
||||||
logger.debug("set Message id:" + messageId + " read?" + read);
|
|
||||||
String thisMethodSignature = "set-message-read";
|
|
||||||
String request = getServiceEndpoint() + thisMethodSignature;
|
|
||||||
|
|
||||||
Form form = new Form();
|
|
||||||
form.param("messageId", messageId);
|
|
||||||
form.param("read", read+"");
|
|
||||||
|
|
||||||
return HttpClient.postFormData(new GenericType<ResponseBean<String>>(){}, request, form);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,12 @@
|
||||||
package org.gcube.social_networking.social_networking_client_library;
|
package org.gcube.social_networking.social_networking_client_library;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.ws.rs.core.GenericType;
|
import javax.ws.rs.core.GenericType;
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.gcube.portal.databook.shared.Notification;
|
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.social_networking_client_library.utils.HttpClient;
|
||||||
import org.gcube.social_networking.socialnetworking.model.beans.JobNotificationBean;
|
import org.gcube.social_networking.socialnetworking.model.beans.JobNotificationBean;
|
||||||
import org.gcube.social_networking.socialnetworking.model.beans.catalogue.CatalogueEvent;
|
import org.gcube.social_networking.socialnetworking.model.beans.catalogue.CatalogueEvent;
|
||||||
|
@ -28,7 +20,6 @@ import org.slf4j.LoggerFactory;
|
||||||
/**
|
/**
|
||||||
* Notifications client.
|
* Notifications client.
|
||||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
* @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{
|
public class NotificationClient extends BaseClient{
|
||||||
|
|
||||||
|
@ -49,7 +40,7 @@ public class NotificationClient extends BaseClient{
|
||||||
public List<Notification> getNotifications(int from, int quantity){
|
public List<Notification> getNotifications(int from, int quantity){
|
||||||
|
|
||||||
Validate.isTrue(from >= 1, "From cannot be negative");
|
Validate.isTrue(from >= 1, "From cannot be negative");
|
||||||
Validate.isTrue(quantity >= 0, "Quantity cannot be negative");
|
Validate.isTrue(from >= 0, "Quantity cannot be negative");
|
||||||
|
|
||||||
logger.debug("Request for getting notifications");
|
logger.debug("Request for getting notifications");
|
||||||
String thisMethodSignature = "get-range-notifications";
|
String thisMethodSignature = "get-range-notifications";
|
||||||
|
@ -98,4 +89,5 @@ public class NotificationClient extends BaseClient{
|
||||||
HttpClient.post(new GenericType<ResponseBean<String>>(){}, request, event);
|
HttpClient.post(new GenericType<ResponseBean<String>>(){}, request, event);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,15 +3,12 @@ package org.gcube.social_networking.social_networking_client_library;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.ws.rs.core.GenericType;
|
import javax.ws.rs.core.GenericType;
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.gcube.portal.databook.shared.*;
|
import org.gcube.portal.databook.shared.Feed;
|
||||||
|
|
||||||
import org.gcube.social_networking.social_networking_client_library.utils.HttpClient;
|
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.beans.PostInputBean;
|
||||||
import org.gcube.social_networking.socialnetworking.model.output.ResponseBean;
|
import org.gcube.social_networking.socialnetworking.model.output.ResponseBean;
|
||||||
|
@ -21,7 +18,6 @@ import org.slf4j.LoggerFactory;
|
||||||
/**
|
/**
|
||||||
* Posts client.
|
* Posts client.
|
||||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
* @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{
|
public class PostClient extends BaseClient{
|
||||||
|
|
||||||
|
@ -37,14 +33,14 @@ public class PostClient extends BaseClient{
|
||||||
* Get posts since date
|
* Get posts since date
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<Post> getUserPostsSinceDate(long timeInMillis){
|
public List<Feed> getUserPostsSinceDate(long timeInMillis){
|
||||||
|
|
||||||
Validate.isTrue(timeInMillis >= 0, "time cannot be negative");
|
Validate.isTrue(timeInMillis >= 0, "time cannot be negative");
|
||||||
|
|
||||||
logger.debug("Request for getting posts");
|
logger.debug("Request for getting posts");
|
||||||
String thisMethodSignature = "get-posts-user-since";
|
String thisMethodSignature = "get-posts-user-since";
|
||||||
String request = getServiceEndpoint() + thisMethodSignature + "?time=" + timeInMillis;
|
String request = getServiceEndpoint() + thisMethodSignature + "?time=" + timeInMillis;
|
||||||
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Post>>>(){}, request);
|
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Feed>>>(){}, request);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,12 +48,12 @@ public class PostClient extends BaseClient{
|
||||||
* Get all posts
|
* Get all posts
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<Post> getAllUserPosts(){
|
public List<Feed> getAllUserPosts(){
|
||||||
|
|
||||||
logger.debug("Request for getting posts");
|
logger.debug("Request for getting posts");
|
||||||
String thisMethodSignature = "get-posts-user";
|
String thisMethodSignature = "get-posts-user";
|
||||||
String request = getServiceEndpoint() + thisMethodSignature;
|
String request = getServiceEndpoint() + thisMethodSignature;
|
||||||
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Post>>>(){}, request);
|
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Feed>>>(){}, request);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,14 +61,14 @@ public class PostClient extends BaseClient{
|
||||||
* Get posts quantity
|
* Get posts quantity
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<Post> getUserPostsQuantity(int quantity){
|
public List<Feed> getUserPostsQuantity(int quantity){
|
||||||
|
|
||||||
Validate.isTrue(quantity >= 0, "quantity cannot be negative");
|
Validate.isTrue(quantity >= 0, "quantity cannot be negative");
|
||||||
|
|
||||||
logger.debug("Request for getting posts");
|
logger.debug("Request for getting posts");
|
||||||
String thisMethodSignature = "get-posts-user-quantity";
|
String thisMethodSignature = "get-posts-user-quantity";
|
||||||
String request = getServiceEndpoint() + thisMethodSignature + "?quantity=" + quantity;
|
String request = getServiceEndpoint() + thisMethodSignature + "?quantity=" + quantity;
|
||||||
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Post>>>(){}, request);
|
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Feed>>>(){}, request);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,14 +76,14 @@ public class PostClient extends BaseClient{
|
||||||
* Write post
|
* Write post
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Post writeUserPost(PostInputBean toWrite){
|
public Feed writeUserPost(PostInputBean toWrite){
|
||||||
|
|
||||||
Validate.isTrue(toWrite != null, "Post to write cannot be null");
|
Validate.isTrue(toWrite != null, "Post to write cannot be null");
|
||||||
|
|
||||||
logger.debug("Request for writing post");
|
logger.debug("Request for writing post");
|
||||||
String thisMethodSignature = "write-post-user";
|
String thisMethodSignature = "write-post-user";
|
||||||
String request = getServiceEndpoint() + thisMethodSignature;
|
String request = getServiceEndpoint() + thisMethodSignature;
|
||||||
return HttpClient.post(new GenericType<ResponseBean<Post>>(){}, request, toWrite);
|
return HttpClient.post(new GenericType<ResponseBean<Feed>>(){}, request, toWrite);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,12 +91,12 @@ public class PostClient extends BaseClient{
|
||||||
* Get posts application (token set must belong to the application)
|
* Get posts application (token set must belong to the application)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<Post> getAllApplicationPosts(){
|
public List<Feed> getAllApplicationPosts(){
|
||||||
|
|
||||||
logger.debug("Request for getting posts");
|
logger.debug("Request for getting posts");
|
||||||
String thisMethodSignature = "get-posts-app";
|
String thisMethodSignature = "get-posts-app";
|
||||||
String request = getServiceEndpoint() + thisMethodSignature;
|
String request = getServiceEndpoint() + thisMethodSignature;
|
||||||
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Post>>>(){}, request);
|
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Feed>>>(){}, request);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,19 +104,18 @@ public class PostClient extends BaseClient{
|
||||||
* Write post application (token set must belong to the application)
|
* Write post application (token set must belong to the application)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Post writeApplicationPost(PostInputBean toWrite){
|
public Feed writeApplicationPost(PostInputBean toWrite){
|
||||||
|
|
||||||
Validate.isTrue(toWrite != null, "Post to write cannot be null");
|
Validate.isTrue(toWrite != null, "Post to write cannot be null");
|
||||||
|
|
||||||
logger.debug("Request for writing application post");
|
logger.debug("Request for writing application post");
|
||||||
String thisMethodSignature = "write-post-app";
|
String thisMethodSignature = "write-post-app";
|
||||||
String request = getServiceEndpoint() + thisMethodSignature;
|
String request = getServiceEndpoint() + thisMethodSignature;
|
||||||
return HttpClient.post(new GenericType<ResponseBean<Post>>(){}, request, toWrite);
|
return HttpClient.post(new GenericType<ResponseBean<Feed>>(){}, request, toWrite);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated use List<Post> getVREPosts()
|
|
||||||
* Get posts vre
|
* Get posts vre
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -131,18 +126,6 @@ public class PostClient extends BaseClient{
|
||||||
String request = getServiceEndpoint() + thisMethodSignature;
|
String request = getServiceEndpoint() + thisMethodSignature;
|
||||||
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Feed>>>(){}, request);
|
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Feed>>>(){}, request);
|
||||||
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Get posts vre
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public List<Post> getVREPosts(){
|
|
||||||
|
|
||||||
logger.debug("Request for getting posts vre");
|
|
||||||
String thisMethodSignature = "get-posts-vre";
|
|
||||||
String request = getServiceEndpoint() + thisMethodSignature;
|
|
||||||
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Post>>>(){}, request);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -150,14 +133,14 @@ public class PostClient extends BaseClient{
|
||||||
* @return
|
* @return
|
||||||
* @throws UnsupportedEncodingException
|
* @throws UnsupportedEncodingException
|
||||||
*/
|
*/
|
||||||
public List<Post> getHashtagPosts(String hashtag) throws UnsupportedEncodingException{
|
public List<Feed> getHashtagPosts(String hashtag) throws UnsupportedEncodingException{
|
||||||
|
|
||||||
Validate.isTrue(hashtag != null, "hashtag cannot be null");
|
Validate.isTrue(hashtag != null, "hashtag cannot be null");
|
||||||
|
|
||||||
logger.debug("Request for getting posts with hashtag " + hashtag);
|
logger.debug("Request for getting posts with hashtag " + hashtag);
|
||||||
String thisMethodSignature = "get-posts-by-hashtag";
|
String thisMethodSignature = "get-posts-by-hashtag";
|
||||||
String request = getServiceEndpoint() + thisMethodSignature + "?hashtag=" + URLEncoder.encode(hashtag, "UTF-8");
|
String request = getServiceEndpoint() + thisMethodSignature + "?hashtag=" + URLEncoder.encode(hashtag, "UTF-8");
|
||||||
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Post>>>(){}, request);
|
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Feed>>>(){}, request);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,12 +148,12 @@ public class PostClient extends BaseClient{
|
||||||
* Get liked posts
|
* Get liked posts
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<Post> getUserLikedPost(){
|
public List<Feed> getUserLikedPost(){
|
||||||
|
|
||||||
logger.debug("Request for getting posts liked");
|
logger.debug("Request for getting posts liked");
|
||||||
String thisMethodSignature = "get-liked-posts";
|
String thisMethodSignature = "get-liked-posts";
|
||||||
String request = getServiceEndpoint() + thisMethodSignature;
|
String request = getServiceEndpoint() + thisMethodSignature;
|
||||||
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Post>>>(){}, request);
|
return HttpClient.get(new GenericType<ResponseBean<ArrayList<Feed>>>(){}, request);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,4 +169,5 @@ public class PostClient extends BaseClient{
|
||||||
return HttpClient.get(new GenericType<ResponseBean<ArrayList<String>>>(){}, request);
|
return HttpClient.get(new GenericType<ResponseBean<ArrayList<String>>>(){}, request);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,8 @@ package org.gcube.social_networking.social_networking_client_library;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.ws.rs.core.GenericType;
|
import javax.ws.rs.core.GenericType;
|
||||||
|
|
||||||
|
@ -126,35 +124,19 @@ public class UserClient extends BaseClient{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get usernames by role
|
* Get usernames by local role
|
||||||
* @deprecated use #getAllUsernamesByRole(String rolename) instead
|
* @return
|
||||||
* @return the usernames having such role
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public List<String> getAllUsernamesByLocalRole(String localRole){
|
public List<String> getAllUsernamesByLocalRole(String localRole){
|
||||||
|
|
||||||
Validate.isTrue(localRole != null, "role cannot be null");
|
Validate.isTrue(localRole != null, "role cannot be null");
|
||||||
|
|
||||||
logger.debug("Request for getting usernames by role role");
|
logger.debug("Request for getting usernames with global role");
|
||||||
String thisMethodSignature = "get-usernames-by-role";
|
String thisMethodSignature = "get-usernames-by-role";
|
||||||
String request = getServiceEndpoint() + thisMethodSignature + "?role-name=" + localRole;
|
String request = getServiceEndpoint() + thisMethodSignature + "?role-name=" + localRole;
|
||||||
return HttpClient.get(new GenericType<ResponseBean<ArrayList<String>>>(){}, request);
|
return HttpClient.get(new GenericType<ResponseBean<ArrayList<String>>>(){}, request);
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Get usernames by role, the environment (i.e. VRE/VLab) is inferred from the token
|
|
||||||
* @return the usernames having such role
|
|
||||||
*/
|
|
||||||
public Set<String>getAllUsernamesByRole(String rolename){
|
|
||||||
Validate.isTrue(rolename != null, "role cannot be null");
|
|
||||||
|
|
||||||
logger.debug("Request for getting usernames with global role");
|
|
||||||
String thisMethodSignature = "get-usernames-by-role";
|
|
||||||
String request = getServiceEndpoint() + thisMethodSignature + "?role-name=" + rolename;
|
|
||||||
ArrayList<String> sourceList = HttpClient.get(new GenericType<ResponseBean<ArrayList<String>>>(){}, request);
|
|
||||||
Set<String> usernames = new HashSet<>(sourceList);
|
|
||||||
return usernames;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if user exists
|
* Check if user exists
|
||||||
|
|
|
@ -4,9 +4,7 @@ import javax.ws.rs.WebApplicationException;
|
||||||
import javax.ws.rs.client.Client;
|
import javax.ws.rs.client.Client;
|
||||||
import javax.ws.rs.client.ClientBuilder;
|
import javax.ws.rs.client.ClientBuilder;
|
||||||
import javax.ws.rs.client.Entity;
|
import javax.ws.rs.client.Entity;
|
||||||
import javax.ws.rs.client.Invocation.Builder;
|
|
||||||
import javax.ws.rs.client.WebTarget;
|
import javax.ws.rs.client.WebTarget;
|
||||||
import javax.ws.rs.core.Form;
|
|
||||||
import javax.ws.rs.core.GenericType;
|
import javax.ws.rs.core.GenericType;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
@ -88,36 +86,4 @@ public class HttpClient{
|
||||||
|
|
||||||
return result.getResult();
|
return result.getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Executes a post request
|
|
||||||
* @param returnType
|
|
||||||
* @param requestUrl
|
|
||||||
* @param obj
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static <R> R postFormData(GenericType<ResponseBean<R>> returnType, String requestUrl, Form form){
|
|
||||||
|
|
||||||
logger.debug("Executing post request at url " + requestUrl);
|
|
||||||
|
|
||||||
ClientConfig cc = new ClientConfig().register(new JacksonFeature()).register(new AuthorizationFilter()).register(new CustomObjectMapper());;
|
|
||||||
Client client = ClientBuilder.newClient(cc);
|
|
||||||
WebTarget webResourceGet = client.target(requestUrl);
|
|
||||||
Builder basicRequest = webResourceGet.request();
|
|
||||||
Response response = basicRequest.post(Entity.form(form), Response.class);
|
|
||||||
|
|
||||||
if(response == null)
|
|
||||||
throw new WebApplicationException("Response returned by the service is null");
|
|
||||||
|
|
||||||
if(response.getStatus() >= 300)
|
|
||||||
throw new WebApplicationException("There was an error at server side: " + response.getStatusInfo());
|
|
||||||
|
|
||||||
ResponseBean<R> result = response.readEntity(returnType);
|
|
||||||
|
|
||||||
if (!result.isSuccess())
|
|
||||||
throw new WebApplicationException(
|
|
||||||
"Error message is " + result.getMessage());
|
|
||||||
|
|
||||||
return result.getResult();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,18 +3,16 @@ package org.gcube.portal.social_networking_client_library;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.gcube.common.authorization.library.provider.AccessTokenProvider;
|
import org.gcube.common.authorization.library.provider.AccessTokenProvider;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.portal.databook.shared.EnhancedFeed;
|
import org.gcube.portal.databook.shared.EnhancedFeed;
|
||||||
|
import org.gcube.portal.databook.shared.Feed;
|
||||||
import org.gcube.portal.databook.shared.Notification;
|
import org.gcube.portal.databook.shared.Notification;
|
||||||
import org.gcube.portal.databook.shared.Post;
|
|
||||||
import org.gcube.social_networking.social_networking_client_library.FullTextSearchClient;
|
import org.gcube.social_networking.social_networking_client_library.FullTextSearchClient;
|
||||||
import org.gcube.social_networking.social_networking_client_library.HashTagClient;
|
import org.gcube.social_networking.social_networking_client_library.HashTagClient;
|
||||||
import org.gcube.social_networking.social_networking_client_library.MessageClient;
|
import org.gcube.social_networking.social_networking_client_library.MessageClient;
|
||||||
|
@ -27,8 +25,8 @@ import org.gcube.social_networking.social_networking_client_library.VREClient;
|
||||||
import org.gcube.social_networking.socialnetworking.model.beans.ApplicationId;
|
import org.gcube.social_networking.socialnetworking.model.beans.ApplicationId;
|
||||||
import org.gcube.social_networking.socialnetworking.model.beans.JobNotificationBean;
|
import org.gcube.social_networking.socialnetworking.model.beans.JobNotificationBean;
|
||||||
import org.gcube.social_networking.socialnetworking.model.beans.JobStatusModelType;
|
import org.gcube.social_networking.socialnetworking.model.beans.JobStatusModelType;
|
||||||
|
import org.gcube.social_networking.socialnetworking.model.beans.Message;
|
||||||
import org.gcube.social_networking.socialnetworking.model.beans.MessageInbox;
|
import org.gcube.social_networking.socialnetworking.model.beans.MessageInbox;
|
||||||
import org.gcube.social_networking.socialnetworking.model.beans.MessageInputBean;
|
|
||||||
import org.gcube.social_networking.socialnetworking.model.beans.MyVRE;
|
import org.gcube.social_networking.socialnetworking.model.beans.MyVRE;
|
||||||
import org.gcube.social_networking.socialnetworking.model.beans.PostInputBean;
|
import org.gcube.social_networking.socialnetworking.model.beans.PostInputBean;
|
||||||
import org.gcube.social_networking.socialnetworking.model.beans.Recipient;
|
import org.gcube.social_networking.socialnetworking.model.beans.Recipient;
|
||||||
|
@ -51,34 +49,27 @@ public class TestClientServices {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(TestClientServices.class);
|
private static Logger logger = LoggerFactory.getLogger(TestClientServices.class);
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Before
|
@Before
|
||||||
public void setContextAndToken(){
|
public void setContextAndToken(){
|
||||||
|
|
||||||
//ScopeProvider.instance.set("/d4science.research-infrastructures.eu/gCubeApps/gCube");
|
|
||||||
//String umaToken = "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJySUJPYjZZY3p2ZE4xNVpuNHFkUTRLdEQ5VUhyY1dwNWJCT3NaLXpYbXM0In0.eyJleHAiOjE2NjM2NjU2NTgsImlhdCI6MTY2MzY2NTM1OCwiYXV0aF90aW1lIjoxNj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InJvbGVzIjpbIkNhdGFsb2d1ZS1NYW5hZ2VyIiwiQ2F0YWxvZ3VlLU1vZGVyYXRvciIsIk1lbWJlciJdfX0sImF1dGhvcml6YXRpb24iOnsicGVybWlzc2lvbnMiOlt7InJzaWQiOiI1NzI4NTUxMC0zOTM5LTRkZTctOGZjMS1lM2E5ZDNjY2UyODEiLCJyc25hbWUiOiJEZWZhdWx0IFJlc291cmNlIn1dfSwic2NvcGUiOiJlbWFpbCBwcm9maWxlIiwic2lkIjoiZjI2MjU0MjAtNzRjNS00NTQ0LWI2NmEtZGZhMDhkNjdkNDU0IiwiZW1haWxfdmVyaWZpZWQiOnRydWUsIm5hbWUiOiJMdWNhIEZyb3NpbmkiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJsdWNhLmZyb3NpbmkiLCJnaXZlbl9uYW1lIjoiTHVjYSIsImZhbWlseV9uYW1lIjoiRnJvc2luaSIsImVtYWlsIjoibHVjYS5mcm9zaW5pQGlzdGkuY25yLml0In0.jt43mGeSm_4hVNFThTBmmOxzotsTHPp0DKDzBNAgESFkzNRb7ZE1j7Ab_1M6fqjpciLsk093XTEpws0OksUEAWUgxj5iAOXopJKRr6cCnmQXitWTa8WpwWZyj6AiI8PSgHCQhY3-CU8mptmd4acDtagHSbhZ320aNx7rLTaZ_7KEdRmErmgzWhnPwD3O2ONcnxIuAL1rqu4o8SJl-cj5ppFc2V54VSY56AT2IK2GmP_he9R32_0K_F0SAwsuDmv7eF1MwQM7j27H9ewfEKP8w9RooZtZYj3Pm7-Ac4XSir9w5eG1xKOyiGbIlvJZU4FQwXINntUVTVPVfPaXZ_ZbOw";
|
//SecurityTokenProvider.instance.set("");
|
||||||
AccessTokenProvider.instance.set(umaToken);
|
|
||||||
SecurityTokenProvider.instance.set("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCatalogueEvents() throws Exception {
|
public void testCatalogueEvents() throws Exception {
|
||||||
NotificationClient nc = new NotificationClient();
|
NotificationClient nc = new NotificationClient();
|
||||||
String[] idstoNotify = {"andrea.rossi"};
|
String[] idstoNotify = {"andrea.rossi", "mister.pink"};
|
||||||
CatalogueEvent event =
|
CatalogueEvent event =
|
||||||
new CatalogueEvent(
|
new CatalogueEvent(
|
||||||
CatalogueEventType.ITEM_SUBMITTED,
|
CatalogueEventType.ITEM_SUBMITTED,
|
||||||
idstoNotify,
|
idstoNotify,
|
||||||
"Submitted item RESTful Transaction Model",
|
"Wyscout soccer-logs dataset",
|
||||||
"Giorgino Giorgetti created the item RESTful Transaction Model. You are kindly requested to review it and decide either to APPROVE or REJECT it. ",
|
"submitted \"Wyscout soccer-logs dataset\", a dataset of soccer-logs for all the main soccer leagues in the world, from season 2014/2015 to the current one. ",
|
||||||
new URL("https://data-dev.d4science.net/rU7T"));
|
new URL("http://data.d4science.org/ctlg/ResourceCatalogue/wyscout_soccer-logs_dataset"));
|
||||||
nc.sendCatalogueEvent(event);
|
nc.sendCatalogueEvent(event);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -90,7 +81,7 @@ public class TestClientServices {
|
||||||
FileItemBean fileItem = new FileItemBean("90b8da48-d363-441a-f0a2-4f413ae747d7", "updated item.pdf", "updated item.pdf",
|
FileItemBean fileItem = new FileItemBean("90b8da48-d363-441a-f0a2-4f413ae747d7", "updated item.pdf", "updated item.pdf",
|
||||||
"/Workspace/_shared attachments/test updated item from client", folder);
|
"/Workspace/_shared attachments/test updated item from client", folder);
|
||||||
|
|
||||||
String[] idstoNotify = {"andrea.rossi"};
|
String[] idstoNotify = {"andrea.rossi", "mister.pink"};
|
||||||
WorkspaceEvent event = new UpdatedItemEvent(idstoNotify, fileItem);
|
WorkspaceEvent event = new UpdatedItemEvent(idstoNotify, fileItem);
|
||||||
nc.sendWorkspaceEvent(event);
|
nc.sendWorkspaceEvent(event);
|
||||||
event = new AddedItemEvent(idstoNotify, fileItem);
|
event = new AddedItemEvent(idstoNotify, fileItem);
|
||||||
|
@ -98,7 +89,7 @@ public class TestClientServices {
|
||||||
event = new DeletedItemEvent(idstoNotify, "theDeletedFilenName.pdf", folder);
|
event = new DeletedItemEvent(idstoNotify, "theDeletedFilenName.pdf", folder);
|
||||||
nc.sendWorkspaceEvent(event);
|
nc.sendWorkspaceEvent(event);
|
||||||
|
|
||||||
String[] contextIdstoNotify = {"/pred4s/preprod/preVRE"};
|
String[] contextIdstoNotify = {"/gcube/devsec/devVRE"};
|
||||||
event = new UpdatedItemEvent(contextIdstoNotify, true, fileItem);
|
event = new UpdatedItemEvent(contextIdstoNotify, true, fileItem);
|
||||||
nc.sendWorkspaceEvent(event);
|
nc.sendWorkspaceEvent(event);
|
||||||
}
|
}
|
||||||
|
@ -154,8 +145,8 @@ public class TestClientServices {
|
||||||
public void sendMessage() throws Exception{
|
public void sendMessage() throws Exception{
|
||||||
logger.debug("Sending message ");
|
logger.debug("Sending message ");
|
||||||
MessageClient messagesClient = new MessageClient();
|
MessageClient messagesClient = new MessageClient();
|
||||||
List<Recipient> rec = Arrays.asList(new Recipient("andrea.rossi"), new Recipient("giancarlo.panichi"));
|
List<Recipient> rec = Arrays.asList(new Recipient("andrea.rossi"));
|
||||||
MessageInputBean message = new MessageInputBean(
|
Message message = new Message(
|
||||||
"Test message",
|
"Test message",
|
||||||
"Sending message via client " + System.currentTimeMillis(),
|
"Sending message via client " + System.currentTimeMillis(),
|
||||||
new ArrayList<Recipient>(rec));
|
new ArrayList<Recipient>(rec));
|
||||||
|
@ -163,16 +154,6 @@ public class TestClientServices {
|
||||||
assert(idMessage != null);
|
assert(idMessage != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void markMessageRead() throws Exception{
|
|
||||||
logger.debug("markMessageRead message ");
|
|
||||||
MessageClient messagesClient = new MessageClient();
|
|
||||||
String idMessage = messagesClient.markMessageRead("a7b825c3-a0ca-42d7-b228-00b9e8f015e4", false);
|
|
||||||
assert(idMessage != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//@Test
|
//@Test
|
||||||
public void testNotifications() throws Exception {
|
public void testNotifications() throws Exception {
|
||||||
NotificationClient notificationsClient = new NotificationClient();
|
NotificationClient notificationsClient = new NotificationClient();
|
||||||
|
@ -217,19 +198,23 @@ public class TestClientServices {
|
||||||
logger.debug("My Vres " + myVres);
|
logger.debug("My Vres " + myVres);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
//@Test
|
||||||
public void TestUsersClient() throws Exception{
|
public void UsersClientTests() throws Exception{
|
||||||
|
|
||||||
UserClient userClient = new UserClient();
|
UserClient userClient = new UserClient();
|
||||||
Set<String> vreManagers = userClient.getAllUsernamesByRole("Data-Manager");
|
|
||||||
|
// Requires user token bound to the root context
|
||||||
|
// List<String> administrators = userClient.getAllUsernamesByGlobalRole("administrator");
|
||||||
|
//
|
||||||
|
// assert(administrators != null && !administrators.isEmpty());
|
||||||
|
|
||||||
|
// logger.debug("Administrators are " + administrators);
|
||||||
|
|
||||||
|
List<String> vreManagers = userClient.getAllUsernamesByLocalRole("vre-manager");
|
||||||
|
|
||||||
assert(vreManagers != null && !vreManagers.isEmpty());
|
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);
|
|
||||||
|
|
||||||
|
|
||||||
|
logger.debug("Vre Managers are " + vreManagers);
|
||||||
|
|
||||||
String myEmail = userClient.getEmail();
|
String myEmail = userClient.getEmail();
|
||||||
|
|
||||||
|
@ -245,7 +230,7 @@ public class TestClientServices {
|
||||||
|
|
||||||
String industry = userClient.getCustomAttribute("Industry");
|
String industry = userClient.getCustomAttribute("Industry");
|
||||||
|
|
||||||
//assert(industry != null && !industry.isEmpty());
|
assert(industry != null && !industry.isEmpty());
|
||||||
|
|
||||||
logger.debug("My Industry is " + industry);
|
logger.debug("My Industry is " + industry);
|
||||||
|
|
||||||
|
@ -276,51 +261,40 @@ public class TestClientServices {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
//@Test
|
||||||
public void getUserPostsSinceDate() throws Exception{
|
public void getUserPostsSinceDate() throws Exception{
|
||||||
|
|
||||||
PostClient postClient = new PostClient();
|
PostClient postClient = new PostClient();
|
||||||
List<Post> sinceLastYearPost = postClient.getUserPostsSinceDate(System.currentTimeMillis() - 1000 * 60 * 60 * 24 * 12);
|
List<Feed> sinceLastYearPost = postClient.getUserPostsSinceDate(System.currentTimeMillis() - 1000 * 60 * 60 * 24 * 12);
|
||||||
logger.debug("Posts are " + sinceLastYearPost);
|
logger.debug("Posts are " + sinceLastYearPost);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
//@Test
|
||||||
public void getAllUserPosts() throws Exception{
|
public void getAllUserPosts() throws Exception{
|
||||||
|
|
||||||
PostClient postClient = new PostClient();
|
PostClient postClient = new PostClient();
|
||||||
List<Post> allposts = postClient.getAllUserPosts();
|
List<Feed> allposts = postClient.getAllUserPosts();
|
||||||
logger.debug("All posts found:");
|
logger.debug("All posts are " + allposts);
|
||||||
for (Post post : allposts) {
|
|
||||||
logger.debug(post.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
//@Test
|
||||||
public void getUserPostsQuantity() throws Exception{
|
public void getUserPostsQuantity() throws Exception{
|
||||||
|
|
||||||
PostClient postClient = new PostClient();
|
PostClient postClient = new PostClient();
|
||||||
List<Post> quantityPosts = postClient.getUserPostsQuantity(3);
|
List<Feed> quantityPosts = postClient.getUserPostsQuantity(3);
|
||||||
logger.debug("Some posts are ");
|
logger.debug("Some posts are " + quantityPosts);
|
||||||
logger.debug(quantityPosts + " posts found:");
|
|
||||||
for (Post post : quantityPosts) {
|
|
||||||
logger.debug(post.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
//@Test
|
||||||
public void writeUserPost() throws Exception{
|
public void writeUserPost() throws Exception{
|
||||||
|
|
||||||
PostClient postClient = new PostClient();
|
PostClient postClient = new PostClient();
|
||||||
PostInputBean postInputBean = new PostInputBean();
|
PostInputBean toWrite = new PostInputBean("Testing social networking rest client", null, null, null, null, null, false, null);
|
||||||
postInputBean.setText("Testing social networking rest client at " + new Date());
|
Feed written = postClient.writeUserPost(toWrite);
|
||||||
//Post post = postClient.writeApplicationPost(postInputBean);
|
logger.debug("Written post is " + written);
|
||||||
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);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,7 +309,7 @@ public class TestClientServices {
|
||||||
SecurityTokenProvider.instance.set(token);
|
SecurityTokenProvider.instance.set(token);
|
||||||
|
|
||||||
PostClient postClient = new PostClient();
|
PostClient postClient = new PostClient();
|
||||||
List<Post> applicationPosts = postClient.getAllApplicationPosts();
|
List<Feed> applicationPosts = postClient.getAllApplicationPosts();
|
||||||
logger.debug("Application posts are " + applicationPosts);
|
logger.debug("Application posts are " + applicationPosts);
|
||||||
|
|
||||||
SecurityTokenProvider.instance.set(currentToken);
|
SecurityTokenProvider.instance.set(currentToken);
|
||||||
|
@ -354,22 +328,19 @@ public class TestClientServices {
|
||||||
|
|
||||||
PostClient postClient = new PostClient();
|
PostClient postClient = new PostClient();
|
||||||
PostInputBean toWrite = new PostInputBean("Testing social networking rest client [via application token] #apptoken #rest #client #java", null, null, null, null, null, false, null);
|
PostInputBean toWrite = new PostInputBean("Testing social networking rest client [via application token] #apptoken #rest #client #java", null, null, null, null, null, false, null);
|
||||||
Post written = postClient.writeApplicationPost(toWrite);
|
Feed written = postClient.writeApplicationPost(toWrite);
|
||||||
logger.debug("Written post is " + written);
|
logger.debug("Written post is " + written);
|
||||||
|
|
||||||
SecurityTokenProvider.instance.set(currentToken);
|
SecurityTokenProvider.instance.set(currentToken);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
//@Test
|
||||||
public void getPostsVRE() throws Exception{
|
public void getPostsVRE() throws Exception{
|
||||||
|
|
||||||
PostClient postClient = new PostClient();
|
PostClient postClient = new PostClient();
|
||||||
List<Post> vrePosts = postClient.getVREPosts();
|
List<Feed> vrePosts = postClient.getPostsVRE();
|
||||||
logger.debug("VRE posts : ");
|
logger.debug("VRE posts are " + vrePosts);
|
||||||
for (Post post : vrePosts) {
|
|
||||||
logger.debug(post.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,21 +348,21 @@ public class TestClientServices {
|
||||||
public void getHashtagPosts() throws Exception{
|
public void getHashtagPosts() throws Exception{
|
||||||
|
|
||||||
PostClient postClient = new PostClient();
|
PostClient postClient = new PostClient();
|
||||||
List<Post> postsWithHashtag = postClient.getHashtagPosts("#connect");
|
List<Feed> postsWithHashtag = postClient.getHashtagPosts("#connect");
|
||||||
logger.debug("Posts with hashtag #connect are " + postsWithHashtag);
|
logger.debug("Posts with hashtag #connect are " + postsWithHashtag);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
//@Test
|
||||||
public void getUserLikedPost() throws Exception{
|
public void getUserLikedPost() throws Exception{
|
||||||
|
|
||||||
PostClient postClient = new PostClient();
|
PostClient postClient = new PostClient();
|
||||||
List<Post> postsLiked = postClient.getUserLikedPost();
|
List<Feed> postsLiked = postClient.getUserLikedPost();
|
||||||
logger.debug("Posts liked are " + postsLiked);
|
logger.debug("Posts liked are " + postsLiked);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
//@Test
|
||||||
public void getUserLikedPostIds() throws Exception{
|
public void getUserLikedPostIds() throws Exception{
|
||||||
|
|
||||||
PostClient postClient = new PostClient();
|
PostClient postClient = new PostClient();
|
||||||
|
|
Loading…
Reference in New Issue