Post on 20-Aug-2015
ExpressiveDesign
phillip calçadohttp://fragmental.tw
(in 20 minutes)
public class Mail {
public void sendEmailWithCsvFile(String from, String to, String subject, String body, List<String> csvFileLines) {
Properties props = new Properties(); props.put("mail.smtp.host", "localhost");
Session session = Session.getDefaultInstance(props);
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = { new InternetAddress(to) }; msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject(subject); msg.setSentDate(new Date());
MimeBodyPart part1 = new MimeBodyPart(); part1.setText(body);
MimeBodyPart part2 = new MimeBodyPart(); StringBuffer buffer = new StringBuffer(); for (String line : csvFileLines) buffer.append(line + "\n"); part2.setContent(buffer.toString(), "text/csv"); part2.setFileName("file.csv");
Multipart mp = new MimeMultipart(); mp.addBodyPart(part1); mp.addBodyPart(part2);
msg.setContent(mp);
Transport.send(msg); }}
I want this CSV report delivered
as an e-mailattachment
InternetAddress
MimeMessage
Session Properties
Message.RecipientType
MimeBodyPart
Multipart
public class Mail {
public void sendEmailWithCsvFile(String from, String to, String subject, String body, List<String> csvFileLines) {
Properties props = new Properties(); props.put("mail.smtp.host", "localhost"); MailService mailService = new MailService(props); MailMessage message = mailService.newMessage(); message.setFrom(from); message.setTo(to); message.setSubject(subject); message.setBody(body);
StringBuffer buffer = new StringBuffer(); for (String line : csvFileLines) buffer.append(line + "\n"); Attachment csvFile = new Attachment("file.csv", buffer.toString()); message.attach(csvFile);
mailService.send(message); }}
I want this CSV report delivered
as an e-mailattachment
MailMessage
MailService Properties
Attachment
public class Mail {
public void sendEmailWithCsvFile(String from, String to, String subject, String body, List<String> csvFileLines) {
StringBuffer buffer = new StringBuffer(); for (String line : csvFileLines) buffer.append(line + "\n"); Properties props = new Properties(); props.put("mail.smtp.host", "localhost"); MailService mailService = new MailService(props); mailService.newMessage() .from(from) .to(to) .subject(subject) .body(body) .attachTextFile("file3.csv", buffer.toString()) .send(); }}
send_email do to 'pcalcado@gmail.com' from 'bemaia@fragmental.tw' subject 'Testing via Ruby'
body %{ Hi, Please do not forget the milk. Bye! }
attachment('file4.csv') << linesend
I want this CSV report delivered
as an e-mailattachment
Attachment
Noisethe difference between
I want this CSV report delivered
as an e-mailattachment
AttachmentThis
Noisethe difference between
I want this CSV report delivered
as an e-mailattachment
AttachmentThis That
Noisethe difference between
This That
Noisethe difference between
Operation
Operation
Attribute
Attribute
Class Name
Operation
Operation
Attribute
Attribute
Class Name
Operation
Operation
Attribute
Attribute
Class Name
public class Something{
private String name;
public boolean doS(){
}
}
Business Analysis Design Implementation
“Idiomatic”: Focus on how to use technical tools to solve the problem in an efficient way.
Domain-Driven: Language is only a tool to model the domain.
Internal DSL: Language is only an extensible tool to model the domain.
External DSL: Language is created based on the domain.
:internal { DSL}
“Idiomatic”: Focus on how to use technical tools to solve the problem in an efficient way.
Domain-Driven: Language is only a tool to model the domain.
Internal DSL: Language is only an extensible tool to model the domain.
External DSL: Language is created based on the domain.
:internal { DSL}
TODO:
Need a
better name
for that
pics• http://www.flickr.com/photos/bitzi/293673587/
• http://www.flickr.com/photos/sage/2143086954/
• http://www.flickr.com/photos/brianmitchell/2113553867/
• http://www.flickr.com/photos/kamaski/186266747/
• http://www.flickr.com/photos/tosawyer/43691981/
• http://www.flickr.com/photos/helderfontenele/2134684620/
• http://www.flickr.com/photos/sotto1/808195510/