From 59424dc2ab9fd072b51d01c9e101f22eb62f5654 Mon Sep 17 00:00:00 2001 From: Costantino Perciante Date: Mon, 4 Apr 2016 10:46:24 +0000 Subject: [PATCH] Changed methods to handle unread notifications/messages column families git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/social-networking-library@126718 82a268e6-3cf1-43bd-a215-b396298e98cf --- META-INF/KeySpace Structure.xlsx | Bin 15550 -> 10741 bytes .../server/CassandraClusterConnection.java | 8 +- .../server/DBCassandraAstyanaxImpl.java | 159 ++++++++++++------ 3 files changed, 113 insertions(+), 54 deletions(-) diff --git a/META-INF/KeySpace Structure.xlsx b/META-INF/KeySpace Structure.xlsx index 219ee57e6b9c52fb90d13c780922ccb0eadb4993..649ddf1f6d522a769fb3c51bd3654557644eb73a 100644 GIT binary patch literal 10741 zcmaL719+WF+cq3EXl&cI8r!yQHMY~Jv6D7VW83y>Y^Skpe#zd?|FrLZ|94+&9cyNe zdw5g+ zk1A|j(-u1ZP2Afr<>!k5dnyB_v$tm;q-N0%h-e9)%Mo^=v=t=N>+tVl;i7iMn$!_d zPZ*xLnQ*s<*lkv7BgCVsk|gj(!^P9R)>i~^w!qcc4D;Fw-RioZHuQhsG=&(i7<&fU z=;(pI8t>hN7Tv6xuRcbqhTH}vR~8+LhPZC&f{1cXY^deL(B4vr(lfUr%8dytsbpcv zwpi1<-h0YIQp{>qt%usDH!9aeq;xoQH-$K)^C9mBmA^Q0HbRO;ueaIw#1@ z`GDl5ARtYP0~*%fmdynM^j7}AfI)bxVQgn4?_l@Yk>23*XF4|<>+~@JsW)^!thaO! zZLOLf3*;FqeVoN(&csafG?LS`~rc=03-xIQ{R4~}-fsZ1&@ALl@fda&m*|A0Y3 z)*A8P?Xkjb)wjX;APt$@4tyBsS!owZ#UjyJ3_X~uD}1nu0SApTwxnxhXKL9e6@6@I zo}uK2{xS1|{7+kq446_73_{xj`a<8{XO)+)q94~@&j*}JRvcZ3&fO(HEbEW(%o~+) zexUbmRi}tlcQ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e7QANv8R$=wDZx{}grkV5NSt2Eh1*!`#UKVm9C0{jCmziS|2fu=qJ?*hl~v;PMPuHV!E diff --git a/src/main/java/org/gcube/portal/databook/server/CassandraClusterConnection.java b/src/main/java/org/gcube/portal/databook/server/CassandraClusterConnection.java index 8fba175..31d1654 100644 --- a/src/main/java/org/gcube/portal/databook/server/CassandraClusterConnection.java +++ b/src/main/java/org/gcube/portal/databook/server/CassandraClusterConnection.java @@ -111,14 +111,14 @@ public class CassandraClusterConnection { // The Keyspace instance can be shared among different requests if(myKeyspace == null){ synchronized(this){ - if(myKeyspace == null){ // double check lock + if(myKeyspace == null){ // double checked lock AstyanaxContext context = new AstyanaxContext.Builder() .forCluster(clusterName) .forKeyspace(keyspaceName) .withAstyanaxConfiguration( new AstyanaxConfigurationImpl() .setDiscoveryType(NodeDiscoveryType.NONE) // use only the host given as seeds (do not discover) - .setConnectionPoolType(ConnectionPoolType.ROUND_ROBIN) // how handle connections of the the connection pool + .setConnectionPoolType(ConnectionPoolType.ROUND_ROBIN) // how to handle connections of the the connection pool ) .withConnectionPoolConfiguration( new ConnectionPoolConfigurationImpl("MyConnectionPool") @@ -239,7 +239,9 @@ public class CassandraClusterConnection { ColumnFamilyDefinition cfDefUserTimeline = getDynamicCFDef(DBCassandraAstyanaxImpl.USER_TIMELINE_FEEDS); ColumnFamilyDefinition cfDefUserLikedFeeds = getDynamicCFDef(DBCassandraAstyanaxImpl.USER_LIKED_FEEDS); ColumnFamilyDefinition cfDefUserNotifications = getDynamicCFDef(DBCassandraAstyanaxImpl.USER_NOTIFICATIONS); + ColumnFamilyDefinition cfDefUserNotificationsUnread = getDynamicCFDef(DBCassandraAstyanaxImpl.USER_NOTIFICATIONS_UNREAD); ColumnFamilyDefinition cfDefUserMessagesNotifications = getDynamicCFDef(DBCassandraAstyanaxImpl.USER_MESSAGES_NOTIFICATIONS); + ColumnFamilyDefinition cfDefUserMessagesNotificationsUnread = getDynamicCFDef(DBCassandraAstyanaxImpl.USER_MESSAGES_NOTIFICATIONS_UNREAD); ColumnFamilyDefinition cfDefUserNotificationsPreferences = getDynamicCFDef(DBCassandraAstyanaxImpl.USER_NOTIFICATIONS_PREFERENCES); ColumnFamilyDefinition cfDefHashtagsCounter = getDynamicCFDef(DBCassandraAstyanaxImpl.HASHTAGS_COUNTER); ColumnFamilyDefinition cfDefHashtagTimeline = getDynamicCFDef(DBCassandraAstyanaxImpl.HASHTAGGED_FEEDS); @@ -260,7 +262,9 @@ public class CassandraClusterConnection { .addColumnFamily(cfDefAPPTimeline) .addColumnFamily(cfDefUserTimeline) .addColumnFamily(cfDefUserNotifications) + .addColumnFamily(cfDefUserNotificationsUnread) .addColumnFamily(cfDefUserMessagesNotifications) + .addColumnFamily(cfDefUserMessagesNotificationsUnread) .addColumnFamily(cfDefUserNotificationsPreferences) .addColumnFamily(cfDefUserLikedFeeds) .addColumnFamily(cfDefHashtagsCounter) diff --git a/src/main/java/org/gcube/portal/databook/server/DBCassandraAstyanaxImpl.java b/src/main/java/org/gcube/portal/databook/server/DBCassandraAstyanaxImpl.java index 169518d..069d1ce 100644 --- a/src/main/java/org/gcube/portal/databook/server/DBCassandraAstyanaxImpl.java +++ b/src/main/java/org/gcube/portal/databook/server/DBCassandraAstyanaxImpl.java @@ -78,8 +78,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore { public static final String USER_TIMELINE_FEEDS = "USERTimeline"; public static final String APP_TIMELINE_FEEDS = "AppTimeline"; public static final String USER_LIKED_FEEDS = "USERLikes"; - public static final String USER_NOTIFICATIONS = "USERNotifications"; // regular user notifications timeline + public static final String USER_NOTIFICATIONS = "USERNotifications"; // regular user notifications timeline (both read and unread) + public static final String USER_NOTIFICATIONS_UNREAD = "USERNotificationsUnread"; // only unread user notifications public static final String USER_MESSAGES_NOTIFICATIONS = "USERMessagesNotifications"; // user messages notifications timeline + public static final String USER_MESSAGES_NOTIFICATIONS_UNREAD = "USERMessagesNotificationsUnread"; // only unread user notification messages public static final String USER_NOTIFICATIONS_PREFERENCES = "USERNotificationsPreferences"; // preferences for notifications public static final String HASHTAGS_COUNTER = "HashtagsCounter"; // count the hashtags per group and type public static final String HASHTAGGED_FEEDS = "HashtaggedFeeds"; // contains hashtags per type associated with vre and feed @@ -140,10 +142,18 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore { USER_NOTIFICATIONS, // Column Family Name StringSerializer.get(), // Key Serializer StringSerializer.get()); // Column Serializer + private static ColumnFamily cf_UserNotificationsUnread = new ColumnFamily( + USER_NOTIFICATIONS_UNREAD, // Column Family Name + StringSerializer.get(), // Key Serializer + StringSerializer.get()); // Column Serializer private static ColumnFamily cf_UserMessageNotifications = new ColumnFamily( USER_MESSAGES_NOTIFICATIONS, // Column Family Name StringSerializer.get(), // Key Serializer StringSerializer.get()); // Column Serializer + private static ColumnFamily cf_UserMessageNotificationsUnread = new ColumnFamily( + USER_MESSAGES_NOTIFICATIONS_UNREAD, // Column Family Name + StringSerializer.get(), // Key Serializer + StringSerializer.get()); // Column Serializer protected static ColumnFamily cf_UserNotificationsPreferences = new ColumnFamily( USER_NOTIFICATIONS_PREFERENCES, // Column Family Name StringSerializer.get(), // Key Serializer @@ -192,14 +202,14 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore { public DBCassandraAstyanaxImpl() { conn = new CassandraClusterConnection(false); } - + /** * public constructor, no dropping schema is allowed, infrastructureName is given. */ public DBCassandraAstyanaxImpl(String infrastructureName) { conn = new CassandraClusterConnection(false, infrastructureName); } - + /** * execute the mutation batch * @param m @@ -891,13 +901,21 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore { .putColumn("SenderFullName", n.getSenderFullName(), null) .putColumn("SenderThumbnail", n.getSenderThumbnail(), null); - if (n.getType() != NotificationType.MESSAGE) + if (n.getType() != NotificationType.MESSAGE){ //an entry in the user Notifications Timeline m.withRow(cf_UserNotifications, n.getUserid()).putColumn(n.getTime().getTime()+"", n.getKey().toString(), null); - else + + // another entry in the Unread Notifications Timeline + m.withRow(cf_UserNotificationsUnread, n.getUserid()).putColumn(n.getTime().getTime()+"", n.getKey().toString(), null); + } + else{ //an entry in the user Messages Notifications Timeline m.withRow(cf_UserMessageNotifications, n.getUserid()).putColumn(n.getTime().getTime()+"", n.getKey().toString(), null); + //an entry in the user Unread Messages Notifications Timeline + m.withRow(cf_UserMessageNotificationsUnread, n.getUserid()).putColumn(n.getTime().getTime()+"", n.getKey().toString(), null); + } + return execute(m); } @@ -949,6 +967,16 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore { MutationBatch m = conn.getKeyspace().prepareMutationBatch(); //an entry in the feed CF m.withRow(cf_Notifications, notificationidToSet).putColumn("Read", true, null); + + // delete the notification's key from the unread notifications or unread notification messages column family, according to the type + if(toSet.getType().equals(NotificationType.MESSAGE)){ + m.withRow(cf_UserMessageNotificationsUnread, toSet.getUserid()).deleteColumn(toSet.getTime().getTime()+""); + } + else{ + m.withRow(cf_UserNotificationsUnread, toSet.getUserid()).deleteColumn(toSet.getTime().getTime()+""); + } + + // execute the operations try { m.execute(); } catch (ConnectionException e) { @@ -983,6 +1011,31 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore { } return toReturn; } + /** + * Return a list of not read notifications by user userid + * @param userid user identifier + * @return simply return a list of not read user notifications UUID in chronological order from the oldest to the more recent + */ + private ArrayList getUnreadUserNotificationsIds(String userid) { + OperationResult> result = null; + try { + result = conn.getKeyspace().prepareQuery(cf_UserNotificationsUnread) + .getKeySlice(userid) + .execute(); + } catch (ConnectionException e) { + e.printStackTrace(); + } + + ArrayList toReturn = new ArrayList(); + + // Iterate rows and their columns + for (Row row : result.getResult()) { + for (Column column : row.getColumns()) { + toReturn.add(column.getStringValue()); + } + } + return toReturn; + } /** * * @param userid user identifier @@ -1008,6 +1061,31 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore { } return toReturn; } + /** + * Returns UUIDS of not read user notification messages + * @param userid user identifier + * @return simply return a list of yet to read user messages notifications UUID in chronological order from the oldest to the more recent + */ + private ArrayList getUserMessagesUnreadNotificationsIds(String userid) { + OperationResult> result = null; + try { + result = conn.getKeyspace().prepareQuery(cf_UserMessageNotificationsUnread) + .getKeySlice(userid) + .execute(); + } catch (ConnectionException e) { + e.printStackTrace(); + } + + ArrayList toReturn = new ArrayList(); + + // Iterate rows and their columns + for (Row row : result.getResult()) { + for (Column column : row.getColumns()) { + toReturn.add(column.getStringValue()); + } + } + return toReturn; + } /** * {@inheritDoc} */ @@ -1036,16 +1114,17 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore { @Override public List getUnreadNotificationsByUser(String userid) throws NotificationTypeNotFoundException, ColumnNameNotFoundException, NotificationIDNotFoundException { ArrayList toReturn = new ArrayList(); - ArrayList notificationsIDs = getUserNotificationsIds(userid); + ArrayList notificationsIDs = getUnreadUserNotificationsIds(userid); //need them in reverse order for (int i = notificationsIDs.size()-1; i >= 0; i--) { - Notification toAdd = readNotification(notificationsIDs.get(i)); - if ((!toAdd.isRead()) && (toAdd.getType() != NotificationType.MESSAGE) ) { //i just set the first notification unread to read (much faster cuz i check only the newest) - toReturn.add(toAdd); - break; + try{ + toReturn.add(readNotification(notificationsIDs.get(i))); + }catch(Exception e){ + _log.error("Unable to read notification with key " + notificationsIDs.get(i)); } } + return toReturn; } /** @@ -1085,19 +1164,16 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore { */ @Override public boolean setAllNotificationReadByUser(String userid) throws NotificationTypeNotFoundException, ColumnNameNotFoundException { - ArrayList notificationsIDs = getUserNotificationsIds(userid); - //need them in reverse order + // get the list of unread notifications + ArrayList notificationsIDs = getUnreadUserNotificationsIds(userid); + for (int i = notificationsIDs.size()-1; i >= 0; i--) { - Notification toAdd; - try { - toAdd = readNotification(notificationsIDs.get(i)); - if ((!toAdd.isRead()) && (toAdd.getType() != NotificationType.MESSAGE) ) { //while I encounter unread notifications keep putting them to read, else exit - setNotificationRead(toAdd.getKey()); - } - else { - break; - } + try{ + + // set to read (and automatically remove from the unread column family) + setNotificationRead(notificationsIDs.get(i)); + } catch (NotificationIDNotFoundException e) { _log.error("Could not set read notification with id =" + notificationsIDs.get(i)); } @@ -1110,16 +1186,17 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore { @Override public List getUnreadNotificationMessagesByUser(String userid) throws NotificationTypeNotFoundException, ColumnNameNotFoundException, NotificationIDNotFoundException { ArrayList toReturn = new ArrayList(); - ArrayList notificationsIDs = getUserMessagesNotificationsIds(userid); + ArrayList notificationsIDs = getUserMessagesUnreadNotificationsIds(userid); //need them in reverse order for (int i = notificationsIDs.size()-1; i >= 0; i--) { - Notification toAdd = readNotification(notificationsIDs.get(i)); - if ((!toAdd.isRead()) && (toAdd.getType() == NotificationType.MESSAGE) ) {//i just set the first message notification unread to read (much faster) - toReturn.add(toAdd); - break; + try{ + toReturn.add(readNotification(notificationsIDs.get(i))); + }catch(Exception e){ + _log.error("Unable to read notification message with key " + notificationsIDs.get(i)); } } + return toReturn; } /** @@ -1127,40 +1204,18 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore { */ @Override public boolean checkUnreadNotifications(String userid) throws NotificationTypeNotFoundException, ColumnNameNotFoundException { - ArrayList notificationsIDs = getUserNotificationsIds(userid); - //since #readNotification costs time and newer notifications are iterarate first (with the reverse for below) - //i just see if the first non message notification (UserNotifications TimeLine) is read or not and return the value instead of iterating them one by one looking for unread() - //need them in reverse order - for (int i = notificationsIDs.size()-1; i >= 0; i--) { - Notification toAdd; - try { - toAdd = readNotification(notificationsIDs.get(i)); - if (toAdd.getType() != NotificationType.MESSAGE) - return ! toAdd.isRead(); - } catch (NotificationIDNotFoundException e) { - _log.error("Notification not found with id = " + notificationsIDs.get(i)); - return false; - } - } - return false; + // are there notifications to read? + return getUnreadUserNotificationsIds(userid).size() > 0; } /** * {@inheritDoc} */ @Override public boolean checkUnreadMessagesNotifications(String userid) throws NotificationIDNotFoundException, NotificationTypeNotFoundException, ColumnNameNotFoundException { - ArrayList notificationsIDs = getUserMessagesNotificationsIds(userid); - //since #readNotification costs time and newer notifications are iterarate first (with the reverse for below) - //i just see if the first message notification (UserMessagesNotifications TL) is read or not and return the value instead of iterating them one by one looking for unread() - //need them in reverse order - for (int i = notificationsIDs.size()-1; i >= 0; i--) { - Notification toAdd = readNotification(notificationsIDs.get(i)); - if (toAdd.getType() == NotificationType.MESSAGE) - return ! toAdd.isRead(); - } - return false; + // are there messages to read? + return getUserMessagesUnreadNotificationsIds(userid).size() > 0; } /* *