1 41 package com.mvnforum.db; 42 43 import java.sql.Timestamp ; 44 import java.util.Collection ; 45 import java.util.Iterator ; 46 47 import net.myvietnam.mvncore.util.StringUtil; 48 49 56 public class MessageBean { 57 61 64 public final static int MESSAGE_READ_STATUS_DEFAULT = 0; 65 66 69 public final static int MESSAGE_READ_STATUS_READ = 1; 70 71 74 public final static int MESSAGE_TYPE_DEFAULT = 0; 75 76 79 public final static int MESSAGE_TYPE_QUOTE = 1; 80 81 84 public final static int MESSAGE_TYPE_PUBLIC = 2; 85 86 private int messageID; 87 private String folderName; 88 private int memberID; 89 private int messageSenderID; 90 private String messageSenderName; 91 private String messageToList; 92 private String messageCcList; 93 private String messageBccList; 94 private String messageTopic; 95 private String messageBody; 96 private int messageType; 97 private int messageOption; 98 private int messageStatus; 99 private int messageReadStatus; 100 private int messageNotify; 101 private String messageIcon; 102 private int messageAttachCount; 103 private String messageIP; 104 private Timestamp messageCreationDate; 105 106 public int getMessageID() { 107 return messageID; 108 } 109 public void setMessageID(int messageID) { 110 this.messageID = messageID; 111 } 112 113 public String getFolderName() { 114 return folderName; 115 } 116 public void setFolderName(String folderName) { 117 this.folderName = folderName; 118 } 119 120 public int getMemberID() { 121 return memberID; 122 } 123 public void setMemberID(int memberID) { 124 this.memberID = memberID; 125 } 126 127 public int getMessageSenderID() { 128 return messageSenderID; 129 } 130 public void setMessageSenderID(int messageSenderID) { 131 this.messageSenderID = messageSenderID; 132 } 133 134 public String getMessageSenderName() { 135 return messageSenderName; 136 } 137 public void setMessageSenderName(String messageSenderName) { 138 this.messageSenderName = messageSenderName; 139 } 140 141 public String getMessageToList() { 142 return messageToList; 143 } 144 public void setMessageToList(String messageToList) { 145 this.messageToList = StringUtil.getEmptyStringIfNull(messageToList); 146 } 147 148 public String getMessageCcList() { 149 return messageCcList; 150 } 151 public void setMessageCcList(String messageCcList) { 152 this.messageCcList = StringUtil.getEmptyStringIfNull(messageCcList); 153 } 154 155 public String getMessageBccList() { 156 return messageBccList; 157 } 158 public void setMessageBccList(String messageBccList) { 159 this.messageBccList = StringUtil.getEmptyStringIfNull(messageBccList); 160 } 161 162 public String getMessageTopic() { 163 return messageTopic; 164 } 165 public void setMessageTopic(String messageTopic) { 166 this.messageTopic = StringUtil.getEmptyStringIfNull(messageTopic); 167 } 168 169 public String getMessageBody() { 170 return messageBody; 171 } 172 public void setMessageBody(String messageBody) { 173 this.messageBody = StringUtil.getEmptyStringIfNull(messageBody); 174 } 175 176 public int getMessageType() { 177 return messageType; 178 } 179 public void setMessageType(int messageType) { 180 this.messageType = messageType; 181 } 182 183 public int getMessageOption() { 184 return messageOption; 185 } 186 public void setMessageOption(int messageOption) { 187 this.messageOption = messageOption; 188 } 189 190 public int getMessageStatus() { 191 return messageStatus; 192 } 193 public void setMessageStatus(int messageStatus) { 194 this.messageStatus = messageStatus; 195 } 196 197 public int getMessageReadStatus() { 198 return messageReadStatus; 199 } 200 public void setMessageReadStatus(int messageReadStatus) { 201 this.messageReadStatus = messageReadStatus; 202 } 203 204 public int getMessageNotify() { 205 return messageNotify; 206 } 207 public void setMessageNotify(int messageNotify) { 208 this.messageNotify = messageNotify; 209 } 210 211 public String getMessageIcon() { 212 return messageIcon; 213 } 214 public void setMessageIcon(String messageIcon) { 215 this.messageIcon = StringUtil.getEmptyStringIfNull(messageIcon); 216 } 217 218 public int getMessageAttachCount() { 219 return messageAttachCount; 220 } 221 public void setMessageAttachCount(int messageAttachCount) { 222 this.messageAttachCount = messageAttachCount; 223 } 224 225 public String getMessageIP() { 226 return messageIP; 227 } 228 public void setMessageIP(String messageIP) { 229 this.messageIP = messageIP; 230 } 231 232 public Timestamp getMessageCreationDate() { 233 return messageCreationDate; 234 } 235 public void setMessageCreationDate(Timestamp messageCreationDate) { 236 this.messageCreationDate = messageCreationDate; 237 } 238 239 public String getXML() { 240 StringBuffer xml = new StringBuffer (1024); 241 xml.append("<MessageSection>\n"); 242 xml.append(" <Rows>\n"); 243 xml.append(" <Row>\n"); 244 xml.append(" <Column>\n"); 245 xml.append(" <Name>MessageID</Name>\n"); 246 xml.append(" <Value>").append(String.valueOf(messageID)).append("</Value>\n"); 247 xml.append(" </Column>\n"); 248 xml.append(" <Column>\n"); 249 xml.append(" <Name>FolderName</Name>\n"); 250 xml.append(" <Value>").append(String.valueOf(folderName)).append("</Value>\n"); 251 xml.append(" </Column>\n"); 252 xml.append(" <Column>\n"); 253 xml.append(" <Name>MemberID</Name>\n"); 254 xml.append(" <Value>").append(String.valueOf(memberID)).append("</Value>\n"); 255 xml.append(" </Column>\n"); 256 xml.append(" <Column>\n"); 257 xml.append(" <Name>MessageSenderID</Name>\n"); 258 xml.append(" <Value>").append(String.valueOf(messageSenderID)).append("</Value>\n"); 259 xml.append(" </Column>\n"); 260 xml.append(" <Column>\n"); 261 xml.append(" <Name>MessageSenderName</Name>\n"); 262 xml.append(" <Value>").append(String.valueOf(messageSenderName)).append("</Value>\n"); 263 xml.append(" </Column>\n"); 264 xml.append(" <Column>\n"); 265 xml.append(" <Name>MessageToList</Name>\n"); 266 xml.append(" <Value>").append(String.valueOf(messageToList)).append("</Value>\n"); 267 xml.append(" </Column>\n"); 268 xml.append(" <Column>\n"); 269 xml.append(" <Name>MessageCcList</Name>\n"); 270 xml.append(" <Value>").append(String.valueOf(messageCcList)).append("</Value>\n"); 271 xml.append(" </Column>\n"); 272 xml.append(" <Column>\n"); 273 xml.append(" <Name>MessageBccList</Name>\n"); 274 xml.append(" <Value>").append(String.valueOf(messageBccList)).append("</Value>\n"); 275 xml.append(" </Column>\n"); 276 xml.append(" <Column>\n"); 277 xml.append(" <Name>MessageTopic</Name>\n"); 278 xml.append(" <Value>").append(String.valueOf(messageTopic)).append("</Value>\n"); 279 xml.append(" </Column>\n"); 280 xml.append(" <Column>\n"); 281 xml.append(" <Name>MessageBody</Name>\n"); 282 xml.append(" <Value>").append(String.valueOf(messageBody)).append("</Value>\n"); 283 xml.append(" </Column>\n"); 284 xml.append(" <Column>\n"); 285 xml.append(" <Name>MessageType</Name>\n"); 286 xml.append(" <Value>").append(String.valueOf(messageType)).append("</Value>\n"); 287 xml.append(" </Column>\n"); 288 xml.append(" <Column>\n"); 289 xml.append(" <Name>MessageOption</Name>\n"); 290 xml.append(" <Value>").append(String.valueOf(messageOption)).append("</Value>\n"); 291 xml.append(" </Column>\n"); 292 xml.append(" <Column>\n"); 293 xml.append(" <Name>MessageStatus</Name>\n"); 294 xml.append(" <Value>").append(String.valueOf(messageStatus)).append("</Value>\n"); 295 xml.append(" </Column>\n"); 296 xml.append(" <Column>\n"); 297 xml.append(" <Name>MessageReadStatus</Name>\n"); 298 xml.append(" <Value>").append(String.valueOf(messageReadStatus)).append("</Value>\n"); 299 xml.append(" </Column>\n"); 300 xml.append(" <Column>\n"); 301 xml.append(" <Name>MessageNotify</Name>\n"); 302 xml.append(" <Value>").append(String.valueOf(messageNotify)).append("</Value>\n"); 303 xml.append(" </Column>\n"); 304 xml.append(" <Column>\n"); 305 xml.append(" <Name>MessageIcon</Name>\n"); 306 xml.append(" <Value>").append(String.valueOf(messageIcon)).append("</Value>\n"); 307 xml.append(" </Column>\n"); 308 xml.append(" <Column>\n"); 309 xml.append(" <Name>MessageAttachCount</Name>\n"); 310 xml.append(" <Value>").append(String.valueOf(messageAttachCount)).append("</Value>\n"); 311 xml.append(" </Column>\n"); 312 xml.append(" <Column>\n"); 313 xml.append(" <Name>MessageIP</Name>\n"); 314 xml.append(" <Value>").append(String.valueOf(messageIP)).append("</Value>\n"); 315 xml.append(" </Column>\n"); 316 xml.append(" <Column>\n"); 317 xml.append(" <Name>MessageCreationDate</Name>\n"); 318 xml.append(" <Value>").append(String.valueOf(messageCreationDate)).append("</Value>\n"); 319 xml.append(" </Column>\n"); 320 xml.append(" </Row>\n"); 321 xml.append(" </Rows>\n"); 322 xml.append("</MessageSection>\n"); 323 return xml.toString(); 324 } 325 326 public static String getXML(Collection objMessageBeans) { 327 StringBuffer xml = new StringBuffer (1024); 328 Iterator iterator = objMessageBeans.iterator(); 329 xml.append("<MessageSection>\n"); 330 xml.append(" <Rows>\n"); 331 while (iterator.hasNext()) { 332 MessageBean objMessageBean = (MessageBean)iterator.next(); 333 xml.append(" <Row>\n"); 334 xml.append(" <Column>\n"); 335 xml.append(" <Name>MessageID</Name>\n"); 336 xml.append(" <Value>").append(String.valueOf(objMessageBean.messageID)).append("</Value>\n"); 337 xml.append(" </Column>\n"); 338 xml.append(" <Column>\n"); 339 xml.append(" <Name>FolderName</Name>\n"); 340 xml.append(" <Value>").append(String.valueOf(objMessageBean.folderName)).append("</Value>\n"); 341 xml.append(" </Column>\n"); 342 xml.append(" <Column>\n"); 343 xml.append(" <Name>MemberID</Name>\n"); 344 xml.append(" <Value>").append(String.valueOf(objMessageBean.memberID)).append("</Value>\n"); 345 xml.append(" </Column>\n"); 346 xml.append(" <Column>\n"); 347 xml.append(" <Name>MessageSenderID</Name>\n"); 348 xml.append(" <Value>").append(String.valueOf(objMessageBean.messageSenderID)).append("</Value>\n"); 349 xml.append(" </Column>\n"); 350 xml.append(" <Column>\n"); 351 xml.append(" <Name>MessageSenderName</Name>\n"); 352 xml.append(" <Value>").append(String.valueOf(objMessageBean.messageSenderName)).append("</Value>\n"); 353 xml.append(" </Column>\n"); 354 xml.append(" <Column>\n"); 355 xml.append(" <Name>MessageToList</Name>\n"); 356 xml.append(" <Value>").append(String.valueOf(objMessageBean.messageToList)).append("</Value>\n"); 357 xml.append(" </Column>\n"); 358 xml.append(" <Column>\n"); 359 xml.append(" <Name>MessageCcList</Name>\n"); 360 xml.append(" <Value>").append(String.valueOf(objMessageBean.messageCcList)).append("</Value>\n"); 361 xml.append(" </Column>\n"); 362 xml.append(" <Column>\n"); 363 xml.append(" <Name>MessageBccList</Name>\n"); 364 xml.append(" <Value>").append(String.valueOf(objMessageBean.messageBccList)).append("</Value>\n"); 365 xml.append(" </Column>\n"); 366 xml.append(" <Column>\n"); 367 xml.append(" <Name>MessageTopic</Name>\n"); 368 xml.append(" <Value>").append(String.valueOf(objMessageBean.messageTopic)).append("</Value>\n"); 369 xml.append(" </Column>\n"); 370 xml.append(" <Column>\n"); 371 xml.append(" <Name>MessageBody</Name>\n"); 372 xml.append(" <Value>").append(String.valueOf(objMessageBean.messageBody)).append("</Value>\n"); 373 xml.append(" </Column>\n"); 374 xml.append(" <Column>\n"); 375 xml.append(" <Name>MessageType</Name>\n"); 376 xml.append(" <Value>").append(String.valueOf(objMessageBean.messageType)).append("</Value>\n"); 377 xml.append(" </Column>\n"); 378 xml.append(" <Column>\n"); 379 xml.append(" <Name>MessageOption</Name>\n"); 380 xml.append(" <Value>").append(String.valueOf(objMessageBean.messageOption)).append("</Value>\n"); 381 xml.append(" </Column>\n"); 382 xml.append(" <Column>\n"); 383 xml.append(" <Name>MessageStatus</Name>\n"); 384 xml.append(" <Value>").append(String.valueOf(objMessageBean.messageStatus)).append("</Value>\n"); 385 xml.append(" </Column>\n"); 386 xml.append(" <Column>\n"); 387 xml.append(" <Name>MessageReadStatus</Name>\n"); 388 xml.append(" <Value>").append(String.valueOf(objMessageBean.messageReadStatus)).append("</Value>\n"); 389 xml.append(" </Column>\n"); 390 xml.append(" <Column>\n"); 391 xml.append(" <Name>MessageNotify</Name>\n"); 392 xml.append(" <Value>").append(String.valueOf(objMessageBean.messageNotify)).append("</Value>\n"); 393 xml.append(" </Column>\n"); 394 xml.append(" <Column>\n"); 395 xml.append(" <Name>MessageIcon</Name>\n"); 396 xml.append(" <Value>").append(String.valueOf(objMessageBean.messageIcon)).append("</Value>\n"); 397 xml.append(" </Column>\n"); 398 xml.append(" <Column>\n"); 399 xml.append(" <Name>MessageAttachCount</Name>\n"); 400 xml.append(" <Value>").append(String.valueOf(objMessageBean.messageAttachCount)).append("</Value>\n"); 401 xml.append(" </Column>\n"); 402 xml.append(" <Column>\n"); 403 xml.append(" <Name>MessageIP</Name>\n"); 404 xml.append(" <Value>").append(String.valueOf(objMessageBean.messageIP)).append("</Value>\n"); 405 xml.append(" </Column>\n"); 406 xml.append(" <Column>\n"); 407 xml.append(" <Name>MessageCreationDate</Name>\n"); 408 xml.append(" <Value>").append(String.valueOf(objMessageBean.messageCreationDate)).append("</Value>\n"); 409 xml.append(" </Column>\n"); 410 xml.append(" </Row>\n"); 411 } xml.append(" </Rows>\n"); 413 xml.append("</MessageSection>\n"); 414 return xml.toString(); 415 } 416 419 private MemberBean memberBean = null; 420 private Collection attachmentBeans = null; 421 422 public MemberBean getMemberBean() { 423 return memberBean; 424 } 425 public void setMemberBean(MemberBean memberBean) { 426 this.memberBean = memberBean; 427 } 428 429 public Collection getAttachmentBeans() { 430 return attachmentBeans; 431 } 432 public void setAttachmentBeans(Collection attachmentBeans) { 433 this.attachmentBeans = attachmentBeans; 434 } 435 436 } | Popular Tags |