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 PostBean { 57 61 64 public final static int POST_STATUS_DEFAULT = 0; 65 66 69 public final static int POST_STATUS_DISABLED = 1; 70 71 private int postID; 72 private int parentPostID; 73 private int forumID; 74 private int threadID; 75 private int memberID; 76 private String memberName; 77 private String lastEditMemberName; 78 private String postTopic; 79 private String postBody; 80 private Timestamp postCreationDate; 81 private Timestamp postLastEditDate; 82 private String postCreationIP; 83 private String postLastEditIP; 84 private int postEditCount; 85 private int postFormatOption; 86 private int postOption; 87 private int postStatus; 88 private String postIcon; 89 private int postAttachCount; 90 91 public int getPostID() { 92 return postID; 93 } 94 public void setPostID(int postID) { 95 this.postID = postID; 96 } 97 98 public int getParentPostID() { 99 return parentPostID; 100 } 101 public void setParentPostID(int parentPostID) { 102 this.parentPostID = parentPostID; 103 } 104 105 public int getForumID() { 106 return forumID; 107 } 108 public void setForumID(int forumID) { 109 this.forumID = forumID; 110 } 111 112 public int getThreadID() { 113 return threadID; 114 } 115 public void setThreadID(int threadID) { 116 this.threadID = threadID; 117 } 118 119 public int getMemberID() { 120 return memberID; 121 } 122 public void setMemberID(int memberID) { 123 this.memberID = memberID; 124 } 125 126 public String getMemberName() { 127 return memberName; 128 } 129 public void setMemberName(String memberName) { 130 this.memberName = memberName; 131 } 132 133 public String getLastEditMemberName() { 134 return lastEditMemberName; 135 } 136 public void setLastEditMemberName(String lastEditMemberName) { 137 this.lastEditMemberName = StringUtil.getEmptyStringIfNull(lastEditMemberName); 138 } 139 140 public String getPostTopic() { 141 return postTopic; 142 } 143 public void setPostTopic(String postTopic) { 144 this.postTopic = postTopic; 145 } 146 147 public String getPostBody() { 148 return postBody; 149 } 150 public void setPostBody(String postBody) { 151 this.postBody = postBody; 152 } 153 154 public Timestamp getPostCreationDate() { 155 return postCreationDate; 156 } 157 public void setPostCreationDate(Timestamp postCreationDate) { 158 this.postCreationDate = postCreationDate; 159 } 160 161 public Timestamp getPostLastEditDate() { 162 return postLastEditDate; 163 } 164 public void setPostLastEditDate(Timestamp postLastEditDate) { 165 this.postLastEditDate = postLastEditDate; 166 } 167 168 public String getPostCreationIP() { 169 return postCreationIP; 170 } 171 public void setPostCreationIP(String postCreationIP) { 172 this.postCreationIP = postCreationIP; 173 } 174 175 public String getPostLastEditIP() { 176 return postLastEditIP; 177 } 178 public void setPostLastEditIP(String postLastEditIP) { 179 this.postLastEditIP = StringUtil.getEmptyStringIfNull(postLastEditIP); 180 } 181 182 public int getPostEditCount() { 183 return postEditCount; 184 } 185 public void setPostEditCount(int postEditCount) { 186 this.postEditCount = postEditCount; 187 } 188 189 public int getPostFormatOption() { 190 return postFormatOption; 191 } 192 public void setPostFormatOption(int postFormatOption) { 193 this.postFormatOption = postFormatOption; 194 } 195 196 public int getPostOption() { 197 return postOption; 198 } 199 public void setPostOption(int postOption) { 200 this.postOption = postOption; 201 } 202 203 public int getPostStatus() { 204 return postStatus; 205 } 206 public void setPostStatus(int postStatus) { 207 this.postStatus = postStatus; 208 } 209 210 public String getPostIcon() { 211 return postIcon; 212 } 213 public void setPostIcon(String postIcon) { 214 this.postIcon = StringUtil.getEmptyStringIfNull(postIcon); 215 } 216 217 public int getPostAttachCount() { 218 return postAttachCount; 219 } 220 public void setPostAttachCount(int postAttachCount) { 221 this.postAttachCount = postAttachCount; 222 } 223 224 public String getXMLTag() { 225 StringBuffer xml = new StringBuffer (1024); 226 xml.append("<Post"); 227 xml.append(" postID=\"").append(String.valueOf(postID)).append("\""); 228 xml.append(" parentPostID=\"").append(String.valueOf(parentPostID)).append("\""); 229 xml.append(" forumID=\"").append(String.valueOf(forumID)).append("\""); 230 xml.append(" threadID=\"").append(String.valueOf(threadID)).append("\""); 231 xml.append(" memberID=\"").append(String.valueOf(memberID)).append("\""); 232 xml.append(" memberName=\"").append(String.valueOf(memberName)).append("\""); 233 xml.append(" lastEditMemberName=\"").append(String.valueOf(lastEditMemberName)).append("\""); 234 xml.append(" postTopic=\"").append(String.valueOf(postTopic)).append("\""); 235 xml.append(" postBody=\"").append(String.valueOf(postBody)).append("\""); 236 xml.append(" postCreationDate=\"").append(String.valueOf(postCreationDate)).append("\""); 237 xml.append(" postLastEditDate=\"").append(String.valueOf(postLastEditDate)).append("\""); 238 xml.append(" postCreationIP=\"").append(String.valueOf(postCreationIP)).append("\""); 239 xml.append(" postLastEditIP=\"").append(String.valueOf(postLastEditIP)).append("\""); 240 xml.append(" postEditCount=\"").append(String.valueOf(postEditCount)).append("\""); 241 xml.append(" postFormatOption=\"").append(String.valueOf(postFormatOption)).append("\""); 242 xml.append(" postOption=\"").append(String.valueOf(postOption)).append("\""); 243 xml.append(" postStatus=\"").append(String.valueOf(postStatus)).append("\""); 244 xml.append(" postIcon=\"").append(String.valueOf(postIcon)).append("\""); 245 xml.append(" postAttachCount=\"").append(String.valueOf(postAttachCount)).append("\""); 246 xml.append(">"); 247 return xml.toString(); 248 } 249 250 public String getXML() { 251 StringBuffer xml = new StringBuffer (1024); 252 xml.append("<PostSection>\n"); 253 xml.append(" <Rows>\n"); 254 xml.append(" <Row>\n"); 255 xml.append(" <Column>\n"); 256 xml.append(" <Name>PostID</Name>\n"); 257 xml.append(" <Value>").append(String.valueOf(postID)).append("</Value>\n"); 258 xml.append(" </Column>\n"); 259 xml.append(" <Column>\n"); 260 xml.append(" <Name>ParentPostID</Name>\n"); 261 xml.append(" <Value>").append(String.valueOf(parentPostID)).append("</Value>\n"); 262 xml.append(" </Column>\n"); 263 xml.append(" <Column>\n"); 264 xml.append(" <Name>ForumID</Name>\n"); 265 xml.append(" <Value>").append(String.valueOf(forumID)).append("</Value>\n"); 266 xml.append(" </Column>\n"); 267 xml.append(" <Column>\n"); 268 xml.append(" <Name>ThreadID</Name>\n"); 269 xml.append(" <Value>").append(String.valueOf(threadID)).append("</Value>\n"); 270 xml.append(" </Column>\n"); 271 xml.append(" <Column>\n"); 272 xml.append(" <Name>MemberID</Name>\n"); 273 xml.append(" <Value>").append(String.valueOf(memberID)).append("</Value>\n"); 274 xml.append(" </Column>\n"); 275 xml.append(" <Column>\n"); 276 xml.append(" <Name>MemberName</Name>\n"); 277 xml.append(" <Value>").append(String.valueOf(memberName)).append("</Value>\n"); 278 xml.append(" </Column>\n"); 279 xml.append(" <Column>\n"); 280 xml.append(" <Name>LastEditMemberName</Name>\n"); 281 xml.append(" <Value>").append(String.valueOf(lastEditMemberName)).append("</Value>\n"); 282 xml.append(" </Column>\n"); 283 xml.append(" <Column>\n"); 284 xml.append(" <Name>PostTopic</Name>\n"); 285 xml.append(" <Value>").append(String.valueOf(postTopic)).append("</Value>\n"); 286 xml.append(" </Column>\n"); 287 xml.append(" <Column>\n"); 288 xml.append(" <Name>PostBody</Name>\n"); 289 xml.append(" <Value>").append(String.valueOf(postBody)).append("</Value>\n"); 290 xml.append(" </Column>\n"); 291 xml.append(" <Column>\n"); 292 xml.append(" <Name>PostCreationDate</Name>\n"); 293 xml.append(" <Value>").append(String.valueOf(postCreationDate)).append("</Value>\n"); 294 xml.append(" </Column>\n"); 295 xml.append(" <Column>\n"); 296 xml.append(" <Name>PostLastEditDate</Name>\n"); 297 xml.append(" <Value>").append(String.valueOf(postLastEditDate)).append("</Value>\n"); 298 xml.append(" </Column>\n"); 299 xml.append(" <Column>\n"); 300 xml.append(" <Name>PostCreationIP</Name>\n"); 301 xml.append(" <Value>").append(String.valueOf(postCreationIP)).append("</Value>\n"); 302 xml.append(" </Column>\n"); 303 xml.append(" <Column>\n"); 304 xml.append(" <Name>PostLastEditIP</Name>\n"); 305 xml.append(" <Value>").append(String.valueOf(postLastEditIP)).append("</Value>\n"); 306 xml.append(" </Column>\n"); 307 xml.append(" <Column>\n"); 308 xml.append(" <Name>PostEditCount</Name>\n"); 309 xml.append(" <Value>").append(String.valueOf(postEditCount)).append("</Value>\n"); 310 xml.append(" </Column>\n"); 311 xml.append(" <Column>\n"); 312 xml.append(" <Name>PostFormatOption</Name>\n"); 313 xml.append(" <Value>").append(String.valueOf(postFormatOption)).append("</Value>\n"); 314 xml.append(" </Column>\n"); 315 xml.append(" <Column>\n"); 316 xml.append(" <Name>PostOption</Name>\n"); 317 xml.append(" <Value>").append(String.valueOf(postOption)).append("</Value>\n"); 318 xml.append(" </Column>\n"); 319 xml.append(" <Column>\n"); 320 xml.append(" <Name>PostStatus</Name>\n"); 321 xml.append(" <Value>").append(String.valueOf(postStatus)).append("</Value>\n"); 322 xml.append(" </Column>\n"); 323 xml.append(" <Column>\n"); 324 xml.append(" <Name>PostIcon</Name>\n"); 325 xml.append(" <Value>").append(String.valueOf(postIcon)).append("</Value>\n"); 326 xml.append(" </Column>\n"); 327 xml.append(" <Column>\n"); 328 xml.append(" <Name>PostAttachCount</Name>\n"); 329 xml.append(" <Value>").append(String.valueOf(postAttachCount)).append("</Value>\n"); 330 xml.append(" </Column>\n"); 331 xml.append(" </Row>\n"); 332 xml.append(" </Rows>\n"); 333 xml.append("</PostSection>\n"); 334 return xml.toString(); 335 } 336 337 public static String getXML(Collection objPostBeans) { 338 StringBuffer xml = new StringBuffer (1024); 339 Iterator iterator = objPostBeans.iterator(); 340 xml.append("<PostSection>\n"); 341 xml.append(" <Rows>\n"); 342 while (iterator.hasNext()) { 343 PostBean objPostBean = (PostBean)iterator.next(); 344 xml.append(" <Row>\n"); 345 xml.append(" <Column>\n"); 346 xml.append(" <Name>PostID</Name>\n"); 347 xml.append(" <Value>").append(String.valueOf(objPostBean.postID)).append("</Value>\n"); 348 xml.append(" </Column>\n"); 349 xml.append(" <Column>\n"); 350 xml.append(" <Name>ParentPostID</Name>\n"); 351 xml.append(" <Value>").append(String.valueOf(objPostBean.parentPostID)).append("</Value>\n"); 352 xml.append(" </Column>\n"); 353 xml.append(" <Column>\n"); 354 xml.append(" <Name>ForumID</Name>\n"); 355 xml.append(" <Value>").append(String.valueOf(objPostBean.forumID)).append("</Value>\n"); 356 xml.append(" </Column>\n"); 357 xml.append(" <Column>\n"); 358 xml.append(" <Name>ThreadID</Name>\n"); 359 xml.append(" <Value>").append(String.valueOf(objPostBean.threadID)).append("</Value>\n"); 360 xml.append(" </Column>\n"); 361 xml.append(" <Column>\n"); 362 xml.append(" <Name>MemberID</Name>\n"); 363 xml.append(" <Value>").append(String.valueOf(objPostBean.memberID)).append("</Value>\n"); 364 xml.append(" </Column>\n"); 365 xml.append(" <Column>\n"); 366 xml.append(" <Name>MemberName</Name>\n"); 367 xml.append(" <Value>").append(String.valueOf(objPostBean.memberName)).append("</Value>\n"); 368 xml.append(" </Column>\n"); 369 xml.append(" <Column>\n"); 370 xml.append(" <Name>LastEditMemberName</Name>\n"); 371 xml.append(" <Value>").append(String.valueOf(objPostBean.lastEditMemberName)).append("</Value>\n"); 372 xml.append(" </Column>\n"); 373 xml.append(" <Column>\n"); 374 xml.append(" <Name>PostTopic</Name>\n"); 375 xml.append(" <Value>").append(String.valueOf(objPostBean.postTopic)).append("</Value>\n"); 376 xml.append(" </Column>\n"); 377 xml.append(" <Column>\n"); 378 xml.append(" <Name>PostBody</Name>\n"); 379 xml.append(" <Value>").append(String.valueOf(objPostBean.postBody)).append("</Value>\n"); 380 xml.append(" </Column>\n"); 381 xml.append(" <Column>\n"); 382 xml.append(" <Name>PostCreationDate</Name>\n"); 383 xml.append(" <Value>").append(String.valueOf(objPostBean.postCreationDate)).append("</Value>\n"); 384 xml.append(" </Column>\n"); 385 xml.append(" <Column>\n"); 386 xml.append(" <Name>PostLastEditDate</Name>\n"); 387 xml.append(" <Value>").append(String.valueOf(objPostBean.postLastEditDate)).append("</Value>\n"); 388 xml.append(" </Column>\n"); 389 xml.append(" <Column>\n"); 390 xml.append(" <Name>PostCreationIP</Name>\n"); 391 xml.append(" <Value>").append(String.valueOf(objPostBean.postCreationIP)).append("</Value>\n"); 392 xml.append(" </Column>\n"); 393 xml.append(" <Column>\n"); 394 xml.append(" <Name>PostLastEditIP</Name>\n"); 395 xml.append(" <Value>").append(String.valueOf(objPostBean.postLastEditIP)).append("</Value>\n"); 396 xml.append(" </Column>\n"); 397 xml.append(" <Column>\n"); 398 xml.append(" <Name>PostEditCount</Name>\n"); 399 xml.append(" <Value>").append(String.valueOf(objPostBean.postEditCount)).append("</Value>\n"); 400 xml.append(" </Column>\n"); 401 xml.append(" <Column>\n"); 402 xml.append(" <Name>PostFormatOption</Name>\n"); 403 xml.append(" <Value>").append(String.valueOf(objPostBean.postFormatOption)).append("</Value>\n"); 404 xml.append(" </Column>\n"); 405 xml.append(" <Column>\n"); 406 xml.append(" <Name>PostOption</Name>\n"); 407 xml.append(" <Value>").append(String.valueOf(objPostBean.postOption)).append("</Value>\n"); 408 xml.append(" </Column>\n"); 409 xml.append(" <Column>\n"); 410 xml.append(" <Name>PostStatus</Name>\n"); 411 xml.append(" <Value>").append(String.valueOf(objPostBean.postStatus)).append("</Value>\n"); 412 xml.append(" </Column>\n"); 413 xml.append(" <Column>\n"); 414 xml.append(" <Name>PostIcon</Name>\n"); 415 xml.append(" <Value>").append(String.valueOf(objPostBean.postIcon)).append("</Value>\n"); 416 xml.append(" </Column>\n"); 417 xml.append(" <Column>\n"); 418 xml.append(" <Name>PostAttachCount</Name>\n"); 419 xml.append(" <Value>").append(String.valueOf(objPostBean.postAttachCount)).append("</Value>\n"); 420 xml.append(" </Column>\n"); 421 xml.append(" </Row>\n"); 422 } xml.append(" </Rows>\n"); 424 xml.append("</PostSection>\n"); 425 return xml.toString(); 426 } 427 430 private MemberBean memberBean = null; 431 private Collection attachmentBeans = null; 432 433 public MemberBean getMemberBean() { 434 return memberBean; 435 } 436 public void setMemberBean(MemberBean memberBean) { 437 this.memberBean = memberBean; 438 } 439 440 public Collection getAttachmentBeans() { 441 return attachmentBeans; 442 } 443 public void setAttachmentBeans(Collection attachmentBeans) { 444 this.attachmentBeans = attachmentBeans; 445 } 446 447 } | Popular Tags |