001/*
002 * SonarQube
003 * Copyright (C) 2009-2017 SonarSource SA
004 * mailto:info AT sonarsource DOT com
005 *
006 * This program is free software; you can redistribute it and/or
007 * modify it under the terms of the GNU Lesser General Public
008 * License as published by the Free Software Foundation; either
009 * version 3 of the License, or (at your option) any later version.
010 *
011 * This program is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 * Lesser General Public License for more details.
015 *
016 * You should have received a copy of the GNU Lesser General Public License
017 * along with this program; if not, write to the Free Software Foundation,
018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
019 */
020package org.sonar.plugins.emailnotifications.api;
021
022import org.apache.commons.lang.builder.ToStringBuilder;
023
024/**
025 * @since 2.10
026 */
027public class EmailMessage {
028
029  private String from;
030  private String to;
031  private String subject;
032  private String message;
033  private String messageId;
034
035  /**
036   * @param from full name of user, who initiated this message or null, if message was initiated by Sonar
037   */
038  public EmailMessage setFrom(String from) {
039    this.from = from;
040    return this;
041  }
042
043  /**
044   * @see #setFrom(String)
045   */
046  public String getFrom() {
047    return from;
048  }
049
050  /**
051   * @param to email address where to send this message
052   */
053  public EmailMessage setTo(String to) {
054    this.to = to;
055    return this;
056  }
057
058  /**
059   * @see #setTo(String)
060   */
061  public String getTo() {
062    return to;
063  }
064
065  /**
066   * @param subject message subject
067   */
068  public EmailMessage setSubject(String subject) {
069    this.subject = subject;
070    return this;
071  }
072
073  /**
074   * @see #setSubject(String)
075   */
076  public String getSubject() {
077    return subject;
078  }
079
080  /**
081   * @param message message body
082   */
083  public EmailMessage setMessage(String message) {
084    this.message = message;
085    return this;
086  }
087
088  /**
089   * @see #setMessage(String)
090   */
091  public String getMessage() {
092    return message;
093  }
094
095  /**
096   * @param messageId id of message for threading
097   */
098  public EmailMessage setMessageId(String messageId) {
099    this.messageId = messageId;
100    return this;
101  }
102
103  /**
104   * @see #setMessageId(String)
105   */
106  public String getMessageId() {
107    return messageId;
108  }
109
110  @Override
111  public String toString() {
112    return ToStringBuilder.reflectionToString(this);
113  }
114
115}