Debug notification

This commit is contained in:
Ahmed Salah Tawfik Ibrahim 2023-12-13 13:47:19 +01:00
parent 2a9bdc6c4a
commit 35c8cfdc5a
1 changed files with 7 additions and 3 deletions

View File

@ -2188,11 +2188,12 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
*/ */
@Override @Override
public List<NotificationChannelType> getUserNotificationChannels(String userid, NotificationType notificationType) throws NotificationChannelTypeNotFoundException, NotificationTypeNotFoundException { public List<NotificationChannelType> getUserNotificationChannels(String userid, NotificationType notificationType) throws NotificationChannelTypeNotFoundException, NotificationTypeNotFoundException {
_log.trace("Asking for Single Notification preference of " + userid + " Type: " + notificationType); _log.info("Asking for Single Notification preference of " + userid + " Type: " + notificationType);
List<NotificationChannelType> toReturn = new ArrayList<NotificationChannelType>(); List<NotificationChannelType> toReturn = new ArrayList<NotificationChannelType>();
NotificationChannelType[] toProcess = getUserNotificationPreferences(userid).get(notificationType); NotificationChannelType[] toProcess = getUserNotificationPreferences(userid).get(notificationType);
_log.info("size of user notification preferences" + toProcess.length);
if (toProcess == null) { if (toProcess == null) {
_log.warn("Single Notification preference of " + userid + " Type: " + notificationType + " not existing ... creating default"); _log.info("Single Notification preference of " + userid + " Type: " + notificationType + " not existing ... creating default");
return createNewNotificationType(userid, notificationType); return createNewNotificationType(userid, notificationType);
} }
else if (toProcess.length == 0) else if (toProcess.length == 0)
@ -2209,6 +2210,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
*/ */
private List<NotificationChannelType> createNewNotificationType(String userid, NotificationType notificationType) { private List<NotificationChannelType> createNewNotificationType(String userid, NotificationType notificationType) {
List<NotificationChannelType> toReturn = new ArrayList<NotificationChannelType>(); List<NotificationChannelType> toReturn = new ArrayList<NotificationChannelType>();
_log.info("Create new notification type");
CqlSession session = conn.getKeyspaceSession(); CqlSession session = conn.getKeyspaceSession();
String valueToInsert = ""; String valueToInsert = "";
@ -2234,9 +2236,11 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
} }
if (res) { if (res) {
_log.trace("Set New Notification Setting for " + userid + " OK"); _log.info("Set New Notification Setting for " + userid + " OK");
_log.info("toreturn:" + toReturn.toString());
return toReturn; return toReturn;
} }
_log.info("empty list");
return new ArrayList<NotificationChannelType>(); //no notification if sth fails return new ArrayList<NotificationChannelType>(); //no notification if sth fails
} }
/** /**