Source Code Cross Referenced for DiscussionForumBean.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » tool » messageforums » ui » 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 » ERP CRM Financial » sakai » org.sakaiproject.tool.messageforums.ui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:         * $URL: https://source.sakaiproject.org/svn/msgcntr/trunk/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/DiscussionForumBean.java $
003:         * $Id: DiscussionForumBean.java 9227 2006-05-15 15:02:42Z cwen@iupui.edu $
004:         ***********************************************************************************
005:         *
006:         * Copyright (c) 2003, 2004, 2005, 2006, 2007 The Sakai Foundation.
007:         * 
008:         * Licensed under the Educational Community License, Version 1.0 (the "License"); 
009:         * you may not use this file except in compliance with the License. 
010:         * You may obtain a copy of the License at
011:         * 
012:         *      http://www.opensource.org/licenses/ecl1.php
013:         * 
014:         * Unless required by applicable law or agreed to in writing, software 
015:         * distributed under the License is distributed on an "AS IS" BASIS, 
016:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
017:         * See the License for the specific language governing permissions and 
018:         * limitations under the License.
019:         *
020:         **********************************************************************************/package org.sakaiproject.tool.messageforums.ui;
021:
022:        import java.util.ArrayList;
023:        import java.util.Iterator;
024:        import java.util.List;
025:
026:        import javax.faces.model.SelectItem;
027:
028:        import org.apache.commons.logging.Log;
029:        import org.apache.commons.logging.LogFactory;
030:        import org.sakaiproject.api.app.messageforums.DiscussionForum;
031:        import org.sakaiproject.api.app.messageforums.MessageForumsUser;
032:        import org.sakaiproject.api.app.messageforums.ui.DiscussionForumManager;
033:        import org.sakaiproject.api.app.messageforums.ui.UIPermissionsManager;
034:        import org.sakaiproject.component.app.messageforums.MembershipItem;
035:        import org.sakaiproject.api.app.messageforums.Attachment;
036:
037:        /**
038:         * @author <a href="mailto:rshastri@iupui.edu">Rashmi Shastri</a>
039:         */
040:        public class DiscussionForumBean {
041:            private static final Log LOG = LogFactory
042:                    .getLog(DiscussionForumBean.class);
043:            private DiscussionForum forum;
044:            private boolean markForDeletion;
045:            private UIPermissionsManager uiPermissionsManager;
046:            private DiscussionForumManager forumManager;
047:            private boolean readFullDesciption;
048:            private ArrayList contributorsList = new ArrayList();
049:            private ArrayList accessorList = new ArrayList();
050:            private String gradeAssign;
051:            private boolean nonePermission = true;
052:
053:            /**
054:             * List of decorated topics
055:             */
056:            private List topics = new ArrayList();
057:
058:            public DiscussionForumBean(DiscussionForum forum,
059:                    UIPermissionsManager uiPermissionsManager,
060:                    DiscussionForumManager forumManager) {
061:                if (LOG.isDebugEnabled()) {
062:                    LOG.debug("DiscussionForumBean(DiscussionForum " + forum
063:                            + ", UIPermissionsManager" + uiPermissionsManager
064:                            + ")");
065:                }
066:                this .forum = forum;
067:                this .uiPermissionsManager = uiPermissionsManager;
068:                this .forumManager = forumManager;
069:            }
070:
071:            /**
072:             * @return
073:             */
074:            public DiscussionForum getForum() {
075:                LOG.debug("getForum()");
076:                return forum;
077:            }
078:
079:            /**
080:             * @return Returns count of topics in the forum
081:             */
082:            public int getTopicCount() {
083:                LOG.debug("getTopics()");
084:                return (topics == null) ? 0 : topics.size();
085:            }
086:
087:            /**
088:             * @return List of SelectItem
089:             */
090:            public List getTopicSelectItems() {
091:                List f = getTopics();
092:                int num = (f == null) ? 0 : f.size();
093:
094:                List retSort = new ArrayList();
095:                for (int i = 1; i <= num; i++) {
096:                    Integer index = new Integer(i);
097:                    retSort.add(new SelectItem(index, index.toString()));
098:                }
099:
100:                return retSort;
101:            }
102:
103:            /**
104:             * @return Returns the decorated topic.
105:             */
106:            public List getTopics() {
107:                LOG.debug("getTopics()");
108:                return topics;
109:            }
110:
111:            public void addTopic(DiscussionTopicBean decoTopic) {
112:                if (LOG.isDebugEnabled()) {
113:                    LOG.debug("addTopic(DiscussionTopicBean" + decoTopic + ")");
114:                }
115:                if (!topics.contains(decoTopic)) {
116:                    topics.add(decoTopic);
117:                }
118:            }
119:
120:            /**
121:             * @return Returns the locked.
122:             */
123:            public String getLocked() {
124:                LOG.debug("getLocked()");
125:                if (forum == null || forum.getLocked() == null
126:                        || forum.getLocked().booleanValue() == false) {
127:                    return Boolean.FALSE.toString();
128:                }
129:                return Boolean.TRUE.toString();
130:            }
131:
132:            /**
133:             * @param locked
134:             *          The locked to set.
135:             */
136:            public void setLocked(String locked) {
137:                LOG.debug("setLocked(String" + locked + ")");
138:                if (locked.equals(Boolean.TRUE.toString())) {
139:                    forum.setLocked(new Boolean(true));
140:                } else {
141:                    forum.setLocked(new Boolean(false));
142:                }
143:            }
144:
145:            /**
146:             * Returns whether the forum is moderated or not
147:             * @return
148:             */
149:            public String getModerated() {
150:                LOG.debug("getModerated()");
151:                if (forum == null || forum.getModerated() == null
152:                        || forum.getModerated().booleanValue() == false) {
153:                    return Boolean.FALSE.toString();
154:                }
155:
156:                return Boolean.TRUE.toString();
157:            }
158:
159:            /**
160:             * Set the "moderated" setting for the forum
161:             * @param moderated
162:             */
163:            public void setModerated(String moderated) {
164:                LOG.debug("setModerated()");
165:                if (moderated.equals(Boolean.TRUE.toString())) {
166:                    forum.setModerated(new Boolean(true));
167:                } else {
168:                    forum.setModerated(new Boolean(false));
169:                }
170:            }
171:
172:            /**
173:             * @return Returns the markForDeletion.
174:             */
175:            public boolean isMarkForDeletion() {
176:                LOG.debug("isMarkForDeletion()");
177:                return markForDeletion;
178:            }
179:
180:            /**
181:             * @param markForDeletion
182:             *          The markForDeletion to set.
183:             */
184:            public void setMarkForDeletion(boolean markForDeletion) {
185:                if (LOG.isDebugEnabled()) {
186:                    LOG.debug("setMarkForDeletion(boolean" + markForDeletion
187:                            + ")");
188:                }
189:                this .markForDeletion = markForDeletion;
190:            }
191:
192:            /**
193:             * @return
194:             */
195:            public boolean getChangeSettings() {
196:                LOG.debug("getChangeSettings()");
197:                return uiPermissionsManager.isChangeSettings(forum);
198:            }
199:
200:            /**
201:             * @return
202:             */
203:            public boolean isNewTopic() {
204:                LOG.debug("isNewTopic()");
205:                return uiPermissionsManager.isNewTopic(forum);
206:            }
207:
208:            /**
209:             * @return Returns the if ExtendedDesciption is available
210:             */
211:            public boolean getHasExtendedDesciption() {
212:                LOG.debug("getHasExtendedDesciption()");
213:                if (forum.getExtendedDescription() != null
214:                        && forum.getExtendedDescription().trim().length() > 0
215:                        && (!readFullDesciption)) {
216:                    return true;
217:                }
218:                return false;
219:            }
220:
221:            /**
222:             * @return Returns the readFullDesciption.
223:             */
224:            public boolean isReadFullDesciption() {
225:                LOG.debug("isReadFullDesciption()");
226:                return readFullDesciption;
227:            }
228:
229:            /**
230:             * Returns the moderated status of the forum
231:             * @return
232:             */
233:            public boolean isForumModerated() {
234:                return forum.getModerated().booleanValue();
235:            }
236:
237:            /**
238:             * @param readFullDesciption The readFullDesciption to set.
239:             */
240:            public void setReadFullDesciption(boolean readFullDesciption) {
241:                if (LOG.isDebugEnabled()) {
242:                    LOG.debug("setReadFullDesciption(boolean"
243:                            + readFullDesciption + ")");
244:                }
245:                this .readFullDesciption = readFullDesciption;
246:            }
247:
248:            /**
249:             * @return
250:             */
251:            public ArrayList getContributorsList() {
252:                LOG.debug("getContributorsList()");
253:
254:                Iterator iter = forumManager.getContributorsList(forum)
255:                        .iterator();
256:                while (iter.hasNext()) {
257:                    contributorsList.add((String) iter.next());
258:                }
259:                return contributorsList;
260:
261:            }
262:
263:            /**
264:             * @return
265:             */
266:            public ArrayList getAccessorList() {
267:                LOG.debug("getAccessorList()");
268:                Iterator iter = forumManager.getAccessorsList(forum).iterator();
269:                while (iter.hasNext()) {
270:                    accessorList.add((String) iter.next());
271:                }
272:                return accessorList;
273:            }
274:
275:            /**
276:             * @param accessorList The accessorList to set.
277:             */
278:            public void setAccessorList(ArrayList accessorList) {
279:                if (LOG.isDebugEnabled()) {
280:                    LOG.debug("setAccessorList(List" + accessorList + ")");
281:                }
282:                forum.getActorPermissions().setAccessors(
283:                        forumManager.decodeAccessorsList(accessorList));
284:            }
285:
286:            /**
287:             * @param contributorsList The contributorsList to set.
288:             */
289:            public void setContributorsList(ArrayList contributorsList) {
290:                if (LOG.isDebugEnabled()) {
291:                    LOG.debug("setContributorsList(List" + contributorsList
292:                            + ")");
293:                }
294:                forum.getActorPermissions().setContributors(
295:                        forumManager.decodeContributorsList(contributorsList));
296:            }
297:
298:            /**
299:             * @param forumManager The forumManager to set.
300:             */
301:            public void setForumManager(DiscussionForumManager forumManager) {
302:                if (LOG.isDebugEnabled()) {
303:                    LOG.debug("setForumManager(DiscussionForumManager"
304:                            + forumManager + ")");
305:                }
306:                this .forumManager = forumManager;
307:            }
308:
309:            public String getGradeAssign() {
310:                return gradeAssign;
311:            }
312:
313:            public void setGradeAssign(String gradeAssign) {
314:                this .gradeAssign = gradeAssign;
315:            }
316:
317:            public boolean getNonePermission() {
318:                nonePermission = true;
319:
320:                if (uiPermissionsManager.isChangeSettings(forum)
321:                        || uiPermissionsManager.isNewTopic(forum)) {
322:                    nonePermission = false;
323:                    return nonePermission;
324:                }
325:
326:                if (topics != null) {
327:                    for (int i = 0; i < topics.size(); i++) {
328:                        DiscussionTopicBean dtb = (DiscussionTopicBean) topics
329:                                .get(i);
330:                        if (!dtb.getNonePermission()) {
331:                            nonePermission = false;
332:                            break;
333:                        }
334:                    }
335:                }
336:                return nonePermission;
337:            }
338:
339:            public void setNonePermission(boolean nonePermission) {
340:                this .nonePermission = nonePermission;
341:            }
342:
343:            public ArrayList getAttachList() {
344:                ArrayList decoAttachList = new ArrayList();
345:                List attachList = forum.getAttachments();
346:                if (attachList != null) {
347:                    for (int i = 0; i < attachList.size(); i++) {
348:                        DecoratedAttachment decoAttach = new DecoratedAttachment(
349:                                (Attachment) attachList.get(i));
350:                        decoAttachList.add(decoAttach);
351:                    }
352:                }
353:                return decoAttachList;
354:            }
355:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.