From eb174b1d9f87ee03a75c09402b9ec1348059eb65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BF=9C=E6=96=B9=E5=A4=95=E9=98=B3?= Date: Mon, 20 Jun 2016 11:06:19 +0800 Subject: [PATCH] Update Message.java --- .../cim/sdk/server/model/Message.java | 408 +++++++++--------- 1 file changed, 204 insertions(+), 204 deletions(-) diff --git a/cim_for_mina/cim-server-sdk/src/com/farsunset/cim/sdk/server/model/Message.java b/cim_for_mina/cim-server-sdk/src/com/farsunset/cim/sdk/server/model/Message.java index 166b73a..c0d0108 100644 --- a/cim_for_mina/cim-server-sdk/src/com/farsunset/cim/sdk/server/model/Message.java +++ b/cim_for_mina/cim-server-sdk/src/com/farsunset/cim/sdk/server/model/Message.java @@ -1,204 +1,204 @@ -/** - * probject:cim-server-sdk - * @version 2.0.0 - * - * @author 3979434@qq.com - */ -package com.farsunset.cim.sdk.server.model; - -import java.io.Serializable; -/** - * 消息对象 - */ -public class Message implements Serializable { - - private static final long serialVersionUID = 1L; - - - /** - * 消息类型,用户自定义消息类别 - */ - private String mid; - - - /** - * 消息类型,用户自定义消息类别 - */ - private String type; - /** - * 消息标题 - */ - private String title; - /** - * 消息类容,于type 组合为任何类型消息,content 根据 format 可表示为 text,json ,xml数据格式 - */ - private String content; - - /** - * 消息发送者账号 - */ - private String sender; - /** - * 消息发送者接收者 - */ - private String receiver; - - /** - * 文件 url - */ - private String file; - /** - * 文件类型 - */ - private String fileType; - - /** - * content 内容格式 - */ - private String format = "txt"; - - - private long timestamp; - - - public Message() - { - timestamp = System.currentTimeMillis(); - } - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public String getSender() { - return sender; - } - - public void setSender(String sender) { - this.sender = sender; - } - - public String getReceiver() { - return receiver; - } - - public void setReceiver(String receiver) { - this.receiver = receiver; - } - - public String getFile() { - return file; - } - - public void setFile(String file) { - this.file = file; - } - - public String getFileType() { - return fileType; - } - - public void setFileType(String fileType) { - this.fileType = fileType; - } - - public String getFormat() { - return format; - } - - public void setFormat(String format) { - this.format = format; - } - - public String toString() { - - StringBuffer buffer = new StringBuffer(); - buffer.append(""); - buffer.append(""); - buffer.append("").append(mid).append(""); - - if (isNotEmpty(type)) { - buffer.append("").append(type).append(""); - } - - if (isNotEmpty(title)) { - buffer.append("").append(title).append(""); - } - if (isNotEmpty(content)) { - buffer.append(""); - } - - if (isNotEmpty(file)) { - buffer.append("").append(file).append(""); - } - - if (isNotEmpty(fileType)) { - buffer.append("").append(fileType).append(""); - } - - if (isNotEmpty(sender)) { - buffer.append("").append(sender).append(""); - } - - if (isNotEmpty(receiver)) { - buffer.append("").append(receiver).append(""); - } - - if (isNotEmpty(format)) { - buffer.append("").append(format).append(""); - } - - if (timestamp > 0) { - buffer.append("").append(timestamp).append(""); - } - - buffer.append(""); - return buffer.toString(); - } - - public String toXmlString() { - - return toString(); - } - - public String getMid() { - return mid; - } - - public void setMid(String mid) { - this.mid = mid; - } - - public boolean isNotEmpty(String txt) { - return txt != null && !txt.isEmpty(); - } - - -} +/** + * probject:cim-server-sdk + * @version 2.0.0 + * + * @author 3979434@qq.com + */ +package com.farsunset.cim.sdk.server.model; + +import java.io.Serializable; +/** + * 消息对象 + */ +public class Message implements Serializable { + + private static final long serialVersionUID = 1L; + + + /** + * 消息类型,用户自定义消息类别 + */ + private String mid; + + + /** + * 消息类型,用户自定义消息类别 + */ + private String type; + /** + * 消息标题 + */ + private String title; + /** + * 消息类容,于type 组合为任何类型消息,content 根据 format 可表示为 text,json ,xml数据格式 + */ + private String content; + + /** + * 消息发送者账号 + */ + private String sender; + /** + * 消息发送者接收者 + */ + private String receiver; + + /** + * 文件 url + */ + private String file; + /** + * 文件类型 + */ + private String fileType; + + /** + * content 内容格式 + */ + private String format = "txt"; + + + private long timestamp; + + + public Message() + { + timestamp = System.currentTimeMillis(); + } + public long getTimestamp() { + return timestamp; + } + + public void setTimestamp(long timestamp) { + this.timestamp = timestamp; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getSender() { + return sender; + } + + public void setSender(String sender) { + this.sender = sender; + } + + public String getReceiver() { + return receiver; + } + + public void setReceiver(String receiver) { + this.receiver = receiver; + } + + public String getFile() { + return file; + } + + public void setFile(String file) { + this.file = file; + } + + public String getFileType() { + return fileType; + } + + public void setFileType(String fileType) { + this.fileType = fileType; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public String toString() { + + StringBuffer buffer = new StringBuffer(); + buffer.append(""); + buffer.append(""); + buffer.append("").append(mid).append(""); + + if (isNotEmpty(type)) { + buffer.append("").append(type).append(""); + } + + if (isNotEmpty(title)) { + buffer.append("").append(title).append(""); + } + if (isNotEmpty(content)) { + buffer.append(""); + } + + if (isNotEmpty(file)) { + buffer.append("").append(file).append(""); + } + + if (isNotEmpty(fileType)) { + buffer.append("").append(fileType).append(""); + } + + if (isNotEmpty(sender)) { + buffer.append("").append(sender).append(""); + } + + if (isNotEmpty(receiver)) { + buffer.append("").append(receiver).append(""); + } + + if (isNotEmpty(format)) { + buffer.append("").append(format).append(""); + } + + if (timestamp > 0) { + buffer.append("").append(timestamp).append(""); + } + + buffer.append(""); + return buffer.toString(); + } + + public String toXmlString() { + + return toString(); + } + + public String getMid() { + return mid; + } + + public void setMid(String mid) { + this.mid = mid; + } + + public boolean isNotEmpty(String txt) { + return txt != null && txt.trim().length()>0; + } + + +} \ No newline at end of file