BrightSide Workbench Full Report + Source Code
org.turro.newsletter.mail.NewsletterSendToSubscribers Class Reference
Inheritance diagram for org.turro.newsletter.mail.NewsletterSendToSubscribers:
Collaboration diagram for org.turro.newsletter.mail.NewsletterSendToSubscribers:

Public Member Functions

 NewsletterSendToSubscribers (Newsletter newsletter)
 
- Public Member Functions inherited from org.turro.mail.queue.QueuedSender
 QueuedSender ()
 
void send ()
 
void pause ()
 
void run ()
 

Protected Member Functions

void doSend ()
 

Additional Inherited Members

- Static Public Member Functions inherited from org.turro.mail.queue.QueuedSender
static AtomicCounter getCounter ()
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 50 of file NewsletterSendToSubscribers.java.

Constructor & Destructor Documentation

◆ NewsletterSendToSubscribers()

org.turro.newsletter.mail.NewsletterSendToSubscribers.NewsletterSendToSubscribers ( Newsletter  newsletter)

Definition at line 54 of file NewsletterSendToSubscribers.java.

54  {
55  this.newsletter = newsletter;
56  }

Member Function Documentation

◆ doSend()

void org.turro.newsletter.mail.NewsletterSendToSubscribers.doSend ( )
protected

Reimplemented from org.turro.mail.queue.QueuedSender.

Definition at line 59 of file NewsletterSendToSubscribers.java.

59  {
60  AssistantSet assistants = getAssistants();
61  MailMessagePool pool = MailProviders.instance().getPool(Application.getApplication().getConstructor(), "Publication");
62  if(pool != null) {
63  IAgreements agreements = Plugins.loadImplementation(IAgreements.class, "agreements");
64  NotificationCategory nc = Notifications.getCategory(newsletter.getIdCategory());
65  for(Assistant assistant : assistants) {
66  if(assistant.getContact().acceptsLang(newsletter.getLang())) {
67  agreements.setContact(assistant.getContact());
68  if(agreements.canSendEmails(nc)) {
69  try (NewsletterTemplate nt = new NewsletterTemplate(newsletter)) {
70  MailMessageTemplate mmt = nt.getMailMessage(pool, assistant.getContact());
71  if(newsletter.trigger(assistant.getContact())) {
72  pool.addToPool(mmt);
73  pool.sendPool();
74  pause();
75  }
76  } catch (IOException | EmailException ex) {
77  Logger.getLogger(NewsletterSendToSubscribers.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
78  }
79  }
80  }
81  }
82  newsletter.resetGlobalContext();
83  }
84  }
boolean trigger(IContact contact)
Here is the call graph for this function:

The documentation for this class was generated from the following file: