private Notification convert(final NotificationEvent event) { final Notification notification = new Notification(); notification.setNodeUrn(new NodeUrn(event.getNodeUrn())); notification.setTimestamp(new DateTime(event.getTimestamp())); notification.setMsg(event.getMessage()); return notification; }
@Override public int compare(NotificationEvent notificationEvent1, NotificationEvent notificationEvent2) { if (notificationEvent1.equals(notificationEvent2)) { return 0; } long value = notificationEvent1.getDeliverBy() - notificationEvent2.getDeliverBy(); if (value == 0) { value = notificationEvent1.getTimestamp() - notificationEvent2.getTimestamp(); } if (value == 0) { value = notificationEvent1.hashCode() - notificationEvent2.hashCode(); } if (_ascending) { return (int) value; } else { return (int) -value; } }