use of com.blackducksoftware.integration.hub.alert.datasource.entity.NotificationEntity in project hub-alert by blackducksoftware.
the class NotificationManager method saveNotification.
public NotificationModel saveNotification(final NotificationModel notification) {
final NotificationEntity notificationEntity = notificationRepository.save(notification.getNotificationEntity());
List<VulnerabilityEntity> vulnerabilities = Collections.emptyList();
if (notification.getVulnerabilityList() != null) {
final Collection<VulnerabilityEntity> vulnerabilityList = notification.getVulnerabilityList();
final List<VulnerabilityEntity> vulnerabilitiesToSave = vulnerabilityList.stream().map(vulnerability -> new VulnerabilityEntity(vulnerability.getVulnerabilityId(), vulnerability.getOperation(), notificationEntity.getId())).collect(Collectors.toList());
vulnerabilities = vulnerabilityRepository.save(vulnerabilitiesToSave);
}
return new NotificationModel(notificationEntity, vulnerabilities);
}
Aggregations