Source Code Cross Referenced for ForumBean.java in  » Forum » mvnforum-1.1 » com » mvnforum » db » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Forum » mvnforum 1.1 » com.mvnforum.db 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/db/ForumBean.java,v 1.28 2007/12/07 04:13:41 minhnn Exp $
003:         * $Author: minhnn $
004:         * $Revision: 1.28 $
005:         * $Date: 2007/12/07 04:13:41 $
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 com.mvnforum.db;
042:
043:        import java.sql.Timestamp;
044:
045:        import net.myvietnam.mvncore.exception.BadInputException;
046:        import net.myvietnam.mvncore.util.StringUtil;
047:
048:        import com.mvnforum.MVNForumConfig;
049:
050:        /*
051:         * Included columns: ForumID, CategoryID, LastPostMemberName, ForumName, ForumDesc,
052:         *                   ForumCreationDate, ForumModifiedDate, ForumLastPostDate, ForumOrder, ForumType,
053:         *                   ForumFormatOption, ForumOption, ForumStatus, ForumModerationMode, ForumPassword,
054:         *                   ForumThreadCount, ForumPostCount
055:         * Excluded columns:
056:         */
057:        public class ForumBean {
058:            /*************************************************************************
059:             * NOTE: below constants MUST NOT be changed IN ALL CASES,
060:             *       or it will break the compatibility
061:             *************************************************************************/
062:
063:            /** The default value mean forum is enable and normal */
064:            public final static int FORUM_STATUS_DEFAULT = 0;
065:
066:            /** The disabled value mean forum is disabled */
067:            public final static int FORUM_STATUS_DISABLED = 1;
068:
069:            /**
070:             * No changes (edit, attach, reply) could be maded, moderator
071:             * have to change this status before making any changes is possible
072:             */
073:            public final static int FORUM_STATUS_LOCKED = 2;
074:
075:            /** Noone can reply, but moderator can change it */
076:            public final static int FORUM_STATUS_CLOSED = 3;
077:
078:            /**  */
079:            public final static int FORUM_TYPE_DEFAULT = 0;
080:
081:            /**  */
082:            public final static int FORUM_TYPE_PRIVATE = 1;
083:
084:            /**  */
085:            public final static int FORUM_MODERATION_MODE_SYSTEM_DEFAULT = 0;
086:
087:            /**  */
088:            public final static int FORUM_MODERATION_MODE_NO_MODERATION = 1;
089:
090:            /**  */
091:            public final static int FORUM_MODERATION_MODE_THREAD_AND_POST = 2;
092:
093:            /**  */
094:            public final static int FORUM_MODERATION_MODE_THREAD_ONLY = 3;
095:
096:            /**  */
097:            public final static int FORUM_MODERATION_MODE_POST_ONLY = 4;
098:
099:            private int forumID;
100:            private int categoryID;
101:            private String forumOwnerName;
102:            private String lastPostMemberName;
103:            private String forumName;
104:            private String forumDesc;
105:            private Timestamp forumCreationDate;
106:            private Timestamp forumModifiedDate;
107:            private Timestamp forumLastPostDate;
108:            private int forumOrder;
109:            private int forumType;
110:            private int forumFormatOption;
111:            private int forumOption;
112:            private int forumStatus;
113:            private int forumModerationMode;
114:            private String forumPassword;
115:            private int forumThreadCount;
116:            private int forumPostCount;
117:
118:            public int getForumID() {
119:                return forumID;
120:            }
121:
122:            public void setForumID(int forumID) {
123:                this .forumID = forumID;
124:            }
125:
126:            public int getCategoryID() {
127:                return categoryID;
128:            }
129:
130:            public void setCategoryID(int categoryID) {
131:                this .categoryID = categoryID;
132:            }
133:
134:            public String getForumOwnerName() {
135:                return forumOwnerName;
136:            }
137:
138:            public void setForumOwnerName(String forumOwnerName) {
139:                this .forumOwnerName = (forumOwnerName == null) ? ""
140:                        : forumOwnerName;
141:            }
142:
143:            public String getLastPostMemberName() {
144:                return lastPostMemberName;
145:            }
146:
147:            public void setLastPostMemberName(String lastPostMemberName) {
148:                this .lastPostMemberName = StringUtil
149:                        .getEmptyStringIfNull(lastPostMemberName);
150:            }
151:
152:            public String getForumName() {
153:                return forumName;
154:            }
155:
156:            public void setForumName(String forumName) {
157:                this .forumName = forumName;
158:            }
159:
160:            public String getForumDesc() {
161:                return forumDesc;
162:            }
163:
164:            public void setForumDesc(String forumDesc) {
165:                this .forumDesc = StringUtil.getEmptyStringIfNull(forumDesc);
166:            }
167:
168:            public Timestamp getForumCreationDate() {
169:                return forumCreationDate;
170:            }
171:
172:            public void setForumCreationDate(Timestamp forumCreationDate) {
173:                this .forumCreationDate = forumCreationDate;
174:            }
175:
176:            public Timestamp getForumModifiedDate() {
177:                return forumModifiedDate;
178:            }
179:
180:            public void setForumModifiedDate(Timestamp forumModifiedDate) {
181:                this .forumModifiedDate = forumModifiedDate;
182:            }
183:
184:            public Timestamp getForumLastPostDate() {
185:                return forumLastPostDate;
186:            }
187:
188:            public void setForumLastPostDate(Timestamp forumLastPostDate) {
189:                this .forumLastPostDate = forumLastPostDate;
190:            }
191:
192:            public int getForumOrder() {
193:                return forumOrder;
194:            }
195:
196:            public void setForumOrder(int forumOrder) {
197:                this .forumOrder = forumOrder;
198:            }
199:
200:            public int getForumType() {
201:                return forumType;
202:            }
203:
204:            public void setForumType(int forumType) {
205:                this .forumType = forumType;
206:            }
207:
208:            public int getForumFormatOption() {
209:                return forumFormatOption;
210:            }
211:
212:            public void setForumFormatOption(int forumFormatOption) {
213:                this .forumFormatOption = forumFormatOption;
214:            }
215:
216:            public int getForumOption() {
217:                return forumOption;
218:            }
219:
220:            public void setForumOption(int forumOption) {
221:                this .forumOption = forumOption;
222:            }
223:
224:            public int getForumStatus() {
225:                return forumStatus;
226:            }
227:
228:            public void setForumStatus(int forumStatus) {
229:                this .forumStatus = forumStatus;
230:            }
231:
232:            public int getForumModerationMode() {
233:                return forumModerationMode;
234:            }
235:
236:            public void setForumModerationMode(int forumModerationMode) {
237:                this .forumModerationMode = forumModerationMode;
238:            }
239:
240:            public String getForumPassword() {
241:                return forumPassword;
242:            }
243:
244:            public void setForumPassword(String forumPassword) {
245:                this .forumPassword = StringUtil
246:                        .getEmptyStringIfNull(forumPassword);
247:            }
248:
249:            public int getForumThreadCount() {
250:                return forumThreadCount;
251:            }
252:
253:            public void setForumThreadCount(int forumThreadCount) {
254:                this .forumThreadCount = forumThreadCount;
255:            }
256:
257:            public int getForumPostCount() {
258:                return forumPostCount;
259:            }
260:
261:            public void setForumPostCount(int forumPostCount) {
262:                this .forumPostCount = forumPostCount;
263:            }
264:
265:            /************************************************
266:             * Customized methods come below
267:             ************************************************/
268:            private int pendingThreadCount = 0;
269:            private int threadsWithPendingPostsCount = 0;
270:            private int pendingPostCount = 0;
271:            private int viewCount = 0;
272:
273:            public int getPendingPostCount() {
274:                return pendingPostCount;
275:            }
276:
277:            public void setPendingPostCount(int pendingPostCount) {
278:                this .pendingPostCount = pendingPostCount;
279:            }
280:
281:            public int getPendingThreadCount() {
282:                return pendingThreadCount;
283:            }
284:
285:            public void setPendingThreadCount(int pendingThreadCount) {
286:                this .pendingThreadCount = pendingThreadCount;
287:            }
288:
289:            public int getThreadsWithPendingPostsCount() {
290:                return threadsWithPendingPostsCount;
291:            }
292:
293:            public void setThreadsWithPendingPostsCount(
294:                    int threadsWithPendingPostsCount) {
295:                this .threadsWithPendingPostsCount = threadsWithPendingPostsCount;
296:            }
297:
298:            // count sum of view in threads
299:            public int getViewCount() {
300:                return viewCount;
301:            }
302:
303:            public void setViewCount(int viewCount) {
304:                this .viewCount = viewCount;
305:            }
306:
307:            static public void validateForumType(int type)
308:                    throws IllegalArgumentException {
309:                if ((type < FORUM_TYPE_DEFAULT) || (type > FORUM_TYPE_PRIVATE)) {
310:                    throw new IllegalArgumentException("Invalid ForumType = "
311:                            + type);
312:                }
313:            }
314:
315:            static public void validateForumModerationMode(int moderationMod)
316:                    throws IllegalArgumentException {
317:                if ((moderationMod < FORUM_MODERATION_MODE_SYSTEM_DEFAULT)
318:                        || (moderationMod > FORUM_MODERATION_MODE_POST_ONLY)) {
319:                    throw new IllegalArgumentException(
320:                            "Invalid ForumModerationMod = " + moderationMod);
321:                }
322:            }
323:
324:            static public void validateForumStatus(int status)
325:                    throws IllegalArgumentException {
326:                if ((status < FORUM_STATUS_DEFAULT)
327:                        || (status > FORUM_STATUS_CLOSED)) {
328:                    throw new IllegalArgumentException("Invalid ForumStatus = "
329:                            + status);
330:                }
331:            }
332:
333:            static public void validateForumOption(int option)
334:                    throws IllegalArgumentException {
335:                if ((option < 0) || (option > 0)) {
336:                    throw new IllegalArgumentException("Invalid ForumOption = "
337:                            + option);
338:                }
339:            }
340:
341:            static public void validateForumFormatOption(int option)
342:                    throws IllegalArgumentException {
343:                if ((option < 0) || (option > 0)) {
344:                    throw new IllegalArgumentException(
345:                            "Invalid ForumFormatOption = " + option);
346:                }
347:            }
348:
349:            public void ensureNotDisabledForum() throws BadInputException {
350:                if (forumStatus == ForumBean.FORUM_STATUS_DISABLED) {
351:                    throw new BadInputException(
352:                            "Cannot process this action in a disabled forum.");//@todo : localize me
353:                }
354:            }
355:
356:            public void ensureNotLockedForum() throws BadInputException {
357:                if (forumStatus == ForumBean.FORUM_STATUS_LOCKED) {
358:                    throw new BadInputException(
359:                            "Cannot process this action in a locked forum.");//@todo : localize me
360:                }
361:            }
362:
363:            public void ensureNotClosedForum() throws BadInputException {
364:                if (forumStatus == ForumBean.FORUM_STATUS_CLOSED) {
365:                    throw new BadInputException(
366:                            "Cannot process this action in a closed forum.");//@todo : localize me
367:                }
368:            }
369:
370:            public boolean shouldModeratePost() {
371:                int mode = forumModerationMode;
372:                if (mode == FORUM_MODERATION_MODE_SYSTEM_DEFAULT) {
373:                    mode = MVNForumConfig.getDefaultModerationOption();
374:                }
375:                if ((mode == FORUM_MODERATION_MODE_POST_ONLY)
376:                        || (mode == FORUM_MODERATION_MODE_THREAD_AND_POST)) {
377:                    return true;
378:                }
379:                return false;
380:            }
381:
382:            public boolean shouldModerateThread() {
383:                int mode = forumModerationMode;
384:                if (mode == FORUM_MODERATION_MODE_SYSTEM_DEFAULT) {
385:                    mode = MVNForumConfig.getDefaultModerationOption();
386:                }
387:                if ((mode == FORUM_MODERATION_MODE_THREAD_ONLY)
388:                        || (mode == FORUM_MODERATION_MODE_THREAD_AND_POST)) {
389:                    return true;
390:                }
391:                return false;
392:            }
393:
394:        } //end of class ForumBean
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.