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 a5cc237..a719727 100644 --- a/src/main/java/org/gcube/portal/databook/server/DBCassandraAstyanaxImpl.java +++ b/src/main/java/org/gcube/portal/databook/server/DBCassandraAstyanaxImpl.java @@ -2284,7 +2284,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore { */ @Override public Map getUserNotificationPreferences(String userid) throws NotificationTypeNotFoundException, NotificationChannelTypeNotFoundException { - _log.trace("Asking for Notification preferences of " + userid); + _log.info("Asking for Notification preferences of " + userid); Map toReturn = new HashMap(); ResultSet result = null; @@ -2301,9 +2301,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore { e.printStackTrace(); } - + //if there are no settings for this user create an entry and put all of them at true List results = result.all(); + _log.info("Result set empty? " + results.isEmpty()); if (results.isEmpty()) { _log.info("Userid " + userid + " settings not found, initiating its preferences..."); HashMap toCreate = new HashMap(); @@ -2323,10 +2324,12 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore { return toCreate; } else { - _log.trace("Notification preferences Found for " + userid); + _log.info("Notification preferences Found for " + userid + " : " + results.size()) ; for (Row row: results){ String[] channels = row.getString(PREFERENCE).split(","); + _log.info("Row : " + row.getString(PREFERENCE)); if (channels != null && channels.length == 1 && channels[0].toString().equals("") ) { //it is empty, preference is set to no notification at all + _log.info("adding CHANNELS NULL: " + getNotificationType(row.getString(TYPE)) + ", " + new NotificationChannelType[0]); toReturn.put(getNotificationType(row.getString(TYPE)), new NotificationChannelType[0]); } else { NotificationChannelType[] toAdd = new NotificationChannelType[channels.length]; @@ -2335,10 +2338,12 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore { toAdd[i] = (getChannelType(channels[i])); } } + _log.info("adding channels not null: " + getNotificationType(row.getString(TYPE)) + ", " + toAdd.toString()); toReturn.put(getNotificationType(row.getString(TYPE)), toAdd); } } } + _log.info("Returning:"+toReturn.size()); return toReturn; } /*