Compatible with social model 2.0.0
This commit is contained in:
parent
83c6712d45
commit
90b1bc1fe9
|
@ -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
|
||||
|
||||
|
|
12
pom.xml
12
pom.xml
|
@ -70,10 +70,16 @@
|
|||
<version>[1.1.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- should be provided -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
<artifactId>social-networking-library</artifactId>
|
||||
<scope>provided</scope>
|
||||
<groupId>org.gcube.social-networking</groupId>
|
||||
<artifactId>social-service-model</artifactId>
|
||||
<version>[1.2.0-SNAPSHOT, 2.0.0]</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.social-networking</groupId>
|
||||
<artifactId>social-service-client</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0]</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common.portal</groupId>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<Date, ArrayList<Notification>> getUserNotifications() {
|
||||
HashMap<Date, ArrayList<Notification>> toReturn = new HashMap<Date, ArrayList<Notification>>();
|
||||
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<Date, ArrayList<Notification>> getUserNotificationsByRange(int from, int quantity) {
|
||||
HashMap<Date, ArrayList<Notification>> toReturn = new HashMap<Date, ArrayList<Notification>>();
|
||||
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<Notification> nots = new ArrayList<Notification>();
|
||||
|
@ -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<String, ArrayList<NotificationPreference>> treeMap = new TreeMap<String, ArrayList<NotificationPreference>>();
|
||||
|
||||
try {
|
||||
Map<NotificationType, NotificationChannelType[]> storePreferences = store.getUserNotificationPreferences(userid);
|
||||
Map<NotificationType, NotificationChannelType[]> 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<NotificationType, NotificationChannelType[]> enabledChannels) {
|
||||
return store.setUserNotificationPreferences(context.getCurrentUser(getThreadLocalRequest()).getUsername(), enabledChannels);
|
||||
return libClient.setUserNotificationPreferencesLib(context.getCurrentUser(getThreadLocalRequest()).getUsername(), enabledChannels);
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||
<inherits name="com.github.gwtbootstrap.Bootstrap" />
|
||||
<inherits name='org.gcube.portlets.widgets.switchbutton.SwitchButton' />
|
||||
<inherits name='org.gcube.portal.databook.GCubeSocialNetworking' />
|
||||
<inherits name='org.gcube.social_networking.socialnetworking.model.GCubeSocialNetworking' />
|
||||
<!-- Specify the app entry point class. -->
|
||||
<entry-point
|
||||
class='org.gcube.portlets.user.notifications.client.Notifications' />
|
||||
|
|
Loading…
Reference in New Issue