use of io.gravitee.repository.management.model.PortalNotification in project gravitee-management-rest-api by gravitee-io.
the class PortalNotificationServiceImpl method convert.
private PortalNotification convert(NewPortalNotificationEntity entity) {
PortalNotification notification = new PortalNotification();
notification.setTitle(entity.getTitle());
notification.setMessage(entity.getMessage());
notification.setUser(entity.getUser());
return notification;
}
use of io.gravitee.repository.management.model.PortalNotification in project gravitee-management-rest-api by gravitee-io.
the class PortalNotificationServiceImpl method create.
private void create(List<NewPortalNotificationEntity> notificationEntities) {
final Date now = new Date();
List<PortalNotification> notifications = notificationEntities.stream().map(this::convert).collect(Collectors.toList());
notifications.forEach(n -> {
n.setId(UUID.toString(UUID.random()));
n.setCreatedAt(now);
});
try {
portalNotificationRepository.create(notifications);
} catch (TechnicalException ex) {
LOGGER.error("An error occurs while trying to create {}", notifications, ex);
throw new TechnicalManagementException("An error occurs while trying create " + notifications, ex);
}
}
Aggregations