public synchronized List<NotificationHistoryEntry> getRecentEntries() {
return new ArrayList<NotificationHistoryEntry>(entries);
}
private NotificationHistoryEntry getEntry(BpmNotification notification) {
NotificationHistoryEntry entry = entriesByNotificationId.get(notification.getId());
if (entry != null) {
return entry;
}
entry = new NotificationHistoryEntry();
entry.setBpmNotificationId(notification.getId());
entry.setSender(notification.getSender());
entry.setRecipient(notification.getRecipient());
entry.setSubject(notification.getSubject());
entry.setBody(notification.getBody());
entry.setAsHtml(notification.getSendAsHtml());
entries.add(entry);
entriesByNotificationId.put(notification.getId(), entry);
if (maxEntries > 0 && entries.size() > maxEntries) {
NotificationHistoryEntry removedEntry = entries.removeFirst();
entriesByNotificationId.remove(removedEntry.getBpmNotificationId());
}
return entry;
}