use of edu.stanford.bmir.protege.web.server.mail.MessageId in project webprotege by protegeproject.
the class CommentNotificationEmailer method sendEmailToUsers.
private void sendEmailToUsers(@Nonnull Collection<UserDetails> userDetails, @Nonnull ProjectId projectId, @Nonnull OWLEntityData entityData, @Nonnull EntityDiscussionThread discussionThread, @Nonnull Comment postedComment) {
List<String> emailAddresses = userDetails.stream().map(UserDetails::getEmailAddress).filter(Optional::isPresent).map(Optional::get).collect(toList());
MessageId postedCommentMessageId = messageIdGenerator.generateCommentMessageId(projectId, postedComment.getId());
List<MessageHeader> messageHeaders = new ArrayList<>();
int commentIndex = discussionThread.getComments().indexOf(postedComment);
if (commentIndex != 0) {
// Reply to the original message
MessageId headCommentMessageId = messageIdGenerator.generateCommentMessageId(projectId, discussionThread.getComments().get(0).getId());
messageHeaders.add(MessageHeader.inReplyTo(headCommentMessageId.getId()));
messageHeaders.add(MessageHeader.references(headCommentMessageId.getId()));
}
sendMail.sendMail(postedCommentMessageId, emailAddresses, formatSubjectLine(projectId, entityData, discussionThread, postedComment), formatMessage(projectId, entityData, discussionThread, postedComment), messageHeaders.toArray(new MessageHeader[messageHeaders.size()]));
}
Aggregations