|
What this is
Other links
The source code/* * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/db/MessageBean.java,v 1.11 2005/01/18 11:52:18 minhnn Exp $ * $Author: minhnn $ * $Revision: 1.11 $ * $Date: 2005/01/18 11:52:18 $ * * ==================================================================== * * Copyright (C) 2002-2005 by MyVietnam.net * * 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 any later version. * * All copyright notices regarding mvnForum MUST remain intact * in the scripts and in the outputted HTML. * The "powered by" text/logo with a link back to * http://www.mvnForum.com and http://www.MyVietnam.net in the * footer of the pages MUST remain visible when the pages * are viewed on the internet or intranet. * * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * Support can be obtained from support forums at: * http://www.mvnForum.com/mvnforum/index * * Correspondence and Marketing Questions can be sent to: * info@MyVietnam.net * * @author: Minh Nguyen minhnn@MyVietnam.net * @author: Mai Nguyen mai.nh@MyVietnam.net */ package com.mvnforum.db; import java.sql.Timestamp; import java.util.Collection; import java.util.Iterator; import net.myvietnam.mvncore.util.StringUtil; /* * Included columns: MessageID, FolderName, MemberID, MessageSenderID, MessageSenderName, * MessageToList, MessageCcList, MessageBccList, MessageTopic, MessageBody, * MessageType, MessageOption, MessageStatus, MessageReadStatus, MessageNotify, * MessageIcon, MessageAttachCount, MessageIP, MessageCreationDate * Excluded columns: */ public class MessageBean { /************************************************************************* * NOTE: below constants MUST NOT be changed IN ALL CASES, * or it will break the compatibility *************************************************************************/ /** * The default value means this message has NOT been read */ public final static int MESSAGE_READ_STATUS_DEFAULT = 0; /** * This value means this message has been read */ public final static int MESSAGE_READ_STATUS_READ = 1; /** * The default value means this message type is normal */ public final static int MESSAGE_TYPE_DEFAULT = 0; /** * This value means this message has been mark as Quote [Marco] */ public final static int MESSAGE_TYPE_QUOTE = 1; /** * This value means this message is a public message */ public final static int MESSAGE_TYPE_PUBLIC = 2; private int messageID; private String folderName; private int memberID; private int messageSenderID; private String messageSenderName; private String messageToList; private String messageCcList; private String messageBccList; private String messageTopic; private String messageBody; private int messageType; private int messageOption; private int messageStatus; private int messageReadStatus; private int messageNotify; private String messageIcon; private int messageAttachCount; private String messageIP; private Timestamp messageCreationDate; public int getMessageID() { return messageID; } public void setMessageID(int messageID) { this.messageID = messageID; } public String getFolderName() { return folderName; } public void setFolderName(String folderName) { this.folderName = folderName; } public int getMemberID() { return memberID; } public void setMemberID(int memberID) { this.memberID = memberID; } public int getMessageSenderID() { return messageSenderID; } public void setMessageSenderID(int messageSenderID) { this.messageSenderID = messageSenderID; } public String getMessageSenderName() { return messageSenderName; } public void setMessageSenderName(String messageSenderName) { this.messageSenderName = messageSenderName; } public String getMessageToList() { return messageToList; } public void setMessageToList(String messageToList) { this.messageToList = StringUtil.getEmptyStringIfNull(messageToList); } public String getMessageCcList() { return messageCcList; } public void setMessageCcList(String messageCcList) { this.messageCcList = StringUtil.getEmptyStringIfNull(messageCcList); } public String getMessageBccList() { return messageBccList; } public void setMessageBccList(String messageBccList) { this.messageBccList = StringUtil.getEmptyStringIfNull(messageBccList); } public String getMessageTopic() { return messageTopic; } public void setMessageTopic(String messageTopic) { this.messageTopic = StringUtil.getEmptyStringIfNull(messageTopic); } public String getMessageBody() { return messageBody; } public void setMessageBody(String messageBody) { this.messageBody = StringUtil.getEmptyStringIfNull(messageBody); } public int getMessageType() { return messageType; } public void setMessageType(int messageType) { this.messageType = messageType; } public int getMessageOption() { return messageOption; } public void setMessageOption(int messageOption) { this.messageOption = messageOption; } public int getMessageStatus() { return messageStatus; } public void setMessageStatus(int messageStatus) { this.messageStatus = messageStatus; } public int getMessageReadStatus() { return messageReadStatus; } public void setMessageReadStatus(int messageReadStatus) { this.messageReadStatus = messageReadStatus; } public int getMessageNotify() { return messageNotify; } public void setMessageNotify(int messageNotify) { this.messageNotify = messageNotify; } public String getMessageIcon() { return messageIcon; } public void setMessageIcon(String messageIcon) { this.messageIcon = StringUtil.getEmptyStringIfNull(messageIcon); } public int getMessageAttachCount() { return messageAttachCount; } public void setMessageAttachCount(int messageAttachCount) { this.messageAttachCount = messageAttachCount; } public String getMessageIP() { return messageIP; } public void setMessageIP(String messageIP) { this.messageIP = messageIP; } public Timestamp getMessageCreationDate() { return messageCreationDate; } public void setMessageCreationDate(Timestamp messageCreationDate) { this.messageCreationDate = messageCreationDate; } public String getXML() { StringBuffer xml = new StringBuffer(1024); xml.append("<MessageSection>\n"); xml.append(" <Rows>\n"); xml.append(" <Row>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageID\n"); xml.append(" <Value>").append(String.valueOf(messageID)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>FolderName\n"); xml.append(" <Value>").append(String.valueOf(folderName)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MemberID\n"); xml.append(" <Value>").append(String.valueOf(memberID)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageSenderID\n"); xml.append(" <Value>").append(String.valueOf(messageSenderID)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageSenderName\n"); xml.append(" <Value>").append(String.valueOf(messageSenderName)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageToList\n"); xml.append(" <Value>").append(String.valueOf(messageToList)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageCcList\n"); xml.append(" <Value>").append(String.valueOf(messageCcList)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageBccList\n"); xml.append(" <Value>").append(String.valueOf(messageBccList)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageTopic\n"); xml.append(" <Value>").append(String.valueOf(messageTopic)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageBody\n"); xml.append(" <Value>").append(String.valueOf(messageBody)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageType\n"); xml.append(" <Value>").append(String.valueOf(messageType)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageOption\n"); xml.append(" <Value>").append(String.valueOf(messageOption)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageStatus\n"); xml.append(" <Value>").append(String.valueOf(messageStatus)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageReadStatus\n"); xml.append(" <Value>").append(String.valueOf(messageReadStatus)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageNotify\n"); xml.append(" <Value>").append(String.valueOf(messageNotify)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageIcon\n"); xml.append(" <Value>").append(String.valueOf(messageIcon)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageAttachCount\n"); xml.append(" <Value>").append(String.valueOf(messageAttachCount)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageIP\n"); xml.append(" <Value>").append(String.valueOf(messageIP)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageCreationDate\n"); xml.append(" <Value>").append(String.valueOf(messageCreationDate)).append("\n"); xml.append(" </Column>\n"); xml.append(" </Row>\n"); xml.append(" </Rows>\n"); xml.append("</MessageSection>\n"); return xml.toString(); } public static String getXML(Collection objMessageBeans) { StringBuffer xml = new StringBuffer(1024); Iterator iterator = objMessageBeans.iterator(); xml.append("<MessageSection>\n"); xml.append(" <Rows>\n"); while (iterator.hasNext()) { MessageBean objMessageBean = (MessageBean)iterator.next(); xml.append(" <Row>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageID\n"); xml.append(" <Value>").append(String.valueOf(objMessageBean.messageID)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>FolderName\n"); xml.append(" <Value>").append(String.valueOf(objMessageBean.folderName)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MemberID\n"); xml.append(" <Value>").append(String.valueOf(objMessageBean.memberID)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageSenderID\n"); xml.append(" <Value>").append(String.valueOf(objMessageBean.messageSenderID)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageSenderName\n"); xml.append(" <Value>").append(String.valueOf(objMessageBean.messageSenderName)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageToList\n"); xml.append(" <Value>").append(String.valueOf(objMessageBean.messageToList)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageCcList\n"); xml.append(" <Value>").append(String.valueOf(objMessageBean.messageCcList)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageBccList\n"); xml.append(" <Value>").append(String.valueOf(objMessageBean.messageBccList)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageTopic\n"); xml.append(" <Value>").append(String.valueOf(objMessageBean.messageTopic)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageBody\n"); xml.append(" <Value>").append(String.valueOf(objMessageBean.messageBody)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageType\n"); xml.append(" <Value>").append(String.valueOf(objMessageBean.messageType)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageOption\n"); xml.append(" <Value>").append(String.valueOf(objMessageBean.messageOption)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageStatus\n"); xml.append(" <Value>").append(String.valueOf(objMessageBean.messageStatus)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageReadStatus\n"); xml.append(" <Value>").append(String.valueOf(objMessageBean.messageReadStatus)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageNotify\n"); xml.append(" <Value>").append(String.valueOf(objMessageBean.messageNotify)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageIcon\n"); xml.append(" <Value>").append(String.valueOf(objMessageBean.messageIcon)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageAttachCount\n"); xml.append(" <Value>").append(String.valueOf(objMessageBean.messageAttachCount)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageIP\n"); xml.append(" <Value>").append(String.valueOf(objMessageBean.messageIP)).append("\n"); xml.append(" </Column>\n"); xml.append(" <Column>\n"); xml.append(" <Name>MessageCreationDate\n"); xml.append(" <Value>").append(String.valueOf(objMessageBean.messageCreationDate)).append("\n"); xml.append(" </Column>\n"); xml.append(" </Row>\n"); }//while xml.append(" </Rows>\n"); xml.append("</MessageSection>\n"); return xml.toString(); } /************************************************ * Customized methods come below ************************************************/ private MemberBean memberBean = null; private Collection attachmentBeans = null; public MemberBean getMemberBean() { return memberBean; } public void setMemberBean(MemberBean memberBean) { this.memberBean = memberBean; } public Collection getAttachmentBeans() { return attachmentBeans; } public void setAttachmentBeans(Collection attachmentBeans) { this.attachmentBeans = attachmentBeans; } } //end of class MessageBean |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.