001    /****************************************************************
002     * Licensed to the Apache Software Foundation (ASF) under one   *
003     * or more contributor license agreements.  See the NOTICE file *
004     * distributed with this work for additional information        *
005     * regarding copyright ownership.  The ASF licenses this file   *
006     * to you under the Apache License, Version 2.0 (the            *
007     * "License"); you may not use this file except in compliance   *
008     * with the License.  You may obtain a copy of the License at   *
009     *                                                              *
010     *   http://www.apache.org/licenses/LICENSE-2.0                 *
011     *                                                              *
012     * Unless required by applicable law or agreed to in writing,   *
013     * software distributed under the License is distributed on an  *
014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
015     * KIND, either express or implied.  See the License for the    *
016     * specific language governing permissions and limitations      *
017     * under the License.                                           *
018     ****************************************************************/
019    
020    package org.apache.hupa.shared.data;
021    
022    import java.util.ArrayList;
023    
024    public class SMTPMessage extends AbstractMessage{
025        private static final long serialVersionUID = 7331361994526216161L;
026        private ArrayList<String> bcc;
027        private String text;
028        private ArrayList<MessageAttachment> aList;
029        
030        public String toString() {
031            StringBuffer bccList = new StringBuffer("");
032            if (bcc !=null) 
033                for (String s: bcc)
034                    bccList.append(s).append(" ");
035            
036            StringBuffer attachNames = new StringBuffer("");
037            for (MessageAttachment m: aList) 
038                attachNames.append(m.getName()).append(" ");
039            
040            return super.toString()
041                 + " Bcc='" + bccList.toString()
042                 + "'\nAttachments=" + attachNames.toString()
043                 + "'\nMessage:\n" + text;
044        }
045        
046        public ArrayList<String> getBcc() {
047            return bcc;
048        }
049        public void setBcc(ArrayList<String> bcc) {
050            this.bcc = bcc;
051        }
052        
053        /**
054         * Set the body text of the content
055         * 
056         * @param text
057         */
058        public void setText(String text) {
059            this.text = text;
060        }
061    
062        /**
063         * Return the body text of the content
064         * @return The text
065         */
066        public String getText() {
067            return text;
068        }
069    
070        /**
071         * Set the attachments 
072         * 
073         * @param aList
074         */
075        public void setMessageAttachments(ArrayList<MessageAttachment> aList) {
076            this.aList = aList;
077        }
078    
079        /**
080         * Return the attachments 
081         * 
082         * @return aList
083         */
084        public ArrayList<MessageAttachment> getMessageAttachments() {
085            return aList;
086        }
087    
088    }