001: /*
002: * $Header: /cvsroot/mvnforum/mvnforum/contrib/phpbb2mvnforum/src/org/mvnforum/phpbb2mvnforum/db/ThreadBean.java,v 1.4 2007/12/17 09:46:20 minhnn Exp $
003: * $Author: minhnn $
004: * $Revision: 1.4 $
005: * $Date: 2007/12/17 09:46:20 $
006: *
007: * ====================================================================
008: *
009: * Copyright (C) 2002-2007 by MyVietnam.net
010: *
011: * All copyright notices regarding mvnForum MUST remain
012: * intact in the scripts and in the outputted HTML.
013: * The "powered by" text/logo with a link back to
014: * http://www.mvnForum.com and http://www.MyVietnam.net in
015: * the footer of the pages MUST remain visible when the pages
016: * are viewed on the internet or intranet.
017: *
018: * This program is free software; you can redistribute it and/or modify
019: * it under the terms of the GNU General Public License as published by
020: * the Free Software Foundation; either version 2 of the License, or
021: * any later version.
022: *
023: * This program is distributed in the hope that it will be useful,
024: * but WITHOUT ANY WARRANTY; without even the implied warranty of
025: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
026: * GNU General Public License for more details.
027: *
028: * You should have received a copy of the GNU General Public License
029: * along with this program; if not, write to the Free Software
030: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
031: *
032: * Support can be obtained from support forums at:
033: * http://www.mvnForum.com/mvnforum/index
034: *
035: * Correspondence and Marketing Questions can be sent to:
036: * info at MyVietnam net
037: *
038: * @author: Minh Nguyen
039: * @author: Mai Nguyen
040: */
041: package org.mvnforum.phpbb2mvnforum.db;
042:
043: import java.sql.Timestamp;
044: import java.util.Collection;
045: import java.util.Iterator;
046:
047: import org.w3c.dom.Document;
048: import org.w3c.dom.Element;
049: import org.w3c.dom.Node;
050:
051: import net.myvietnam.mvncore.util.StringUtil;
052:
053: /*
054: * Included columns: ThreadID, ForumID, MemberName, LastPostMemberName, ThreadTopic,
055: * ThreadBody, ThreadVoteCount, ThreadVoteTotalStars, ThreadCreationDate, ThreadLastPostDate,
056: * ThreadType, ThreadOption, ThreadStatus, ThreadHasPoll, ThreadViewCount,
057: * ThreadReplyCount, ThreadIcon, ThreadDuration
058: * Excluded columns:
059: */
060: public class ThreadBean {
061: /*************************************************************************
062: * NOTE: below constants MUST NOT be changed IN ALL CASES,
063: * or it will break the compatibility
064: *************************************************************************/
065: /**
066: * The default value mean thread is enable and normal
067: */
068: public final static int THREAD_STATUS_DEFAULT = 0;
069:
070: /**
071: * The disable thread is invisible for normal user and visible to moderator
072: */
073: public final static int THREAD_STATUS_DISABLED = 1;
074:
075: /**
076: * No changes (edit, attach, reply) could be maded, moderator
077: * have to change this status before making any changes is possible
078: */
079: public final static int THREAD_STATUS_LOCKED = 2;
080:
081: /**
082: * Noone can reply, but moderator can change it.
083: */
084: public final static int THREAD_STATUS_CLOSED = 3;
085:
086: /**
087: * Thread type is traditional
088: */
089: public final static int THREAD_TYPE_DEFAULT = 0;
090:
091: public final static int THREAD_TYPE_STICKY = 1;
092:
093: public final static int THREAD_TYPE_FORUM_ANNOUNCEMENT = 2;
094:
095: public final static int THREAD_TYPE_GLOBAL_ANNOUNCEMENT = 3;
096:
097: private int threadID;
098: private int forumID;
099: private String memberName;
100: private String lastPostMemberName;
101: private String threadTopic;
102: private String threadBody;
103: private int threadVoteCount;
104: private int threadVoteTotalStars;
105: private Timestamp threadCreationDate;
106: private Timestamp threadLastPostDate;
107: private int threadType;
108: private int threadOption;
109: private int threadStatus;
110: private int threadHasPoll;
111: private int threadViewCount;
112: private int threadReplyCount;
113: private String threadIcon;
114: private int threadDuration;
115: private int threadAttachCount;
116:
117: public int getThreadID() {
118: return threadID;
119: }
120:
121: public void setThreadID(int threadID) {
122: this .threadID = threadID;
123: }
124:
125: public int getForumID() {
126: return forumID;
127: }
128:
129: public void setForumID(int forumID) {
130: this .forumID = forumID;
131: }
132:
133: public String getMemberName() {
134: return memberName;
135: }
136:
137: public void setMemberName(String memberName) {
138: this .memberName = memberName;
139: }
140:
141: public String getLastPostMemberName() {
142: return lastPostMemberName;
143: }
144:
145: public void setLastPostMemberName(String lastPostMemberName) {
146: this .lastPostMemberName = lastPostMemberName;
147: }
148:
149: public String getThreadTopic() {
150: return threadTopic;
151: }
152:
153: public void setThreadTopic(String threadTopic) {
154: this .threadTopic = threadTopic;
155: }
156:
157: public String getThreadBody() {
158: return threadBody;
159: }
160:
161: public void setThreadBody(String threadBody) {
162: this .threadBody = threadBody;
163: }
164:
165: public int getThreadVoteCount() {
166: return threadVoteCount;
167: }
168:
169: public void setThreadVoteCount(int threadVoteCount) {
170: this .threadVoteCount = threadVoteCount;
171: }
172:
173: public int getThreadVoteTotalStars() {
174: return threadVoteTotalStars;
175: }
176:
177: public void setThreadVoteTotalStars(int threadVoteTotalStars) {
178: this .threadVoteTotalStars = threadVoteTotalStars;
179: }
180:
181: public Timestamp getThreadCreationDate() {
182: return threadCreationDate;
183: }
184:
185: public void setThreadCreationDate(Timestamp threadCreationDate) {
186: this .threadCreationDate = threadCreationDate;
187: }
188:
189: public Timestamp getThreadLastPostDate() {
190: return threadLastPostDate;
191: }
192:
193: public void setThreadLastPostDate(Timestamp threadLastPostDate) {
194: this .threadLastPostDate = threadLastPostDate;
195: }
196:
197: public int getThreadType() {
198: return threadType;
199: }
200:
201: public void setThreadType(int threadType) {
202: this .threadType = threadType;
203: }
204:
205: public int getThreadOption() {
206: return threadOption;
207: }
208:
209: public void setThreadOption(int threadOption) {
210: this .threadOption = threadOption;
211: }
212:
213: public int getThreadStatus() {
214: return threadStatus;
215: }
216:
217: public void setThreadStatus(int threadStatus) {
218: this .threadStatus = threadStatus;
219: }
220:
221: public int getThreadHasPoll() {
222: return threadHasPoll;
223: }
224:
225: public void setThreadHasPoll(int threadHasPoll) {
226: this .threadHasPoll = threadHasPoll;
227: }
228:
229: public int getThreadViewCount() {
230: return threadViewCount;
231: }
232:
233: public void setThreadViewCount(int threadViewCount) {
234: this .threadViewCount = threadViewCount;
235: }
236:
237: public int getThreadReplyCount() {
238: return threadReplyCount;
239: }
240:
241: public void setThreadReplyCount(int threadReplyCount) {
242: this .threadReplyCount = threadReplyCount;
243: }
244:
245: public String getThreadIcon() {
246: return threadIcon;
247: }
248:
249: public void setThreadIcon(String threadIcon) {
250: this .threadIcon = StringUtil.getEmptyStringIfNull(threadIcon);
251: }
252:
253: public int getThreadDuration() {
254: return threadDuration;
255: }
256:
257: public void setThreadDuration(int threadDuration) {
258: this .threadDuration = threadDuration;
259: }
260:
261: public int getThreadAttachCount() {
262: return this .threadAttachCount;
263: }
264:
265: public void setThreadAttachCount(int attachCount) {
266: this .threadAttachCount = attachCount;
267: }
268:
269: public String getXMLTag() {
270: StringBuffer xml = new StringBuffer(1024);
271: xml.append("<Thread");
272: xml.append(" threadID=\"").append(String.valueOf(threadID))
273: .append("\"");
274: xml.append(" forumID=\"").append(String.valueOf(forumID))
275: .append("\"");
276: xml.append(" memberName=\"").append(String.valueOf(memberName))
277: .append("\"");
278: xml.append(" lastPostMemberName=\"").append(
279: String.valueOf(lastPostMemberName)).append("\"");
280: xml.append(" threadTopic=\"").append(
281: String.valueOf(threadTopic)).append("\"");
282: xml.append(" threadBody=\"").append(String.valueOf(threadBody))
283: .append("\"");
284: xml.append(" threadVoteCount=\"").append(
285: String.valueOf(threadVoteCount)).append("\"");
286: xml.append(" threadVoteTotalStars=\"").append(
287: String.valueOf(threadVoteTotalStars)).append("\"");
288: xml.append(" threadCreationDate=\"").append(
289: String.valueOf(threadCreationDate)).append("\"");
290: xml.append(" threadLastPostDate=\"").append(
291: String.valueOf(threadLastPostDate)).append("\"");
292: xml.append(" threadType=\"").append(String.valueOf(threadType))
293: .append("\"");
294: xml.append(" threadOption=\"").append(
295: String.valueOf(threadOption)).append("\"");
296: xml.append(" threadStatus=\"").append(
297: String.valueOf(threadStatus)).append("\"");
298: xml.append(" threadHasPoll=\"").append(
299: String.valueOf(threadHasPoll)).append("\"");
300: xml.append(" threadViewCount=\"").append(
301: String.valueOf(threadViewCount)).append("\"");
302: xml.append(" threadReplyCount=\"").append(
303: String.valueOf(threadReplyCount)).append("\"");
304: xml.append(" threadIcon=\"").append(String.valueOf(threadIcon))
305: .append("\"");
306: xml.append(" threadDuration=\"").append(
307: String.valueOf(threadDuration)).append("\"");
308: xml.append(" threadAttachCount=\"").append(
309: String.valueOf(threadAttachCount)).append("\"");
310: xml.append(">");
311: return xml.toString();
312: }
313:
314: public void getBeanDocument(Document doc, Element element) {
315: Element category = doc.createElement("Thread");
316: element.appendChild(category);
317:
318: category.appendChild(getNode(doc, "ThreadID", String
319: .valueOf(threadID)));
320: category.appendChild(getNode(doc, "ForumID", String
321: .valueOf(forumID)));
322: category.appendChild(getNode(doc, "MemberName", String
323: .valueOf(memberName)));
324: category.appendChild(getNode(doc, "LastPostMemberName", String
325: .valueOf(lastPostMemberName)));
326: category.appendChild(getNode(doc, "ThreadTopic", String
327: .valueOf(threadTopic)));
328: category.appendChild(getNode(doc, "ThreadBody", String
329: .valueOf(threadBody)));
330: category.appendChild(getNode(doc, "ThreadVoteCount", String
331: .valueOf(threadVoteCount)));
332: category.appendChild(getNode(doc, "ThreadVoteTotalStars",
333: String.valueOf(threadVoteTotalStars)));
334: category.appendChild(getNode(doc, "ThreadCreationDate", String
335: .valueOf(threadCreationDate)));
336: category.appendChild(getNode(doc, "ThreadLastPostDate", String
337: .valueOf(threadLastPostDate)));
338: category.appendChild(getNode(doc, "ThreadType", String
339: .valueOf(threadType)));
340: category.appendChild(getNode(doc, "ThreadOption", String
341: .valueOf(threadOption)));
342: category.appendChild(getNode(doc, "ThreadStatus", String
343: .valueOf(threadStatus)));
344: category.appendChild(getNode(doc, "ThreadHasPoll", String
345: .valueOf(threadHasPoll)));
346: category.appendChild(getNode(doc, "ThreadViewCount", String
347: .valueOf(threadViewCount)));
348: category.appendChild(getNode(doc, "ThreadReplyCount", String
349: .valueOf(threadReplyCount)));
350: category.appendChild(getNode(doc, "ThreadIcon", String
351: .valueOf(threadIcon)));
352: category.appendChild(getNode(doc, "ThreadDuration", String
353: .valueOf(threadDuration)));
354: category.appendChild(getNode(doc, "ThreadAttachCount", String
355: .valueOf(threadAttachCount)));
356: }
357:
358: public static Node getNode(Document doc, String childName,
359: String childValue) {
360: Element child = doc.createElement(childName);
361: child.appendChild(doc.createTextNode(childValue));
362: return child;
363: }
364:
365: public String getXML() {
366: StringBuffer xml = new StringBuffer(1024);
367: xml.append("<ThreadSection>\n");
368: xml.append(" <Rows>\n");
369: xml.append(" <Row>\n");
370: xml.append(" <Column>\n");
371: xml.append(" <Name>ThreadID</Name>\n");
372: xml.append(" <Value>").append(String.valueOf(threadID))
373: .append("</Value>\n");
374: xml.append(" </Column>\n");
375: xml.append(" <Column>\n");
376: xml.append(" <Name>ForumID</Name>\n");
377: xml.append(" <Value>").append(String.valueOf(forumID))
378: .append("</Value>\n");
379: xml.append(" </Column>\n");
380: xml.append(" <Column>\n");
381: xml.append(" <Name>MemberName</Name>\n");
382: xml.append(" <Value>")
383: .append(String.valueOf(memberName))
384: .append("</Value>\n");
385: xml.append(" </Column>\n");
386: xml.append(" <Column>\n");
387: xml.append(" <Name>LastPostMemberName</Name>\n");
388: xml.append(" <Value>").append(
389: String.valueOf(lastPostMemberName))
390: .append("</Value>\n");
391: xml.append(" </Column>\n");
392: xml.append(" <Column>\n");
393: xml.append(" <Name>ThreadTopic</Name>\n");
394: xml.append(" <Value>").append(
395: String.valueOf(threadTopic)).append("</Value>\n");
396: xml.append(" </Column>\n");
397: xml.append(" <Column>\n");
398: xml.append(" <Name>ThreadBody</Name>\n");
399: xml.append(" <Value>")
400: .append(String.valueOf(threadBody))
401: .append("</Value>\n");
402: xml.append(" </Column>\n");
403: xml.append(" <Column>\n");
404: xml.append(" <Name>ThreadVoteCount</Name>\n");
405: xml.append(" <Value>").append(
406: String.valueOf(threadVoteCount)).append("</Value>\n");
407: xml.append(" </Column>\n");
408: xml.append(" <Column>\n");
409: xml.append(" <Name>ThreadVoteTotalStars</Name>\n");
410: xml.append(" <Value>").append(
411: String.valueOf(threadVoteTotalStars)).append(
412: "</Value>\n");
413: xml.append(" </Column>\n");
414: xml.append(" <Column>\n");
415: xml.append(" <Name>ThreadCreationDate</Name>\n");
416: xml.append(" <Value>").append(
417: String.valueOf(threadCreationDate))
418: .append("</Value>\n");
419: xml.append(" </Column>\n");
420: xml.append(" <Column>\n");
421: xml.append(" <Name>ThreadLastPostDate</Name>\n");
422: xml.append(" <Value>").append(
423: String.valueOf(threadLastPostDate))
424: .append("</Value>\n");
425: xml.append(" </Column>\n");
426: xml.append(" <Column>\n");
427: xml.append(" <Name>ThreadType</Name>\n");
428: xml.append(" <Value>")
429: .append(String.valueOf(threadType))
430: .append("</Value>\n");
431: xml.append(" </Column>\n");
432: xml.append(" <Column>\n");
433: xml.append(" <Name>ThreadOption</Name>\n");
434: xml.append(" <Value>").append(
435: String.valueOf(threadOption)).append("</Value>\n");
436: xml.append(" </Column>\n");
437: xml.append(" <Column>\n");
438: xml.append(" <Name>ThreadStatus</Name>\n");
439: xml.append(" <Value>").append(
440: String.valueOf(threadStatus)).append("</Value>\n");
441: xml.append(" </Column>\n");
442: xml.append(" <Column>\n");
443: xml.append(" <Name>ThreadHasPoll</Name>\n");
444: xml.append(" <Value>").append(
445: String.valueOf(threadHasPoll)).append("</Value>\n");
446: xml.append(" </Column>\n");
447: xml.append(" <Column>\n");
448: xml.append(" <Name>ThreadViewCount</Name>\n");
449: xml.append(" <Value>").append(
450: String.valueOf(threadViewCount)).append("</Value>\n");
451: xml.append(" </Column>\n");
452: xml.append(" <Column>\n");
453: xml.append(" <Name>ThreadReplyCount</Name>\n");
454: xml.append(" <Value>").append(
455: String.valueOf(threadReplyCount)).append("</Value>\n");
456: xml.append(" </Column>\n");
457: xml.append(" <Column>\n");
458: xml.append(" <Name>ThreadIcon</Name>\n");
459: xml.append(" <Value>")
460: .append(String.valueOf(threadIcon))
461: .append("</Value>\n");
462: xml.append(" </Column>\n");
463: xml.append(" <Column>\n");
464: xml.append(" <Name>ThreadDuration</Name>\n");
465: xml.append(" <Value>").append(
466: String.valueOf(threadDuration)).append("</Value>\n");
467: xml.append(" </Column>\n");
468: xml.append(" <Column>\n");
469: xml.append(" <Name>ThreadAttachCount</Name>\n");
470: xml.append(" <Value>").append(
471: String.valueOf(threadAttachCount)).append("</Value>\n");
472: xml.append(" </Column>\n");
473: xml.append(" </Row>\n");
474: xml.append(" </Rows>\n");
475: xml.append("</ThreadSection>\n");
476: return xml.toString();
477: }
478:
479: public static String getXML(Collection objThreadBeans) {
480: StringBuffer xml = new StringBuffer(1024);
481: Iterator iterator = objThreadBeans.iterator();
482: xml.append("<ThreadSection>\n");
483: xml.append(" <Rows>\n");
484: while (iterator.hasNext()) {
485: ThreadBean objThreadBean = (ThreadBean) iterator.next();
486: xml.append(" <Row>\n");
487: xml.append(" <Column>\n");
488: xml.append(" <Name>ThreadID</Name>\n");
489: xml.append(" <Value>").append(
490: String.valueOf(objThreadBean.threadID)).append(
491: "</Value>\n");
492: xml.append(" </Column>\n");
493: xml.append(" <Column>\n");
494: xml.append(" <Name>ForumID</Name>\n");
495: xml.append(" <Value>").append(
496: String.valueOf(objThreadBean.forumID)).append(
497: "</Value>\n");
498: xml.append(" </Column>\n");
499: xml.append(" <Column>\n");
500: xml.append(" <Name>MemberName</Name>\n");
501: xml.append(" <Value>").append(
502: String.valueOf(objThreadBean.memberName)).append(
503: "</Value>\n");
504: xml.append(" </Column>\n");
505: xml.append(" <Column>\n");
506: xml.append(" <Name>LastPostMemberName</Name>\n");
507: xml.append(" <Value>").append(
508: String.valueOf(objThreadBean.lastPostMemberName))
509: .append("</Value>\n");
510: xml.append(" </Column>\n");
511: xml.append(" <Column>\n");
512: xml.append(" <Name>ThreadTopic</Name>\n");
513: xml.append(" <Value>").append(
514: String.valueOf(objThreadBean.threadTopic)).append(
515: "</Value>\n");
516: xml.append(" </Column>\n");
517: xml.append(" <Column>\n");
518: xml.append(" <Name>ThreadBody</Name>\n");
519: xml.append(" <Value>").append(
520: String.valueOf(objThreadBean.threadBody)).append(
521: "</Value>\n");
522: xml.append(" </Column>\n");
523: xml.append(" <Column>\n");
524: xml.append(" <Name>ThreadVoteCount</Name>\n");
525: xml.append(" <Value>").append(
526: String.valueOf(objThreadBean.threadVoteCount))
527: .append("</Value>\n");
528: xml.append(" </Column>\n");
529: xml.append(" <Column>\n");
530: xml.append(" <Name>ThreadVoteTotalStars</Name>\n");
531: xml.append(" <Value>").append(
532: String.valueOf(objThreadBean.threadVoteTotalStars))
533: .append("</Value>\n");
534: xml.append(" </Column>\n");
535: xml.append(" <Column>\n");
536: xml.append(" <Name>ThreadCreationDate</Name>\n");
537: xml.append(" <Value>").append(
538: String.valueOf(objThreadBean.threadCreationDate))
539: .append("</Value>\n");
540: xml.append(" </Column>\n");
541: xml.append(" <Column>\n");
542: xml.append(" <Name>ThreadLastPostDate</Name>\n");
543: xml.append(" <Value>").append(
544: String.valueOf(objThreadBean.threadLastPostDate))
545: .append("</Value>\n");
546: xml.append(" </Column>\n");
547: xml.append(" <Column>\n");
548: xml.append(" <Name>ThreadType</Name>\n");
549: xml.append(" <Value>").append(
550: String.valueOf(objThreadBean.threadType)).append(
551: "</Value>\n");
552: xml.append(" </Column>\n");
553: xml.append(" <Column>\n");
554: xml.append(" <Name>ThreadOption</Name>\n");
555: xml.append(" <Value>").append(
556: String.valueOf(objThreadBean.threadOption)).append(
557: "</Value>\n");
558: xml.append(" </Column>\n");
559: xml.append(" <Column>\n");
560: xml.append(" <Name>ThreadStatus</Name>\n");
561: xml.append(" <Value>").append(
562: String.valueOf(objThreadBean.threadStatus)).append(
563: "</Value>\n");
564: xml.append(" </Column>\n");
565: xml.append(" <Column>\n");
566: xml.append(" <Name>ThreadHasPoll</Name>\n");
567: xml.append(" <Value>").append(
568: String.valueOf(objThreadBean.threadHasPoll))
569: .append("</Value>\n");
570: xml.append(" </Column>\n");
571: xml.append(" <Column>\n");
572: xml.append(" <Name>ThreadViewCount</Name>\n");
573: xml.append(" <Value>").append(
574: String.valueOf(objThreadBean.threadViewCount))
575: .append("</Value>\n");
576: xml.append(" </Column>\n");
577: xml.append(" <Column>\n");
578: xml.append(" <Name>ThreadReplyCount</Name>\n");
579: xml.append(" <Value>").append(
580: String.valueOf(objThreadBean.threadReplyCount))
581: .append("</Value>\n");
582: xml.append(" </Column>\n");
583: xml.append(" <Column>\n");
584: xml.append(" <Name>ThreadIcon</Name>\n");
585: xml.append(" <Value>").append(
586: String.valueOf(objThreadBean.threadIcon)).append(
587: "</Value>\n");
588: xml.append(" </Column>\n");
589: xml.append(" <Column>\n");
590: xml.append(" <Name>ThreadDuration</Name>\n");
591: xml.append(" <Value>").append(
592: String.valueOf(objThreadBean.threadDuration))
593: .append("</Value>\n");
594: xml.append(" </Column>\n");
595: xml.append(" <Column>\n");
596: xml.append(" <Name>ThreadAttachCount</Name>\n");
597: xml.append(" <Value>").append(
598: String.valueOf(objThreadBean.threadAttachCount))
599: .append("</Value>\n");
600: xml.append(" </Column>\n");
601: xml.append(" </Row>\n");
602: }//while
603: xml.append(" </Rows>\n");
604: xml.append("</ThreadSection>\n");
605: return xml.toString();
606: }
607:
608: /************************************************
609: * Customized methods come below
610: ************************************************/
611: private int threadPendingPostCount;
612:
613: public int getThreadPendingPostCount() {
614: return threadPendingPostCount;
615: }
616:
617: public void setThreadPendingPostCount(int threadPendingPostCount) {
618: this .threadPendingPostCount = threadPendingPostCount;
619: }
620:
621: private Collection pendingPosts;
622:
623: public Collection getPendingPosts() {
624: return pendingPosts;
625: }
626:
627: public void setPendingPosts(Collection pendingPosts) {
628: this .pendingPosts = pendingPosts;
629: }
630:
631: static public void validateThreadStatus(int status)
632: throws IllegalArgumentException {
633: if ((status < 0) || (status > THREAD_STATUS_CLOSED)) {
634: throw new IllegalArgumentException(
635: "Invalid ThreadStatus = " + status);
636: }
637: }
638:
639: static public void validateThreadType(int type)
640: throws IllegalArgumentException {
641: if ((type < 0) || (type > THREAD_TYPE_GLOBAL_ANNOUNCEMENT)) {
642: throw new IllegalArgumentException("Invalid ThreadType = "
643: + type);
644: }
645: }
646:
647: public void ensureStatusCanReply() throws IllegalArgumentException {
648: if ((getThreadStatus() == ThreadBean.THREAD_STATUS_LOCKED)
649: || (getThreadStatus() == ThreadBean.THREAD_STATUS_CLOSED)) {
650: // or we can throw AssertionException. indicate that the gui MUST hide the option
651: //@todo : localize me
652: throw new IllegalStateException(
653: "Cannot reply when the thread is closed or locked.");
654: }
655: }
656:
657: public void ensureStatusCanEdit() throws IllegalArgumentException {
658: if (getThreadStatus() == ThreadBean.THREAD_STATUS_LOCKED) {
659: // or we can throw AssertionException. indicate that the gui MUST hide the option
660: //@todo : localize me
661: throw new IllegalStateException(
662: "Cannot edit post when the thread is locked.");
663: }
664: }
665:
666: } //end of class ThreadBean
|