001/*
002 *  Copyright 2017 Anyware Services
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package org.ametys.plugins.messagingconnector;
017
018/**
019 * This class represents a mail. A mail is composed by:<br>
020 * - a sender (name or email)<br>
021 * - a subject<br>
022 * - a summary<br>
023 */
024public class EmailMessage
025{
026    /** Sender of the mail */
027    private String _sender;
028
029    /** Subject of the mail */
030    private String _subject;
031
032    /** Summary of the mail */
033    private String _summary;
034
035    /** 
036     * Creates a empty email
037     */
038    public EmailMessage()
039    {
040       // Nothing
041    }
042    
043    /**
044     * Creates a new mail message
045     * @param subject the subject of the mail
046     * @param sender the sender of the mail
047     * @param summary the summary/body of the mail
048     */
049    public EmailMessage(String subject, String sender, String summary)
050    {
051        this._subject = subject;
052        this._sender = sender;
053        this._summary = summary;
054    }
055
056    /**
057     * Get the sender of the mail
058     * @return the sender
059     */
060    public String getSender()
061    {
062        return _sender;
063    }
064
065    /**
066     * Set the sender of the mail to a new user
067     * @param sender the sender to set
068     */
069    public void setSender(String sender)
070    {
071        this._sender = sender;
072    }
073
074    /**
075     * Get the subject of the mail
076     * @return the subject
077     */
078    public String getSubject()
079    {
080        return _subject;
081    }
082
083    /**
084     * Set the subject of the mail to a new value
085     * @param subject the subject to set
086     */
087    public void setSubject(String subject)
088    {
089        this._subject = subject;
090    }
091
092    /**
093     * Get the summary of the mail
094     * @return the summary
095     */
096    public String getSummary()
097    {
098        return _summary;
099    }
100
101    /**
102     * Set the content of the mail to a new summary
103     * @param summary the summary to set
104     */
105    public void setSummary(String summary)
106    {
107        this._summary = summary;
108    }
109
110    @Override
111    public String toString()
112    {
113        return "MailMessage [_subject=" + _subject + ", _sender=" + _sender + ", _summary=" + _summary + "]";
114    }
115
116}