debug_error
This commit is contained in:
parent
bcd8e29a8c
commit
b8f9b0a90a
|
@ -2284,7 +2284,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
*/
|
||||
@Override
|
||||
public Map<NotificationType, NotificationChannelType[]> getUserNotificationPreferences(String userid) throws NotificationTypeNotFoundException, NotificationChannelTypeNotFoundException {
|
||||
_log.trace("Asking for Notification preferences of " + userid);
|
||||
_log.info("Asking for Notification preferences of " + userid);
|
||||
Map<NotificationType, NotificationChannelType[]> toReturn = new HashMap<NotificationType, NotificationChannelType[]>();
|
||||
|
||||
ResultSet result = null;
|
||||
|
@ -2304,6 +2304,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
|
||||
//if there are no settings for this user create an entry and put all of them at true
|
||||
List<Row> results = result.all();
|
||||
_log.info("Result set empty? " + results.isEmpty());
|
||||
if (results.isEmpty()) {
|
||||
_log.info("Userid " + userid + " settings not found, initiating its preferences...");
|
||||
HashMap<NotificationType, NotificationChannelType[]> toCreate = new HashMap<NotificationType, NotificationChannelType[]>();
|
||||
|
@ -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;
|
||||
}
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue