BrightSide Workbench Full Report + Source Code
org.turro.zkoss.contact.SendAttachments Class Referenceabstract

Public Member Functions

 SendAttachments (String title)
 
void addAttachment (Object entity, String path, String name)
 
void sendAttachments (Collection< IContact > contacts) throws IOException
 

Protected Member Functions

abstract void fillAttachment (File attachment, Object entity)
 

Detailed Description

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

Definition at line 50 of file SendAttachments.java.

Constructor & Destructor Documentation

◆ SendAttachments()

org.turro.zkoss.contact.SendAttachments.SendAttachments ( String  title)

Definition at line 56 of file SendAttachments.java.

56  {
57  this.title = title;
58  }

Member Function Documentation

◆ addAttachment()

void org.turro.zkoss.contact.SendAttachments.addAttachment ( Object  entity,
String  path,
String  name 
)

Definition at line 60 of file SendAttachments.java.

60  {
61  attachments.add(new MailAttachment(path, name, entity));
62  }
Here is the caller graph for this function:

◆ fillAttachment()

abstract void org.turro.zkoss.contact.SendAttachments.fillAttachment ( File  attachment,
Object  entity 
)
abstractprotected
Here is the caller graph for this function:

◆ sendAttachments()

void org.turro.zkoss.contact.SendAttachments.sendAttachments ( Collection< IContact contacts) throws IOException

Definition at line 64 of file SendAttachments.java.

64  {
65  if(attachments.isEmpty()) {
66  return;
67  }
68  IMailRecipients.selectRecipients(contacts, new Command() {
69  @Override
70  public Object execute(Context context) {
71  IMailRecipients mr = (IMailRecipients) context.get("component");
72  Collection<IContact> contacts = mr.getRecipients();
73  if(contacts != null) {
74  String mailString = getMailString(contacts);
75  if(!Strings.isBlank(mailString)) {
76  for(MailAttachment ma : attachments) {
77  try {
78  ma.attachment = File.createTempFile("attach_", "_mail");
79  fillAttachment(ma.attachment, ma.entity);
80  } catch (IOException ex) {
81  Logger.getLogger(SendAttachments.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(mailString), ex);
82  }
83  }
84  sendAttachments(contacts, attachments, IMailRecipients.getComment(), mailString, (m) -> {
85  for(MailAttachment ma : attachments) {
86  ma.attachment.delete();
87  SystemLogger.getInstance().doLog(SystemLogType.LOG_INFO, ma.path, "sent", mailString);
88  }
89  });
90  }
91  }
92  return null;
93  }
94  });
95  }
void sendAttachments(Collection< IContact > contacts)
abstract void fillAttachment(File attachment, Object entity)
Here is the call graph for this function:
Here is the caller graph for this function:

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