1 5 package org.exoplatform.services.communication.message.impl; 6 7 import java.util.*; 8 import org.exoplatform.services.communication.message.Attachment; 9 import org.exoplatform.services.communication.message.Message; 10 18 public class MessageImpl extends MessageHeaderImpl implements Message { 19 private String receiver = ""; 20 private String CC = ""; 21 private String BCC = ""; 22 private String body = ""; 23 private List attachments; 24 25 public String getTo() { return receiver;} 26 public void setTo(String value) { receiver = value; } 27 28 31 public String getReceiver() { return receiver;} 32 public void setReceiver(String value) { receiver = value; } 33 34 37 public String getCC() { return CC; } 38 public void setCC(String value) { CC = value; } 39 40 43 public String getBCC() { return BCC; } 44 public void setBCC(String value) { BCC = value; } 45 46 49 public String getBody() { return body; } 50 public void setBody(String value) { body = value; } 51 52 public void addAttachment(Attachment attachment) { 53 if(attachments == null) attachments = new ArrayList() ; 54 attachments.add(attachment) ; 55 } 56 57 public List getAttachment() { return attachments; } 58 59 public MessageImpl cloneMessage() { 60 MessageImpl newMessage = new MessageImpl() ; 61 newMessage.setFolderId(getFolderId()) ; 62 newMessage.setMailMessageId(getMailMessageId()) ; 63 newMessage.setFrom(getFrom()) ; 64 newMessage.setTo(getTo()); 65 newMessage.setCC(getCC()) ; 66 newMessage.setBCC(getBCC()) ; 67 newMessage.setFlags(getFlags()); 68 newMessage.setSender(getSender()) ; 69 newMessage.setBody(getBody()) ; 70 newMessage.setSubject(getSubject()) ; 71 newMessage.setReceivedDate(getReceivedDate()) ; 72 if(attachments != null) { 73 for(int i = 0; i < attachments.size(); i++) { 74 AttachmentImpl attachment = (AttachmentImpl) attachments.get(i) ; 75 newMessage.addAttachment(attachment.cloneAttachment()) ; 76 } 77 } 78 return newMessage ; 79 } 80 } | Popular Tags |