📄 message.java
字号:
/*
* SSL-Explorer
*
* Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package com.sslexplorer.notification;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
public class Message {
private String subject;
private String content;
private List recipients;
private boolean urgent;
private long id;
private String sinkName;
private Properties parameters;
private String lastMessage;
/**
* @param subject
* @param content
* @param urgent
*/
public Message(String subject, String content, boolean urgent) {
this.subject = subject;
this.content = content;
this.urgent = urgent;
recipients = new ArrayList();
parameters = new Properties();
lastMessage = "";
}
/**
* @param subject
* @param content
* @param urgent
* @param recipient
*/
public Message(String subject, String content, boolean urgent, Recipient recipient) {
this(subject, content, urgent);
recipients.add(recipient);
}
/**
* @return Returns the id.
*/
public long getId() {
return id;
}
/**
* @param id The id to set.
*/
public void setId(long id) {
this.id = id;
}
/**
* Set a parameter. It will be up to the {@link com.sslexplorer.notification.MessageSink}
* to understand these parameters and deal with them accordingly.
*
* @param key parameter key
* @param value parameter value
*/
public void setParameter(String key, String value) {
parameters.setProperty(key, value);
}
/**
* Get a parameter. It will be up to the {@link com.sslexplorer.notification.MessageSink}
* to understand these parameters and deal with them accordingly.
*
* @param key parameter key
* @return value parameter value or <code>null</code> if no such parameter exists
*/
public String getParameter(String key) {
return parameters.getProperty(key);
}
/**
* Get a parameter. It will be up to the {@link com.sslexplorer.notification.MessageSink}
* to understand these parameters and deal with them accordingly.
*
* @param key parameter key
* @param default default value if no parameter exists
* @return value parameter value or <code>null</code> if no such parameter exists
*/
public String getParameter(String key, String defaultValue) {
return parameters.getProperty(key, defaultValue);
}
/**
* Get an {@link Iterator} of parameter names
*
* @return parameter names
*/
public Iterator getParameterNames() {
return parameters.keySet().iterator();
}
/**
* @return Returns the content.
*/
public String getContent() {
return content;
}
/**
* @param content The content to set.
*/
public void setContent(String content) {
this.content = content;
}
/**
* @return Returns the recipients.
*/
public List getRecipients() {
return recipients;
}
/**
* @param recipients The recipients to set.
*/
public void setRecipients(List recipients) {
this.recipients = recipients;
}
/**
* @return Returns the subject.
*/
public String getSubject() {
return subject;
}
/**
* @param subject The subject to set.
*/
public void setSubject(String subject) {
this.subject = subject;
}
/**
* @return Returns the urgent.
*/
public boolean isUrgent() {
return urgent;
}
/**
* @param urgent The urgent to set.
*/
public void setUrgent(boolean urgent) {
this.urgent = urgent;
}
public String getSinkName() {
return sinkName;
}
protected void setSinkName(String sinkName) {
this.sinkName = sinkName;
}
public String getLastMessage() {
return lastMessage;
}
public void setLastMessage(String lastMessage) {
this.lastMessage = lastMessage;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -