1 17 18 package org.efs.openreports.objects; 19 20 import java.io.Serializable ; 21 import java.util.StringTokenizer ; 22 import java.util.Vector ; 23 24 import org.efs.openreports.util.ByteArrayDataSource; 25 26 public class MailMessage implements Serializable  27 { 28 private static final long serialVersionUID = -5816798771288286268L; 29 30 private String sender; 31 private String subject; 32 private String text; 33 34 private Vector recipients = new Vector (); 35 private Vector attachments = new Vector (); 36 private Vector htmlImageDataSources = new Vector (); 37 38 private ByteArrayDataSource byteArrayDataSource; 39 40 public MailMessage() 41 { 42 } 43 44 public String getSender() 45 { 46 return sender; 47 } 48 49 public void setSender(String sender) 50 { 51 this.sender = sender; 52 } 53 54 public Vector getRecipients() 55 { 56 return recipients; 57 } 58 59 public void setRecipients(Vector recipients) 60 { 61 this.recipients = recipients; 62 } 63 64 public String getSubject() 65 { 66 return subject; 67 } 68 69 public void setSubject(String subject) 70 { 71 this.subject = subject; 72 } 73 74 public String getText() 75 { 76 return text; 77 } 78 79 public void setText(String text) 80 { 81 this.text = text; 82 } 83 84 public ByteArrayDataSource getByteArrayDataSource() 85 { 86 return byteArrayDataSource; 87 } 88 89 public void setByteArrayDataSource(ByteArrayDataSource byteArrayDataSource) 90 { 91 this.byteArrayDataSource = byteArrayDataSource; 92 } 93 94 public Vector getAttachments() 95 { 96 return attachments; 97 } 98 99 public void addAttachment(String fileName) 100 { 101 attachments.add(fileName); 102 } 103 104 public void addRecepient(String recipient) 105 { 106 recipients.add(recipient); 107 } 108 109 public String formatRecipients(String delimiter) 110 { 111 String addresses = ""; 112 113 for (int i = 0; i < recipients.size(); i++) 114 { 115 addresses += recipients.get(i) + delimiter; 116 } 117 118 return addresses.substring(0, addresses.length() - 1); 119 } 120 121 public void parseRecipients(String value) 122 { 123 StringTokenizer st = new StringTokenizer (value, "\t\n\r\f;,|"); 124 125 recipients = new Vector (); 126 127 while (st.hasMoreElements()) 128 { 129 recipients.add(st.nextElement()); 130 } 131 } 132 133 public Vector getHtmlImageDataSources() 134 { 135 return htmlImageDataSources; 136 } 137 138 public void addHtmlImageDataSources(Vector htmlImageDataSources) 139 { 140 this.htmlImageDataSources.addAll(htmlImageDataSources); 141 } 142 143 }
| Popular Tags
|