From 3e328e71e502897eb7c7706ee3e1b06bbea4cb94 Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Wed, 7 Mar 2018 13:28:06 +0000 Subject: [PATCH] Added JsInterop DTOs (ClientPost, ClientAttachment and JSON) for supporting new IPC Client side in NewsFeed git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/social-networking-library@164772 82a268e6-3cf1-43bd-a215-b396298e98cf --- distro/changelog.xml | 4 ++ pom.xml | 16 +++--- .../databook/shared/ClientAttachment.java | 34 +++++++++++++ .../portal/databook/shared/ClientPost.java | 51 +++++++++++++++++++ .../gcube/portal/databook/shared/JSON.java | 10 ++++ 5 files changed, 107 insertions(+), 8 deletions(-) create mode 100644 src/main/java/org/gcube/portal/databook/shared/ClientAttachment.java create mode 100644 src/main/java/org/gcube/portal/databook/shared/ClientPost.java create mode 100644 src/main/java/org/gcube/portal/databook/shared/JSON.java diff --git a/distro/changelog.xml b/distro/changelog.xml index ee25e78..251d07d 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -1,4 +1,8 @@ + + Added JsInterop DTOs (ClientPost, ClientAttachment and JSON) for supporting new IPC Client side in NewsFeed + Added support for hashtags in comments diff --git a/pom.xml b/pom.xml index 06a18f1..23ca92e 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.gcube.portal social-networking-library - 1.16.0-SNAPSHOT + 1.16.1-SNAPSHOT gCube Social Networking Library The gCube Social Networking Library is the 'bridge' between your gCube Applications and the social networking facilities. @@ -22,10 +22,10 @@ http://svn.d4science.research-infrastructures.eu/gcube/trunk/portal/${project.artifactId} - 2.7.0 + 2.8.1 distro - 1.7 - 1.7 + 1.8 + 1.8 UTF-8 UTF-8 @@ -42,6 +42,10 @@ + + com.google + gwt-jsonmaker + com.netflix.astyanax astyanax-core @@ -72,10 +76,6 @@ portal-manager provided - - com.google - gwt-jsonmaker - com.sun.mail javax.mail diff --git a/src/main/java/org/gcube/portal/databook/shared/ClientAttachment.java b/src/main/java/org/gcube/portal/databook/shared/ClientAttachment.java new file mode 100644 index 0000000..13acb08 --- /dev/null +++ b/src/main/java/org/gcube/portal/databook/shared/ClientAttachment.java @@ -0,0 +1,34 @@ +package org.gcube.portal.databook.shared; + +import jsinterop.annotations.JsOverlay; +import jsinterop.annotations.JsPackage; +import jsinterop.annotations.JsType; + +@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") +public class ClientAttachment { + public String id; + public String uri; + public String name; + public String description; + public String thumbnailURL; + public String mimeType; + /** + * @param id the id in the cassandra CF + * @param uri where you can download the file from + * @param name the name of the attached file + * @param description the description of the attached file + * @param thumbnailURL the URL of the image representing the attached file + * @param mimeType the type of file + */ + @JsOverlay + public static ClientAttachment create(String id, String uri, String name, String description, String thumbnailURL, String mimeType) { + ClientAttachment o = new ClientAttachment(); + o.id = id; + o.uri = uri; + o.name = name; + o.description = description; + o.thumbnailURL = thumbnailURL; + o.mimeType = mimeType; + return o; + } +} diff --git a/src/main/java/org/gcube/portal/databook/shared/ClientPost.java b/src/main/java/org/gcube/portal/databook/shared/ClientPost.java new file mode 100644 index 0000000..2fab59b --- /dev/null +++ b/src/main/java/org/gcube/portal/databook/shared/ClientPost.java @@ -0,0 +1,51 @@ +package org.gcube.portal.databook.shared; + +import java.util.Date; + +import jsinterop.annotations.JsOverlay; +import jsinterop.annotations.JsPackage; +import jsinterop.annotations.JsType; +/** + * + * @author Massimiliano Assante, CNR-ISTI + * Uses JsInterop annotations to deserialize the object + */ +@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") +public class ClientPost { + public String key; + public String type; + public String userid; + public Date time; + public String uri; + public String description; + public String fullName; + public String email; + public String thumbnailURL; + public String linkTitle; + public String linkDescription; + public String linkUrlThumbnail; + public String linkHost; + public ClientAttachment[] attachments; + @JsOverlay + public static ClientPost create(String key, String type, String userid, Date time, + String uri, String description, String fullName, String email, + String thumbnailURL, String linkTitle, String linkDescription, + String linkUrlThumbnail, String linkHost, ClientAttachment[] attachments) { + ClientPost o = new ClientPost(); + o.key = key; + o.type = type; + o.userid = userid; + o.time = time; + o.uri = uri; + o.description = description; + o.fullName = fullName; + o.email = email; + o.thumbnailURL = thumbnailURL; + o.linkTitle = linkTitle; + o.linkDescription = linkDescription; + o.linkUrlThumbnail = linkUrlThumbnail; + o.linkHost = linkHost; + o.attachments = attachments; + return o; + } +} diff --git a/src/main/java/org/gcube/portal/databook/shared/JSON.java b/src/main/java/org/gcube/portal/databook/shared/JSON.java new file mode 100644 index 0000000..7a660f0 --- /dev/null +++ b/src/main/java/org/gcube/portal/databook/shared/JSON.java @@ -0,0 +1,10 @@ +package org.gcube.portal.databook.shared; + +import jsinterop.annotations.JsPackage; +import jsinterop.annotations.JsType; + +@JsType(isNative = true, namespace = JsPackage.GLOBAL) +public class JSON { + public static native String stringify(Object o); + public static native O parse(String json); +}