use of org.nhindirect.monitor.dao.entity.ReceivedNotification in project nhin-d by DirectProject.
the class NotificationDuplicationDAOImpl method addNotification.
/**
* {@inheritDoc}
*/
@Override
@Transactional(readOnly = false)
public void addNotification(String messageId, String address) throws NotificationDAOException {
validateState();
try {
final Collection<String> notification = this.getReceivedAddresses(messageId, Arrays.asList(address));
if (!notification.isEmpty()) {
if (LOGGER.isDebugEnabled())
LOGGER.debug("Notification for message id " + messageId + " and address " + address + " already received. Not adding to received notification store.");
return;
}
final ReceivedNotification notif = new ReceivedNotification();
notif.setMessageid(messageId);
notif.setAddress(address);
notif.setReceivedTime(Calendar.getInstance(Locale.getDefault()));
entityManager.persist(notif);
entityManager.flush();
}///CLOVER:OFF
catch (Exception e) {
throw new NotificationDAOException("Failed to add notification to the store.", e);
}
///CLOVER:ON
}
Aggregations