class for send messages about update paper

This commit is contained in:
Alyona 2018-10-27 23:11:07 +04:00
parent 5e7cff8ac6
commit 7f54394b44

View File

@ -0,0 +1,25 @@
package ru.ulstu.paper.service;
import ru.ulstu.paper.model.Paper;
import ru.ulstu.paper.model.PaperDto;
import ru.ulstu.user.model.UserDto;
import ru.ulstu.user.service.MailService;
import java.util.List;
public class PaperMessages {
public final MailService mailService;
public PaperMessages(MailService mailService){
this.mailService = mailService;
}
private void sendMessageAboutStatusChange(Paper.PaperStatus oldStatus, PaperDto paper){
List<UserDto> users = paper.getAuthors();
for (UserDto user: users) {
mailService.sendEmail(user.getEmail(), "Обновление статуса статьи",
"Статус статьи " + paper.getTitle() + " сменился с " + oldStatus.getName()
+ " на " + paper.getStatus().getName());
}
}
}