diff --git a/CHANGELOG.md b/CHANGELOG.md index d6848c9..3b9c88a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Added support for Catalogue notifications - Removed support for Tabular Data and Calendar Notifications + - Removed Social Networking Library Dependency #26526 ## [v2.5.0] - 2018-01-12 diff --git a/pom.xml b/pom.xml index dcabd07..0b8aefe 100644 --- a/pom.xml +++ b/pom.xml @@ -70,10 +70,16 @@ [1.1.0-SNAPSHOT, 2.0.0-SNAPSHOT) compile + - org.gcube.portal - social-networking-library - provided + org.gcube.social-networking + social-service-model + [1.2.0-SNAPSHOT, 2.0.0] + + + org.gcube.social-networking + social-service-client + [2.0.0-SNAPSHOT, 3.0.0] org.gcube.common.portal diff --git a/src/main/java/org/gcube/portlets/user/notifications/client/NotificationsService.java b/src/main/java/org/gcube/portlets/user/notifications/client/NotificationsService.java index 88149eb..ea1ea5f 100644 --- a/src/main/java/org/gcube/portlets/user/notifications/client/NotificationsService.java +++ b/src/main/java/org/gcube/portlets/user/notifications/client/NotificationsService.java @@ -6,10 +6,10 @@ import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; -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.UserInfo; +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.UserInfo; import org.gcube.portlets.user.notifications.shared.NotificationPreference; import com.google.gwt.user.client.rpc.RemoteService; diff --git a/src/main/java/org/gcube/portlets/user/notifications/client/NotificationsServiceAsync.java b/src/main/java/org/gcube/portlets/user/notifications/client/NotificationsServiceAsync.java index a964503..87f4e7e 100644 --- a/src/main/java/org/gcube/portlets/user/notifications/client/NotificationsServiceAsync.java +++ b/src/main/java/org/gcube/portlets/user/notifications/client/NotificationsServiceAsync.java @@ -6,10 +6,10 @@ import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; -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.UserInfo; +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.UserInfo; import org.gcube.portlets.user.notifications.shared.NotificationPreference; import com.google.gwt.user.client.rpc.AsyncCallback; diff --git a/src/main/java/org/gcube/portlets/user/notifications/client/view/NotificationSettingsDialog.java b/src/main/java/org/gcube/portlets/user/notifications/client/view/NotificationSettingsDialog.java index b0f9492..1986870 100644 --- a/src/main/java/org/gcube/portlets/user/notifications/client/view/NotificationSettingsDialog.java +++ b/src/main/java/org/gcube/portlets/user/notifications/client/view/NotificationSettingsDialog.java @@ -4,8 +4,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; -import org.gcube.portal.databook.shared.NotificationChannelType; -import org.gcube.portal.databook.shared.NotificationType; +import org.gcube.social_networking.socialnetworking.model.shared.NotificationChannelType; +import org.gcube.social_networking.socialnetworking.model.shared.NotificationType; import org.gcube.portlets.user.notifications.client.NotificationsServiceAsync; import org.gcube.portlets.user.notifications.client.view.templates.CategoryWrapper; import org.gcube.portlets.user.notifications.shared.NotificationPreference; diff --git a/src/main/java/org/gcube/portlets/user/notifications/client/view/NotificationsPanel.java b/src/main/java/org/gcube/portlets/user/notifications/client/view/NotificationsPanel.java index b11fa61..02eb17d 100644 --- a/src/main/java/org/gcube/portlets/user/notifications/client/view/NotificationsPanel.java +++ b/src/main/java/org/gcube/portlets/user/notifications/client/view/NotificationsPanel.java @@ -6,8 +6,8 @@ import java.util.Date; import java.util.HashMap; import java.util.LinkedHashMap; -import org.gcube.portal.databook.shared.Notification; -import org.gcube.portal.databook.shared.UserInfo; +import org.gcube.social_networking.socialnetworking.model.shared.Notification; +import org.gcube.social_networking.socialnetworking.model.shared.UserInfo; import org.gcube.portlets.user.notifications.client.NotificationsService; import org.gcube.portlets.user.notifications.client.NotificationsServiceAsync; import org.gcube.portlets.user.notifications.client.view.templates.DayWrapper; diff --git a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/CategoryWrapper.java b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/CategoryWrapper.java index 12e3174..dbe9b73 100644 --- a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/CategoryWrapper.java +++ b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/CategoryWrapper.java @@ -5,8 +5,8 @@ import static com.google.gwt.query.client.GQuery.$; import java.util.ArrayList; import java.util.HashMap; -import org.gcube.portal.databook.shared.NotificationChannelType; -import org.gcube.portal.databook.shared.NotificationType; +import org.gcube.social_networking.socialnetworking.model.shared.NotificationChannelType; +import org.gcube.social_networking.socialnetworking.model.shared.NotificationType; import org.gcube.portlets.user.gcubewidgets.client.elements.Span; import org.gcube.portlets.user.notifications.shared.NotificationPreference; import org.gcube.portlets.widgets.switchbutton.client.SwitchButton; diff --git a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/NotificationPreferenceView.java b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/NotificationPreferenceView.java index 7f9e0c1..7e0149a 100644 --- a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/NotificationPreferenceView.java +++ b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/NotificationPreferenceView.java @@ -4,8 +4,8 @@ import static com.google.gwt.query.client.GQuery.$; import java.util.ArrayList; -import org.gcube.portal.databook.shared.NotificationChannelType; -import org.gcube.portal.databook.shared.NotificationType; +import org.gcube.social_networking.socialnetworking.model.shared.NotificationChannelType; +import org.gcube.social_networking.socialnetworking.model.shared.NotificationType; import org.gcube.portlets.user.notifications.shared.NotificationPreference; import org.gcube.portlets.widgets.switchbutton.client.SwitchButton; diff --git a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/SingleNotificationView.java b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/SingleNotificationView.java index 1ec5a0f..c5d98a2 100644 --- a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/SingleNotificationView.java +++ b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/SingleNotificationView.java @@ -1,10 +1,10 @@ package org.gcube.portlets.user.notifications.client.view.templates; import org.gcube.common.portal.GCubePortalConstants; -import org.gcube.portal.databook.client.GCubeSocialNetworking; -import org.gcube.portal.databook.client.util.Encoder; -import org.gcube.portal.databook.shared.Notification; -import org.gcube.portal.databook.shared.NotificationType; +import org.gcube.social_networking.socialnetworking.model.client.GCubeSocialNetworking; +import org.gcube.social_networking.socialnetworking.model.client.util.Encoder; +import org.gcube.social_networking.socialnetworking.model.shared.Notification; +import org.gcube.social_networking.socialnetworking.model.shared.NotificationType; import org.gcube.portlets.user.gcubewidgets.client.elements.Span; import com.github.gwtbootstrap.client.ui.Column; diff --git a/src/main/java/org/gcube/portlets/user/notifications/server/NotificationsServiceImpl.java b/src/main/java/org/gcube/portlets/user/notifications/server/NotificationsServiceImpl.java index 7c717db..573f61a 100644 --- a/src/main/java/org/gcube/portlets/user/notifications/server/NotificationsServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/notifications/server/NotificationsServiceImpl.java @@ -16,12 +16,11 @@ import java.util.TreeMap; import javax.servlet.ServletContext; import org.gcube.common.portal.PortalContext; -import org.gcube.portal.databook.server.DBCassandraAstyanaxImpl; -import org.gcube.portal.databook.server.DatabookStore; -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.UserInfo; +import org.gcube.social_networking.social_networking_client_library.LibClient; +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.UserInfo; import org.gcube.portlets.user.notifications.client.NotificationsService; import org.gcube.portlets.user.notifications.shared.NotificationConstants; import org.gcube.portlets.user.notifications.shared.NotificationPreference; @@ -47,17 +46,21 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No /** * The store interface */ - private DatabookStore store; + private LibClient libClient; /** * connect to cassandra at startup */ public void init() { - store = new DBCassandraAstyanaxImpl(); + try { + libClient = new LibClient(); + } catch (Exception e) { + throw new RuntimeException(e); + } } - public void destroy() { + /*public void destroy() { store.closeConnection(); - } + }*/ public UserInfo getUserInfo() { try { @@ -81,7 +84,7 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No public HashMap> getUserNotifications() { HashMap> toReturn = new HashMap>(); try { - for (Notification notification : store.getAllNotificationByUser(context.getCurrentUser(getThreadLocalRequest()).getUsername(), NotificationConstants.NOTIFICATION_NUMBER_PRE)) { + for (Notification notification : libClient.getAllNotificationByUserLib(context.getCurrentUser(getThreadLocalRequest()).getUsername(), NotificationConstants.NOTIFICATION_NUMBER_PRE)) { Date dateWithoutTime = removeTimePart(notification.getTime()); notification.setDescription(replaceAmpersand(notification.getDescription())); if (! toReturn.containsKey(dateWithoutTime)) { @@ -106,7 +109,7 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No public HashMap> getUserNotificationsByRange(int from, int quantity) { HashMap> toReturn = new HashMap>(); try { - for (Notification notification : store.getRangeNotificationsByUser(context.getCurrentUser(getThreadLocalRequest()).getUsername(), from, quantity)) { + for (Notification notification : libClient.getRangeNotificationsByUserLib(context.getCurrentUser(getThreadLocalRequest()).getUsername(), from, quantity)) { Date dateWithoutTime = removeTimePart(notification.getTime()); if (! toReturn.containsKey(dateWithoutTime)) { ArrayList nots = new ArrayList(); @@ -146,7 +149,7 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No */ public boolean setAllUserNotificationsRead() { try { - store.setAllNotificationReadByUser(context.getCurrentUser(getThreadLocalRequest()).getUsername()); + libClient.setAllNotificationReadByUserLib(context.getCurrentUser(getThreadLocalRequest()).getUsername()); } catch (Exception e) { _log.error("While trying to set User notifications Read"); e.printStackTrace(); @@ -165,7 +168,7 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No TreeMap> treeMap = new TreeMap>(); try { - Map storePreferences = store.getUserNotificationPreferences(userid); + Map storePreferences = libClient.getUserNotificationPreferencesLib(userid); for (NotificationType type : storePreferences.keySet()) { String category = categories.getProperty(type.toString()); @@ -205,7 +208,7 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No @Override public boolean setUserNotificationPreferences(Map enabledChannels) { - return store.setUserNotificationPreferences(context.getCurrentUser(getThreadLocalRequest()).getUsername(), enabledChannels); + return libClient.setUserNotificationPreferencesLib(context.getCurrentUser(getThreadLocalRequest()).getUsername(), enabledChannels); } /** * diff --git a/src/main/java/org/gcube/portlets/user/notifications/shared/NotificationPreference.java b/src/main/java/org/gcube/portlets/user/notifications/shared/NotificationPreference.java index 7252a42..7efe2e1 100644 --- a/src/main/java/org/gcube/portlets/user/notifications/shared/NotificationPreference.java +++ b/src/main/java/org/gcube/portlets/user/notifications/shared/NotificationPreference.java @@ -3,8 +3,8 @@ package org.gcube.portlets.user.notifications.shared; import java.io.Serializable; import java.util.Arrays; -import org.gcube.portal.databook.shared.NotificationChannelType; -import org.gcube.portal.databook.shared.NotificationType; +import org.gcube.social_networking.socialnetworking.model.shared.NotificationChannelType; +import org.gcube.social_networking.socialnetworking.model.shared.NotificationType; /** * @author Massimiliano Assante, CNR-ISTI * This class represent a notification preference with its type (allowing associating a label and a description) diff --git a/src/main/resources/org/gcube/portlets/user/notifications/Notifications.gwt.xml b/src/main/resources/org/gcube/portlets/user/notifications/Notifications.gwt.xml index 7fbae02..e4cb2a0 100644 --- a/src/main/resources/org/gcube/portlets/user/notifications/Notifications.gwt.xml +++ b/src/main/resources/org/gcube/portlets/user/notifications/Notifications.gwt.xml @@ -11,7 +11,7 @@ - +