private <T extends NotificationEvent> List<NotificationEventWithMetadata<T>> getFutureNotificationsInternal(final Class<T> typeX, final NotificationSqlDao transactionalDao, final String searchKey, final Long searchKeyValue) { final List<NotificationEventWithMetadata<T>> result = new LinkedList<NotificationEventWithMetadata<T>>(); final List<NotificationEventModelDao> entries = transactionalDao.getReadyQueueEntriesForSearchKey(getFullQName(), searchKeyValue, config.getTableName(), searchKey); for (NotificationEventModelDao cur : entries) { final T event = (T) DefaultQueueLifecycle.deserializeEvent(cur.getClassName(), objectMapper, cur.getEventJson()); final NotificationEventWithMetadata<T> foo = new NotificationEventWithMetadata<T>(cur.getRecordId(), cur.getUserToken(), cur.getCreatedDate(), cur.getSearchKey1(), cur.getSearchKey2(), event, cur.getFutureUserToken(), cur.getEffectiveDate(), cur.getQueueName()); result.add(foo); } return result; }
private <T extends NotificationEvent> List<NotificationEventWithMetadata<T>> getFutureNotificationsInternal(final Class<T> type, final Long searchKey1, final Transmogrifier transmogrifier) { final List<NotificationEventWithMetadata<T>> result = new ArrayList<NotificationEventWithMetadata<T>>(); synchronized (notifications) { for (final NotificationEventModelDao notification : notifications) { if (notification.getSearchKey1().equals(searchKey1) && type.getName().equals(notification.getClassName()) && notification.getEffectiveDate().isAfter(clock.getUTCNow())) { final T event = (T) DefaultQueueLifecycle.deserializeEvent(notification.getClassName(), objectMapper, notification.getEventJson()); final NotificationEventWithMetadata<T> foo = new NotificationEventWithMetadata<T>(notification.getRecordId(), notification.getUserToken(), notification.getCreatedDate(), notification.getSearchKey1(), notification.getSearchKey2(), event, notification.getFutureUserToken(), notification.getEffectiveDate(), notification.getQueueName()); result.add(foo); } } } return result; }