diff --git a/CHANGELOG.md b/CHANGELOG.md
index f12ee61..20f72c7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,9 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [v2.0.0] - 2022-05-05
+
+- Fix compatability issues with social service and social model 2.0.0
## [v1.8.0] - 2022-05-05
diff --git a/pom.xml b/pom.xml
index c8c200c..375f5a5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
org.gcube.applicationsupportlayer
aslsocial
- 1.8.0
+ 2.0.0-SNAPSHOT
jar
Social Portal ASL Extension
@@ -47,15 +47,20 @@
rmp-common-library
[2.8.0-SNAPSHOT, 3.0.0-SNAPSHOT)
+
+ org.gcube.social-networking
+ social-service-client
+ [2.0.0-SNAPSHOT, 3.0.0)
+
org.gcube.common.portal
portal-manager
provided
- org.gcube.portal
- social-networking-library
- provided
+ org.gcube.social-networking
+ social-service-model
+ [1.2.0-SNAPSHOT, 2.0.0)
org.gcube.dvos
diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNewsManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNewsManager.java
index 23aa49b..4336a9f 100644
--- a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNewsManager.java
+++ b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNewsManager.java
@@ -18,10 +18,10 @@ import org.gcube.common.encryption.StringEncrypter;
import org.gcube.common.resources.gcore.ServiceEndpoint;
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
import org.gcube.common.scope.api.ScopeProvider;
-import org.gcube.portal.databook.shared.Feed;
-import org.gcube.portal.databook.shared.FeedType;
-import org.gcube.portal.databook.shared.ImageType;
-import org.gcube.portal.databook.shared.PrivacyLevel;
+import org.gcube.social_networking.socialnetworking.model.shared.Post;
+import org.gcube.social_networking.socialnetworking.model.shared.PostType;
+import org.gcube.social_networking.socialnetworking.model.shared.ImageType;
+import org.gcube.social_networking.socialnetworking.model.shared.PrivacyLevel;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
import org.slf4j.Logger;
@@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory;
*
* @author Massimiliano Assante, ISTI-CNR
*
- * use to share updates from within your applicationProfile, the update will be published in the Users News Feed belonging to the VRE your applicationProfile runs into
+ * use to share updates from within your applicationProfile, the update will be published in the Users News Post belonging to the VRE your applicationProfile runs into
*/
public class ApplicationNewsManager extends SocialPortalBridge implements NewsManager {
@@ -56,42 +56,42 @@ public class ApplicationNewsManager extends SocialPortalBridge implements NewsMa
* {@inheritDoc}
*/
@Override
- public boolean shareApplicationUpdate(String feedText) {
- return getStoreInstance().saveAppFeed(buildFeed(feedText, "", "", "", ""));
+ public boolean shareApplicationUpdate(String postText) {
+ return getStoreInstance().saveAppPostLib(buildPost(postText, "", "", "", ""));
}
/**
* {@inheritDoc}
*/
@Override
- public boolean shareApplicationUpdate(String feedText, String uriParams) {
- return getStoreInstance().saveAppFeed(buildFeed(feedText, uriParams, "", "", ""));
+ public boolean shareApplicationUpdate(String postText, String uriParams) {
+ return getStoreInstance().saveAppPostLib(buildPost(postText, uriParams, "", "", ""));
}
/**
* {@inheritDoc}
*/
@Override
- public boolean shareApplicationUpdate(String feedText, String uriParams, String previewTitle, String previewDescription, String previewThumbnailUrl) {
- return getStoreInstance().saveAppFeed(buildFeed(feedText, uriParams, previewTitle, previewDescription, previewThumbnailUrl));
+ public boolean shareApplicationUpdate(String postText, String uriParams, String previewTitle, String previewDescription, String previewThumbnailUrl) {
+ return getStoreInstance().saveAppPostLib(buildPost(postText, uriParams, previewTitle, previewDescription, previewThumbnailUrl));
}
/**
* {@inheritDoc}
*/
@Override
- public boolean shareApplicationUpdate(String feedText, String uriParams, String previewTitle, String previewDescription, InputStream previewThumbnailInputStream, ImageType imageExtension) {
+ public boolean shareApplicationUpdate(String postText, String uriParams, String previewTitle, String previewDescription, InputStream previewThumbnailInputStream, ImageType imageExtension) {
String httpImageUrl = uploadImageOnFTPServer(previewThumbnailInputStream, imageExtension);
- return shareApplicationUpdate(feedText, uriParams, previewTitle, previewDescription, httpImageUrl);
+ return shareApplicationUpdate(postText, uriParams, previewTitle, previewDescription, httpImageUrl);
}
/**
- * buid a an ApplicationProfile Feed
+ * buid a an ApplicationProfile Post
*
* @param description add a description for the update you are sharing
* @param uriParams the additional parameteres your applicationProfile needs to open the subject of this update e.g. id=12345&type=foo
* @param previewTitle the title to show in the preview
* @param previewDescription the description to show in the preview
* @param previewThumbnailUrl the image url to show in the preview
- * @return a feed instance ready to be written
+ * @return a post instance ready to be written
*/
- private Feed buildFeed(String description, String uriParams, String previewTitle, String previewDescription, String previewThumbnailUrl) {
+ private Post buildPost(String description, String uriParams, String previewTitle, String previewDescription, String previewThumbnailUrl) {
String descToAdd = escapeHtml(description);
String uri = applicationProfile.getUrl();
@@ -99,9 +99,9 @@ public class ApplicationNewsManager extends SocialPortalBridge implements NewsMa
if (uriParams != null && uriParams.compareTo("") != 0)
uri += "?"+uriParams;
String scope = currScope;
- Feed toReturn = new Feed(
+ Post toReturn = new Post(
UUID.randomUUID().toString(),
- FeedType.PUBLISH,
+ PostType.PUBLISH,
applicationProfile.getKey(),
new Date(),
scope,
diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java
index 3ad0f7e..fd04764 100644
--- a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java
+++ b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java
@@ -13,10 +13,10 @@ import org.gcube.applicationsupportlayer.social.shared.SocialFileItem;
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingSite;
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser;
import org.gcube.applicationsupportlayer.social.shared.SocialSharedFolder;
-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.RunningJob;
+import org.gcube.social_networking.socialnetworking.model.shared.Notification;
+import org.gcube.social_networking.socialnetworking.model.shared.NotificationChannelType;
+import org.gcube.social_networking.socialnetworking.model.shared.NotificationType;
+import org.gcube.social_networking.socialnetworking.model.shared.RunningJob;
import org.gcube.vomanagement.usermanagement.UserManager;
import org.gcube.vomanagement.usermanagement.exception.UserManagementPortalException;
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
@@ -82,8 +82,8 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
* Use this constructor if you do need notifications to point back to your applications,
* make sure you create your application profile on the infrastructure.
*
- * @see http://wiki.gcube-system.org/gcube/index.php/Social_Networking_Library#Create_Your_Application_Profile
- *
+ * @see ...
+ *
* @param scope the current scope
* @param currUser an instance of {@link SocialNetworkingUser} filled with the required user data
* @param site an instance of {@link SocialNetworkingSite} filled with the required data
@@ -99,8 +99,8 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
* Use this constructor if your artifact is not deployed on the portal and you do need notifications to point back to your applications,
* make sure you create your application profile on the infrastructure.
*
- * @see http://wiki.gcube-system.org/gcube/index.php/Social_Networking_Library#Create_Your_Application_Profile
- *
+ * @see ...
+ *
* @param userManager a remote implementation of {@link UserManager},see {@link LiferayWSUserManager}
* @param scope the current scope
* @param currUser an instance of {@link SocialNetworkingUser} filled with the required user data
@@ -114,7 +114,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
}
/**
* set the current portal context (name, emal, url)
- * @param request
+ * @param site
* @throws SystemException
* @throws PortalException
*/
@@ -142,13 +142,13 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
}
List channels = null;
try {
- channels = getStoreInstance().getUserNotificationChannels(notification2Save.getUserid(), notification2Save.getType());
+ channels = getStoreInstance().getUserNotificationChannelsLib(notification2Save.getUserid(), notification2Save.getType());
} catch (Exception e) {
e.printStackTrace();
}
boolean result = false;
if (channels.contains(NotificationChannelType.PORTAL)) {
- result = getStoreInstance().saveNotification(notification2Save);
+ result = getStoreInstance().saveNotificationLib(notification2Save);
if (result)
_log.trace("Notification Saved Successfully! ");
else
@@ -177,13 +177,13 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
}
List channels = null;
try {
- channels = getStoreInstance().getUserNotificationChannels(notification2Save.getUserid(), notification2Save.getType());
+ channels = getStoreInstance().getUserNotificationChannelsLib(notification2Save.getUserid(), notification2Save.getType());
} catch (Exception e) {
e.printStackTrace();
}
boolean result = false;
if (channels.contains(NotificationChannelType.PORTAL)) {
- result = getStoreInstance().saveNotification(notification2Save);
+ result = getStoreInstance().saveNotificationLib(notification2Save);
if (result)
_log.trace("Notification Saved Successfully! ");
else
@@ -215,7 +215,6 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
}
/**
* {@inheritDoc}
- * @throws InternalErrorException
*/
@Override
public boolean notifyFolderSharing(String userIdToNotify, SocialSharedFolder sharedFolder) {
@@ -305,7 +304,6 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
/**
* {@inheritDoc}
- * @throws InternalErrorException
*/
@Override
public boolean notifyFolderRenaming(String userIdToNotify, String previousName, String newName, String renamedFolderId) {
@@ -418,7 +416,6 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
}
/**
* {@inheritDoc}
- * @throws InternalErrorException
*/
@Override
public boolean notifyAddedItem(String userIdToNotify, SocialFileItem item, SocialSharedFolder sharedFolder) {
@@ -443,7 +440,6 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
}
/**
* {@inheritDoc}
- * @throws InternalErrorException
*/
@Override
public boolean notifyMovedItem(String userIdToNotify, SocialFileItem item, SocialSharedFolder sharedFolder) {
@@ -467,7 +463,6 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
}
/**
* {@inheritDoc}
- * @throws InternalErrorException
*/
@Override
public boolean notifyRemovedItem(String userIdToNotify, String itemName, SocialSharedFolder sharedFolder) {
@@ -491,7 +486,6 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
}
/**
* {@inheritDoc}
- * @throws InternalErrorException
*/
@Override
public boolean notifyUpdatedItem(String userIdToNotify, SocialFileItem item, SocialSharedFolder sharedFolder) {
@@ -515,7 +509,6 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
}
/**
* {@inheritDoc}
- * @throws InternalErrorException
*/
@Override
public boolean notifyItemRenaming(String userIdToNotify, String previousName, SocialFileItem renamedItem, SocialSharedFolder rootSharedFolder) {
@@ -647,13 +640,13 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
* {@inheritDoc}
*/
@Override
- public boolean notifyCommentReply(String userIdToNotify, String postId, String commentText, String feedOwnerFullName, String feedOwnerId, String commentKey) {
- String notificationText = (currUser.getUsername().compareTo(feedOwnerId) == 0) ?
+ public boolean notifyCommentReply(String userIdToNotify, String postId, String commentText, String postOwnerFullName, String postOwnerId, String commentKey) {
+ String notificationText = (currUser.getUsername().compareTo(postOwnerId) == 0) ?
"also commented on his post: "
+ "\""
+ commentText +"\"
"
:
- "also commented on " + feedOwnerFullName + "'s post: "
+ "also commented on " + postOwnerFullName + "'s post: "
+ "\""
+ commentText +"\"
";
Notification not = new Notification(
@@ -725,14 +718,6 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
* {@inheritDoc}
*/
@Override
- @Deprecated
- public boolean notifyLikedFeed(String userIdToNotify, String postId, String postText) {
- return notifyLikedPost(userIdToNotify, postId, postText);
- }
- /**
- * {@inheritDoc}
- */
- @Override
public boolean notifyLikedPost(String userIdToNotify, String postId, String postText) {
Notification not = new Notification(
diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/NewsManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/NewsManager.java
index a4071e6..b201795 100644
--- a/src/main/java/org/gcube/applicationsupportlayer/social/NewsManager.java
+++ b/src/main/java/org/gcube/applicationsupportlayer/social/NewsManager.java
@@ -2,7 +2,7 @@ package org.gcube.applicationsupportlayer.social;
import java.io.InputStream;
-import org.gcube.portal.databook.shared.ImageType;
+import org.gcube.social_networking.socialnetworking.model.shared.ImageType;
diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/NotificationsManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/NotificationsManager.java
index 8dea3aa..65daa2e 100644
--- a/src/main/java/org/gcube/applicationsupportlayer/social/NotificationsManager.java
+++ b/src/main/java/org/gcube/applicationsupportlayer/social/NotificationsManager.java
@@ -7,8 +7,8 @@ import java.util.Set;
import org.gcube.applicationsupportlayer.social.shared.SocialFileItem;
import org.gcube.applicationsupportlayer.social.shared.SocialSharedFolder;
-import org.gcube.portal.databook.shared.NotificationType;
-import org.gcube.portal.databook.shared.RunningJob;
+import org.gcube.social_networking.socialnetworking.model.shared.NotificationType;
+import org.gcube.social_networking.socialnetworking.model.shared.RunningJob;
import org.gcube.vomanagement.usermanagement.UserManager;
/**
*
@@ -70,7 +70,7 @@ public interface NotificationsManager {
* @param userIdToNotify the user you want to notify
* @param sharedFolder the shared {@link SocialSharedFolder} instance
* @param newAddedUserId the new user that was added
- * @param UserManager UserManager class instance
+ * @param um UserManager class instance
* @return true if the notification is correctly delivered, false otherwise
*/
boolean notifyFolderAddedUser(String userIdToNotify, SocialSharedFolder sharedFolder, String newAddedUserId, UserManager um) throws Exception;
@@ -84,7 +84,7 @@ public interface NotificationsManager {
* @param userIdToNotify the user you want to notify
* @param sharedFolder the shared {@link SocialSharedFolder} instance
* @param newAddedUserIds List of new users that were added
- * @param UserManager UserManager class instance
+ * @param um UserManager class instance
* @return true if the notification is correctly delivered, false otherwise
*/
boolean notifyFolderAddedUsers(String userIdToNotify, SocialSharedFolder sharedFolder, List newAddedUserIds, UserManager um) throws Exception;
@@ -99,7 +99,7 @@ public interface NotificationsManager {
/**
* use to notify a user he got a workspace item new in some of his workspace shared folder
* @param userIdToNotify the user you want to notify
- * @param newItem the new shared {@link SocialFileItem} instance
+ * @param item the new shared {@link SocialFileItem} instance
* @param sharedFolder the shared folder {@link SocialSharedFolder} instance
* @return true if the notification is correctly delivered, false otherwise
*/
@@ -107,7 +107,7 @@ public interface NotificationsManager {
/**
* use to notify a user he got a workspace item deleted from one of his workspace shared folder
* @param userIdToNotify the user you want to notify
- * @param removedItem the removed item instance of {@link SocialFileItem}
+ * @param item the removed item instance of {@link SocialFileItem}
* @param sharedFolder the shared folder {@link SocialSharedFolder}
* @return true if the notification is correctly delivered, false otherwise
*/
@@ -115,7 +115,7 @@ public interface NotificationsManager {
/**
* use to notify a user he got a workspace item deleted from one of his workspace shared folder
* @param userIdToNotify the user you want to notify
- * @param removedItem the removed name
+ * @param item the removed name
* @param sharedFolder the shared folder {@link SocialSharedFolder}
* @return true if the notification is correctly delivered, false otherwise
*/
@@ -123,7 +123,7 @@ public interface NotificationsManager {
/**
* use to notify a user he got a workspace item updated from one of his workspace shared folder
* @param userIdToNotify the user you want to notify
- * @param updatedItem the updated shared {@link SocialFileItem}
+ * @param item the updated shared {@link SocialFileItem}
* @param sharedFolder the shared folder {@link SocialSharedFolder}
* @return true if the notification is correctly delivered, false otherwise
*/
@@ -154,7 +154,7 @@ public interface NotificationsManager {
* @param userIdToNotify the user you want to notify
* @param itemId the item unique identifier
* @param notifyText the text of the notification
- * @param the resolver URL pointing to the item
+ * @param url resolver URL pointing to the item
* @return true if the notification is correctly delivered, false otherwise
*/
boolean notifyCatalogueEvent(NotificationType type, String userIdToNotify, String itemId, String notifyText, URL url) throws Exception;
@@ -242,22 +242,11 @@ public interface NotificationsManager {
*
* @param userIdToNotify the user you want to notify
* @param postid the liked postid
- * @param feedText the liked feed text or a portion of it
+ * @param commentText the liked post text or a portion of it
* @param commentKey when sending email, stop the shown discussion at that comment
* @return true if the notification is correctly delivered, false otherwise
*/
boolean notifyUserTag(String userIdToNotify, String postid, String commentText, String commentKey);
- /**
- * use to notify a user he got one of his post liked
- *
- * @param userIdToNotify the user you want to notify
- * @param postid the liked postid
- * @param postText the liked post text or a portion of it
- * @return true if the notification is correctly delivered, false otherwise
- * @deprecated use notifyLikedPost
- */
- @Deprecated
- boolean notifyLikedFeed(String userIdToNotify, String postid, String postText);
/**
* use to notify a user he got one of his post liked
*
diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/SocialPortalBridge.java b/src/main/java/org/gcube/applicationsupportlayer/social/SocialPortalBridge.java
index 492e5eb..a9d4084 100644
--- a/src/main/java/org/gcube/applicationsupportlayer/social/SocialPortalBridge.java
+++ b/src/main/java/org/gcube/applicationsupportlayer/social/SocialPortalBridge.java
@@ -13,9 +13,8 @@ import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser;
import org.gcube.common.resources.gcore.utils.XPathHelper;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.common.scope.impl.ScopeBean;
-import org.gcube.portal.databook.server.DBCassandraAstyanaxImpl;
-import org.gcube.portal.databook.server.DatabookStore;
-import org.gcube.portal.databook.shared.ApplicationProfile;
+import org.gcube.social_networking.social_networking_client_library.LibClient;
+import org.gcube.social_networking.socialnetworking.model.shared.ApplicationProfile;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.Query;
import org.gcube.resources.discovery.client.queries.impl.QueryBox;
@@ -38,7 +37,7 @@ public class SocialPortalBridge {
protected SocialNetworkingUser currUser;
protected ApplicationProfile applicationProfile;
//unique instance
- private static DatabookStore store;
+ private static LibClient libClient;
/**
*
* @param scope the current scope
@@ -67,11 +66,15 @@ public class SocialPortalBridge {
*
* @return the unique instance of the store
*/
- public static synchronized DatabookStore getStoreInstance() {
- if (store == null) {
- store = new DBCassandraAstyanaxImpl();
+ public static synchronized LibClient getStoreInstance() {
+ if (libClient == null) {
+ try {
+ libClient = new LibClient();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
- return store;
+ return libClient;
}
/**
* Escape an html string. Escaping data received from the client helps to
diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/mailing/EmailNotificationsConsumer.java b/src/main/java/org/gcube/applicationsupportlayer/social/mailing/EmailNotificationsConsumer.java
index 50c4313..f5fb343 100644
--- a/src/main/java/org/gcube/applicationsupportlayer/social/mailing/EmailNotificationsConsumer.java
+++ b/src/main/java/org/gcube/applicationsupportlayer/social/mailing/EmailNotificationsConsumer.java
@@ -77,7 +77,7 @@ public class EmailNotificationsConsumer extends Thread {
}
/**
*
- * @param context
+ * @param infraContext
* @return the
* @throws Exception
*/
diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/mailing/EmailPlugin.java b/src/main/java/org/gcube/applicationsupportlayer/social/mailing/EmailPlugin.java
index b7ec9d3..47d3b73 100644
--- a/src/main/java/org/gcube/applicationsupportlayer/social/mailing/EmailPlugin.java
+++ b/src/main/java/org/gcube/applicationsupportlayer/social/mailing/EmailPlugin.java
@@ -3,7 +3,7 @@ package org.gcube.applicationsupportlayer.social.mailing;
import java.util.ArrayList;
import java.util.Set;
-import org.gcube.portal.databook.shared.Notification;
+import org.gcube.social_networking.socialnetworking.model.shared.Notification;
import org.gcube.vomanagement.usermanagement.UserManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/mailing/NotificationMail.java b/src/main/java/org/gcube/applicationsupportlayer/social/mailing/NotificationMail.java
index 7d18183..67fad65 100644
--- a/src/main/java/org/gcube/applicationsupportlayer/social/mailing/NotificationMail.java
+++ b/src/main/java/org/gcube/applicationsupportlayer/social/mailing/NotificationMail.java
@@ -13,12 +13,11 @@ import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
-import org.gcube.portal.databook.server.DBCassandraAstyanaxImpl;
-import org.gcube.portal.databook.server.DatabookStore;
-import org.gcube.portal.databook.shared.Comment;
-import org.gcube.portal.databook.shared.Feed;
-import org.gcube.portal.databook.shared.Notification;
-import org.gcube.portal.databook.shared.NotificationType;
+import org.gcube.social_networking.social_networking_client_library.LibClient;
+import org.gcube.social_networking.socialnetworking.model.shared.Comment;
+import org.gcube.social_networking.socialnetworking.model.shared.Post;
+import org.gcube.social_networking.socialnetworking.model.shared.Notification;
+import org.gcube.social_networking.socialnetworking.model.shared.NotificationType;
import org.gcube.vomanagement.usermanagement.UserManager;
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
import org.slf4j.Logger;
@@ -40,7 +39,17 @@ public class NotificationMail {
private String siteLandingPagePath;
private String[] hashtags;
private Set mentionedVReGroups;
- private static DatabookStore store = new DBCassandraAstyanaxImpl();
+
+ private static LibClient libClient;
+
+ static {
+ try {
+ libClient = new LibClient();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ //private static DatabookStore store = new DBCassandraAstyanaxImpl();
public NotificationMail(UserManager userManager, String portalURL, String siteLandingPagePath, Notification notification2Send, String vreName, String portalName, String senderEmail, Set mentionedVReGroups, String ... hashtags) {
super();
@@ -102,19 +111,19 @@ public class NotificationMail {
msg2Return.addRecipient(Message.RecipientType.TO, new InternetAddress(email));
// retrieve post/comments from its id (if possible)
- Feed post = null;
+ Post post = null;
List comments = null;
String commentKey = null;
- String vreNameFromFeed = null;
+ String vreNameFromPost = null;
if (notification2Send.getType() == NotificationType.COMMENT ||
notification2Send.getType() == NotificationType.OWN_COMMENT ||
notification2Send.getType() == NotificationType.LIKE ||
notification2Send.getType() == NotificationType.MENTION) {
try{
- String feedId = notification2Send.getSubjectid();
- post = store.readFeed(feedId);
- comments = store.getAllCommentByFeed(feedId);
+ String postId = notification2Send.getSubjectid();
+ post = libClient.readPostLib(postId);
+ comments = libClient.getAllCommentsByPostIdLib(postId);
Collections.sort(comments); // sort them
commentKey = notification2Send.getCommentKey();
@@ -123,23 +132,23 @@ public class NotificationMail {
if(vreName == null)
vreName = splittedVREName[splittedVREName.length - 1];
- // if the notification is a comment, extract the vre name from the feed and not from the scope
+ // if the notification is a comment, extract the vre name from the post and not from the scope
if(notification2Send.getType().equals(NotificationType.COMMENT) ||
notification2Send.getType().equals(NotificationType.OWN_COMMENT) ||
notification2Send.getType().equals(NotificationType.LIKE) ||
notification2Send.getType().equals(NotificationType.MENTION)
)
- vreNameFromFeed = splittedVREName[splittedVREName.length - 1];
+ vreNameFromPost = splittedVREName[splittedVREName.length - 1];
} catch(Exception e){
_log.error("Unable to retrieve posts/comments", e);
}
}
- String vreNameToUse = (vreNameFromFeed == null) ? vreName : vreNameFromFeed;
+ String vreNameToUse = (vreNameFromPost == null) ? vreName : vreNameFromPost;
_log.debug("VRE Name for the email's subject is going to be "
- + vreNameToUse + "[vreNameFromFeed is " + vreNameFromFeed + ", vreName is " + vreName + "]");
+ + vreNameToUse + "[vreNameFromPost is " + vreNameFromPost + ", vreName is " + vreName + "]");
try{
// set subject
msg2Return.setSubject(SocialMailingUtil.getSubjectByNotificationType(notification2Send, vreNameToUse, user.getFirstName(), mentionedVReGroups, hashtags));
diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/mailing/SocialMailingUtil.java b/src/main/java/org/gcube/applicationsupportlayer/social/mailing/SocialMailingUtil.java
index 27267f8..c0c4f11 100644
--- a/src/main/java/org/gcube/applicationsupportlayer/social/mailing/SocialMailingUtil.java
+++ b/src/main/java/org/gcube/applicationsupportlayer/social/mailing/SocialMailingUtil.java
@@ -10,10 +10,10 @@ import java.util.Set;
import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager;
import org.gcube.common.portal.GCubePortalConstants;
-import org.gcube.portal.databook.shared.Comment;
-import org.gcube.portal.databook.shared.Feed;
-import org.gcube.portal.databook.shared.Notification;
-import org.gcube.portal.databook.shared.NotificationType;
+import org.gcube.social_networking.socialnetworking.model.shared.Comment;
+import org.gcube.social_networking.socialnetworking.model.shared.Post;
+import org.gcube.social_networking.socialnetworking.model.shared.Notification;
+import org.gcube.social_networking.socialnetworking.model.shared.NotificationType;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
@@ -39,7 +39,7 @@ public class SocialMailingUtil {
* @param siteLandingPagePath
* @param email
* @param vreName
- * @param feed
+ * @param post
* @param comments
* @param commentKey
* @param hashtags
@@ -50,13 +50,13 @@ public class SocialMailingUtil {
String portalURL,
String siteLandingPagePath,
String email,
- Feed feed,
+ Post post,
List comments,
String commentKey,
String ... hashtags) {
String removedMarkup = notification2Save.getDescription().replaceAll("&", "&");
- //notification2Save uri contains the absoulte path to the feed in the correct channel, e.g. /group/ustore_vre?oid=f1637958-34d0-48fc-b5ad-13b1116e389d
+ //notification2Save uri contains the absoulte path to the post in the correct channel, e.g. /group/ustore_vre?oid=f1637958-34d0-48fc-b5ad-13b1116e389d
String pathToVRE = siteLandingPagePath + "?";
if (notification2Save.getUri() != null) {
if (notification2Save.getUri().split("\\?").length > 0) {
@@ -96,7 +96,7 @@ public class SocialMailingUtil {
.append("").append(sender).append(" ").append(removedMarkup) // has done something
.append(getActionLink(notification2Save, portalURL)) //Goto
.append(attachmentsNotice)
- .append(SocialMailingUtil.buildHtmlDiscussion(portalURL, pathToVRE, notification2Save, feed, comments, commentKey)) // the original discussion
+ .append(SocialMailingUtil.buildHtmlDiscussion(portalURL, pathToVRE, notification2Save, post, comments, commentKey)) // the original discussion
.append("
")
.append("
")
.append("")
@@ -126,7 +126,7 @@ public class SocialMailingUtil {
* @param portalURL
* @param siteLandingPagePath
* @param email
- * @param feed
+ * @param post
* @param comments
* @param commentKey
* @param hashtags
@@ -138,7 +138,7 @@ public class SocialMailingUtil {
String portalURL,
String siteLandingPagePath,
String email,
- Feed feed,
+ Post post,
List comments,
String commentKey,
String[] hashtags) {
@@ -177,7 +177,7 @@ public class SocialMailingUtil {
.append("\n").append(sender).append(" ").append(removedMarkup) // has done something
.append("\nsee: ").append(portalURL).append(notification2Save.getUri())
.append(attachmentsNotice)
- .append(SocialMailingUtil.buildPlainTextDiscussion(notification2Save, feed, comments, commentKey))
+ .append(SocialMailingUtil.buildPlainTextDiscussion(notification2Save, post, comments, commentKey))
.append("\n----\n")
.append("This message was sent to ")
.append(email)
@@ -196,7 +196,6 @@ public class SocialMailingUtil {
/**
* construct the subjec of the email
* @param notification2Save
- * @param portalURL
* @param vreName
* @return
*/
@@ -411,14 +410,14 @@ public class SocialMailingUtil {
}
/**
- * Build up a discussion given the feed and its comments.
+ * Build up a discussion given the post and its comments.
* @param notification2Save
* @param post
* @param comments
* @param commentKey if not null, when building the discussion stop at this comment.
* @return an html string representing the discussion
*/
- protected static String buildHtmlDiscussion(String portalURL, String pathToVRE, Notification notification2Save, Feed post, List comments, String commentKey){
+ protected static String buildHtmlDiscussion(String portalURL, String pathToVRE, Notification notification2Save, Post post, List comments, String commentKey){
try{
@@ -501,13 +500,13 @@ public class SocialMailingUtil {
}
/**
- * Build a plain text discussion given a feed and its comments.
- * @param feed
+ * Build a plain text discussion given a post and its comments.
+ * @param post
* @param comments
* @param commentKey if not null, when building the discussion stop at this comment.
* @return a string representing the discussion
*/
- protected static String buildPlainTextDiscussion(Notification notification2Save, Feed feed, List comments, String commentKey){
+ protected static String buildPlainTextDiscussion(Notification notification2Save, Post post, List comments, String commentKey){
try{
@@ -523,15 +522,15 @@ public class SocialMailingUtil {
Format formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm a");
// escape html
- String feedTextNoHtml = convertHTML2Text(feed.getDescription());
+ String postTextNoHtml = convertHTML2Text(post.getDescription());
// build up post + comments
discussion +=
"\n"
- + "[" + formatter.format(feed.getTime()) + "] "
- + feed.getFullName()
+ + "[" + formatter.format(post.getTime()) + "] "
+ + post.getFullName()
+ ": "
- + (feedTextNoHtml.length() > 200 ? feedTextNoHtml.substring(0, 200) + " ..." : feedTextNoHtml)
+ + (postTextNoHtml.length() > 200 ? postTextNoHtml.substring(0, 200) + " ..." : postTextNoHtml)
+ "\n";
diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/storage/FTPManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/storage/FTPManager.java
index 63a0c04..3a0988f 100644
--- a/src/main/java/org/gcube/applicationsupportlayer/social/storage/FTPManager.java
+++ b/src/main/java/org/gcube/applicationsupportlayer/social/storage/FTPManager.java
@@ -18,7 +18,7 @@ import org.gcube.common.encryption.StringEncrypter;
import org.gcube.common.resources.gcore.ServiceEndpoint;
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
import org.gcube.common.scope.api.ScopeProvider;
-import org.gcube.portal.databook.shared.ImageType;
+import org.gcube.social_networking.socialnetworking.model.shared.ImageType;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
import org.slf4j.Logger;
diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/storage/UrlEncoderUtil.java b/src/main/java/org/gcube/applicationsupportlayer/social/storage/UrlEncoderUtil.java
index 8add745..0e21a28 100644
--- a/src/main/java/org/gcube/applicationsupportlayer/social/storage/UrlEncoderUtil.java
+++ b/src/main/java/org/gcube/applicationsupportlayer/social/storage/UrlEncoderUtil.java
@@ -22,7 +22,6 @@ public class UrlEncoderUtil {
public static Logger logger = Logger.getLogger(UrlEncoderUtil.class);
/**
*
- * @param url
* @param parameters
* @return
*/
@@ -46,7 +45,6 @@ public class UrlEncoderUtil {
/**
*
- * @param url
* @param parameters
* @return
*/