add send meeting details to guests
This commit is contained in:
@@ -26,6 +26,8 @@ import com.axelor.tool.template.TemplateMaker;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
import javax.mail.MessagingException;
|
||||
import com.axelor.auth.db.User;
|
||||
import java.util.List;
|
||||
|
||||
public interface TemplateMessageService {
|
||||
|
||||
@@ -41,6 +43,10 @@ public interface TemplateMessageService {
|
||||
throws MessagingException, IOException, AxelorException, ClassNotFoundException,
|
||||
InstantiationException, IllegalAccessException;
|
||||
|
||||
public Message generateAndSendMessageToBulkUsers(Model model, Template template, Set<User> users)
|
||||
throws MessagingException, IOException, AxelorException, ClassNotFoundException,
|
||||
InstantiationException, IllegalAccessException;
|
||||
|
||||
public Set<MetaFile> getMetaFiles(Template template) throws AxelorException, IOException;
|
||||
|
||||
public TemplateMaker initMaker(long objectId, String model, String tag, boolean isJson)
|
||||
|
||||
@@ -53,10 +53,13 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import javax.mail.MessagingException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.axelor.auth.db.User;
|
||||
|
||||
public class TemplateMessageServiceImpl implements TemplateMessageService {
|
||||
|
||||
@@ -197,7 +200,10 @@ public class TemplateMessageServiceImpl implements TemplateMessageService {
|
||||
|
||||
message.setTemplate(Beans.get(TemplateRepository.class).find(template.getId()));
|
||||
|
||||
message = Beans.get(MessageRepository.class).save(message);
|
||||
// Save message if it's not related to the USER model
|
||||
if (!"com.axelor.auth.db.User".equals(model)) {
|
||||
message = Beans.get(MessageRepository.class).save(message);
|
||||
}
|
||||
|
||||
messageService.attachMetaFiles(message, getMetaFiles(template));
|
||||
|
||||
@@ -215,6 +221,26 @@ public class TemplateMessageServiceImpl implements TemplateMessageService {
|
||||
return message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message generateAndSendMessageToBulkUsers(Model model, Template template, Set<User> users)
|
||||
throws MessagingException, IOException, AxelorException, ClassNotFoundException,
|
||||
InstantiationException, IllegalAccessException {
|
||||
|
||||
Message message = this.generateMessage(model, template);
|
||||
Set<EmailAddress> emailAddresses = new HashSet<>();
|
||||
for (User user : users) {
|
||||
emailAddresses.add(getEmailAddress(user.getEmail()));
|
||||
}
|
||||
|
||||
// Set recipients as sets
|
||||
message.setToEmailAddressSet(emailAddresses);
|
||||
message.setCcEmailAddressSet(emailAddresses);
|
||||
|
||||
messageService.sendMessage(message);
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<MetaFile> getMetaFiles(Template template) throws AxelorException, IOException {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user