public List<NotificationEntry> getNotifications(String username, String startId) { try { byte[] timeUUIDAsBytes = EMPTY_BYTE_ARRAY; if (startId != null && startId.length() > 0) { UUID uuid = UUIDUtil.fromString(startId); final byte[] idAsBytes = UUIDUtil.toBytes(uuid); timeUUIDAsBytes = getTimeUUIDFromID(username, idAsBytes); if (timeUUIDAsBytes == null) { timeUUIDAsBytes = EMPTY_BYTE_ARRAY; } } Selector selector = Pelops.createSelector(TRENDOCEAN_POOL, TRENDOCEAN_KEYSPACE); SlicePredicate columnPredicate = Selector.newColumnsPredicate(timeUUIDAsBytes, EMPTY_BYTE_ARRAY, true, PAGE_SIZE); List<SuperColumn> columns = selector.getSuperColumnsFromRow(username, WALL_CF, columnPredicate, ConsistencyLevel.ONE); List<NotificationEntry> notificationList = new ArrayList<NotificationEntry>(columns.size()); for (SuperColumn superColumn : columns) { List<Column> wallEntryColumns = superColumn.getColumns(); String notificationId = null; NotificationType notificationType = null; String questionId = null; String relatedUser = null; long answerCount = -1L; long time = 0; for (Column notificationColumn : wallEntryColumns) { String notificationColumnName = toString(notificationColumn.getName()); if (notificationColumnName.equals("_id")) { notificationId = UUIDUtil.toUUID(notificationColumn.getValue()).toString(); long timeInMicroSeconds = notificationColumn.getTimestamp(); time = timeInMicroSeconds / 1000L; } else if (notificationColumnName.equals("_type")) { notificationType = NotificationType.fromId(toByte(notificationColumn)); } else if (notificationColumnName.equals("questionId")) { questionId = toString(notificationColumn); } else if (notificationColumnName.equals("relatedUser")) { relatedUser = toString(notificationColumn); } else if (notificationColumnName.equals("answerCount")) { answerCount = toLong(notificationColumn); } else { logger.warn("Invalid notification column:{}", notificationColumnName); } } NotificationEntry notificationEntry = new NotificationEntry(); notificationEntry.setId(notificationId); notificationEntry.setTime(time); notificationEntry.setNotificationType(notificationType); notificationEntry.setQuestionId(questionId); notificationList.add(notificationEntry); notificationEntry.setUsername(relatedUser); notificationEntry.setAnswerCount(answerCount); } return notificationList; } catch (NotFoundException ex) { return Collections.EMPTY_LIST; } catch (Exception ex) { logger.error("Can not get time uuid", ex); throw new TrendOceanException(ex); } }