@Override public NotificationEntity toNotificationEntity(Notification notification) { if (notification == null) { return null; } return mapperFacade.map(notification, JAXB2JPA_CLASS_MAP.get(notification.getClass())); }
@Override public Notification createNotification(String orcid, Notification notification) { if (notification.getPutCode() != null) { throw new IllegalArgumentException("Put code must be null when creating a new notification"); } NotificationEntity notificationEntity = notificationAdapter.toNotificationEntity(notification); ProfileEntity profile = profileEntityCacheManager.retrieve(orcid); if (profile == null) { throw OrcidNotFoundException.newInstance(orcid); } notificationEntity.setProfile(profile); notificationEntity.setSource(sourceManager.retrieveSourceEntity()); notificationDao.persist(notificationEntity); return notificationAdapter.toNotification(notificationEntity); }