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


001:        /**********************************************************************************
002:         * $URL: https://source.sakaiproject.org/svn/msgcntr/trunk/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/DummyDataHelper.java $
003:         * $Id: DummyDataHelper.java 9227 2006-05-15 15:02:42Z cwen@iupui.edu $
004:         ***********************************************************************************
005:         *
006:         * Copyright (c) 2003, 2004, 2005, 2006 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.component.app.messageforums;
021:
022:        import java.util.ArrayList;
023:        import java.util.Date;
024:        import java.util.Iterator;
025:        import java.util.List;
026:
027:        import org.apache.commons.logging.Log;
028:        import org.apache.commons.logging.LogFactory;
029:        import org.sakaiproject.api.app.messageforums.ActorPermissions;
030:        import org.sakaiproject.api.app.messageforums.Area;
031:        import org.sakaiproject.api.app.messageforums.Attachment;
032:        import org.sakaiproject.api.app.messageforums.ControlPermissions;
033:        import org.sakaiproject.api.app.messageforums.DateRestrictions;
034:        import org.sakaiproject.api.app.messageforums.DiscussionForum;
035:        import org.sakaiproject.api.app.messageforums.DiscussionTopic;
036:        import org.sakaiproject.api.app.messageforums.DummyDataHelperApi;
037:        import org.sakaiproject.api.app.messageforums.Label;
038:        import org.sakaiproject.api.app.messageforums.Message;
039:        import org.sakaiproject.api.app.messageforums.MessageForumsTypeManager;
040:        import org.sakaiproject.api.app.messageforums.MessagePermissions;
041:        import org.sakaiproject.api.app.messageforums.PrivateForum;
042:        import org.sakaiproject.api.app.messageforums.PrivateMessage;
043:        import org.sakaiproject.component.app.messageforums.dao.hibernate.ActorPermissionsImpl;
044:        import org.sakaiproject.component.app.messageforums.dao.hibernate.AreaImpl;
045:        import org.sakaiproject.component.app.messageforums.dao.hibernate.AttachmentImpl;
046:        import org.sakaiproject.component.app.messageforums.dao.hibernate.ControlPermissionsImpl;
047:        import org.sakaiproject.component.app.messageforums.dao.hibernate.DateRestrictionsImpl;
048:        import org.sakaiproject.component.app.messageforums.dao.hibernate.DiscussionForumImpl;
049:        import org.sakaiproject.component.app.messageforums.dao.hibernate.DiscussionTopicImpl;
050:        import org.sakaiproject.component.app.messageforums.dao.hibernate.LabelImpl;
051:        import org.sakaiproject.component.app.messageforums.dao.hibernate.MessageImpl;
052:        import org.sakaiproject.component.app.messageforums.dao.hibernate.MessagePermissionsImpl;
053:        import org.sakaiproject.component.app.messageforums.dao.hibernate.PrivateForumImpl;
054:        import org.sakaiproject.component.app.messageforums.dao.hibernate.PrivateMessageImpl;
055:
056:        /*
057:         * This helper provides dummy data for use by interface developers It uses model objects. Models are
058:         * hibernate object wrappers, which are used so that hibernate does not play dirty and try to save
059:         * objects on the interface. They also uses List rather than Set, which play nice in JSF tags.
060:         */
061:
062:        public class DummyDataHelper implements  DummyDataHelperApi {
063:            private MessageForumsTypeManager typeMgr;
064:
065:            private static final Log LOG = LogFactory
066:                    .getLog(DummyDataHelper.class);
067:
068:            public void init() {
069:                LOG.info("init()");
070:                ;
071:            }
072:
073:            public Area getPrivateArea() {
074:                Area a1 = new AreaImpl();
075:                a1.setContextId("context1");
076:                a1.setHidden(Boolean.FALSE);
077:                a1.setName("Messages Area");
078:                a1.setCreated(new Date());
079:                a1.setCreatedBy("admin");
080:                a1.setModified(new Date());
081:                a1.setModifiedBy("admin");
082:                a1.setId(new Long(1));
083:                a1.setUuid("1");
084:                //a1.setPrivateForums(getPrivateForums());
085:                return a1;
086:            }
087:
088:            private List getPrivateForums() {
089:                List privateForums = new ArrayList();
090:                PrivateForum pfm1 = new PrivateForumImpl();
091:                pfm1.setAttachments(getAttachments());
092:                pfm1.setCreated(new Date());
093:                pfm1.setCreatedBy("admin");
094:                pfm1.setExtendedDescription("extended description");
095:                pfm1.setId(new Long(9));
096:                pfm1.setUuid("9");
097:                pfm1.setModified(new Date());
098:                pfm1.setModifiedBy("the moderator");
099:                pfm1.setShortDescription("short description");
100:                pfm1.setTitle("Messages");
101:                pfm1.setTopics((getPrivateTopics()));
102:                // pfm1.setType(new TypeImpl());
103:                pfm1.setAutoForward(Boolean.TRUE);
104:                pfm1.setAutoForwardEmail("fish@indiana.edu");
105:                pfm1.setPreviewPaneEnabled(Boolean.TRUE);
106:                pfm1.setSortIndex(new Integer(2));
107:                pfm1.setTopics(getPrivateTopics());
108:
109:                privateForums.add(pfm1);
110:
111:                return privateForums;
112:            }
113:
114:            private List getPrivateTopics() {
115:                List discussionTopics = new ArrayList();
116:                DiscussionTopic dtm = new DiscussionTopicImpl();
117:                dtm.setActorPermissions(getActorPermissions());
118:                dtm.setAttachments(getAttachments());
119:                dtm.setCreated(new Date());
120:                dtm.setCreatedBy("admin");
121:                dtm.setDateRestrictions(getDateRestrictions());
122:                dtm.setExtendedDescription("the extended description");
123:                dtm.setId(new Long(12));
124:                dtm.setUuid("12");
125:                dtm.setLabels(getLabels());
126:                dtm.setLocked(Boolean.TRUE);
127:                dtm.setModerated(Boolean.FALSE);
128:                dtm.setModified(new Date());
129:                dtm.setModifiedBy("the moderator");
130:                dtm.setShortDescription("sort desc here...");
131:                dtm.setTitle("Received");
132:                dtm.setConfidentialResponses(Boolean.TRUE);
133:                dtm.setTypeUuid(typeMgr.getReceivedPrivateMessageType());
134:                dtm.setMutable(Boolean.FALSE);
135:                dtm.setSortIndex(new Integer(2));
136:                dtm.setMessages(getReceivedPrivateMessages());
137:
138:                DiscussionTopic dtm1 = new DiscussionTopicImpl();
139:                dtm1.setActorPermissions(getActorPermissions());
140:                dtm1.setAttachments(getAttachments());
141:                dtm1.setCreated(new Date());
142:                dtm1.setCreatedBy("admin");
143:                dtm1.setDateRestrictions(getDateRestrictions());
144:                dtm1.setExtendedDescription("the extended description");
145:                dtm1.setId(new Long(1211));
146:                dtm1.setUuid("1211");
147:                dtm1.setLabels(getLabels());
148:                dtm1.setLocked(Boolean.TRUE);
149:                dtm1.setModerated(Boolean.FALSE);
150:                dtm1.setModified(new Date());
151:                dtm1.setModifiedBy("the moderator");
152:                dtm1.setShortDescription("sort desc here...");
153:                dtm1.setTitle("Sent");
154:                dtm1.setConfidentialResponses(Boolean.TRUE);
155:                dtm1.setMutable(Boolean.FALSE);
156:                dtm.setTypeUuid(typeMgr.getSentPrivateMessageType());
157:                dtm1.setSortIndex(new Integer(222));
158:                dtm1.setMessages(getSentPrivateMessages());
159:
160:                DiscussionTopic dtm2 = new DiscussionTopicImpl();
161:                dtm2.setActorPermissions(getActorPermissions());
162:                dtm2.setAttachments(getAttachments());
163:                dtm2.setCreated(new Date());
164:                dtm2.setCreatedBy("admin");
165:                dtm2.setDateRestrictions(getDateRestrictions());
166:                dtm2.setExtendedDescription("the extended description");
167:                dtm2.setId(new Long(1233));
168:                dtm2.setUuid("1233");
169:                dtm2.setLabels(getLabels());
170:                dtm2.setLocked(Boolean.TRUE);
171:                dtm2.setModerated(Boolean.FALSE);
172:                dtm2.setModified(new Date());
173:                dtm2.setModifiedBy("the moderator");
174:                dtm2.setShortDescription("sort desc here...");
175:                dtm2.setTitle("Deleted");
176:                dtm.setTypeUuid(typeMgr.getDeletedPrivateMessageType());
177:                dtm2.setConfidentialResponses(Boolean.TRUE);
178:                dtm2.setMutable(Boolean.FALSE);
179:                dtm2.setSortIndex(new Integer(2222));
180:                dtm2.setMessages(getDeletedPrivateMessages());
181:
182:                DiscussionTopic dtm3 = new DiscussionTopicImpl();
183:                dtm3.setActorPermissions(getActorPermissions());
184:                dtm3.setAttachments(getAttachments());
185:                dtm3.setCreated(new Date());
186:                dtm3.setCreatedBy("admin");
187:                dtm3.setDateRestrictions(getDateRestrictions());
188:                dtm3.setExtendedDescription("the extended description");
189:                dtm3.setId(new Long(123));
190:                dtm3.setUuid("123");
191:                dtm3.setLabels(getLabels());
192:                dtm3.setLocked(Boolean.TRUE);
193:                dtm3.setModerated(Boolean.FALSE);
194:                dtm3.setModified(new Date());
195:                dtm3.setModifiedBy("the moderator");
196:                dtm3.setShortDescription("sort desc here...");
197:                dtm3.setTitle("Drafts");
198:                dtm.setTypeUuid(typeMgr.getDraftPrivateMessageType());
199:                dtm3.setConfidentialResponses(Boolean.TRUE);
200:                dtm3.setMutable(Boolean.FALSE);
201:                dtm3.setSortIndex(new Integer(2));
202:                dtm3.setMessages(getDraftedPrivateMessages());
203:
204:                DiscussionTopic dtm13 = new DiscussionTopicImpl();
205:                dtm13.setActorPermissions(getActorPermissions());
206:                dtm13.setAttachments(getAttachments());
207:                dtm13.setCreated(new Date());
208:                dtm13.setCreatedBy("admin");
209:                dtm13.setDateRestrictions(getDateRestrictions());
210:                dtm13.setExtendedDescription("the extended description");
211:                dtm13.setId(new Long(132));
212:                dtm13.setUuid("132");
213:                dtm13.setLabels(getLabels());
214:                dtm13.setLocked(Boolean.TRUE);
215:                dtm13.setModerated(Boolean.FALSE);
216:                dtm13.setModified(new Date());
217:                dtm13.setModifiedBy("the moderator");
218:                dtm13.setShortDescription("sort desc here...");
219:                dtm13.setTitle("Personal Folders");
220:                dtm13.setConfidentialResponses(Boolean.TRUE);
221:                dtm13.setMutable(Boolean.TRUE);
222:                dtm13.setSortIndex(new Integer(2));
223:                dtm13.setMessages(null);
224:
225:                discussionTopics.add(dtm);
226:                discussionTopics.add(dtm1);
227:                discussionTopics.add(dtm2);
228:                discussionTopics.add(dtm3);
229:                discussionTopics.add(dtm13);
230:
231:                return discussionTopics;
232:            }
233:
234:            private List getDraftedPrivateMessages() {
235:                List privateMessages = new ArrayList();
236:                PrivateMessage pmm1 = new PrivateMessageImpl();
237:                pmm1.setApproved(Boolean.TRUE);
238:                pmm1.setAttachments(getAttachments());
239:                pmm1.setAuthor("suzie q.");
240:                pmm1.setBody("Drafted :this is  the body 1");
241:                pmm1.setCreated(new Date());
242:                pmm1.setCreatedBy("john smith");
243:                pmm1.setGradebook("gb1");
244:                pmm1.setGradebookAssignment("asst1");
245:                pmm1.setId(new Long(3));
246:                pmm1.setInReplyTo(null);
247:                pmm1.setLabel("Normal");
248:                pmm1.setModified(new Date());
249:                pmm1.setModifiedBy("joe davis");
250:                pmm1.setTitle("Drafted the first message posted");
251:                pmm1.setUuid("3");
252:                pmm1.setExternalEmail(Boolean.TRUE);
253:                pmm1.setExternalEmailAddress("fun@hotmail.com");
254:                pmm1.setRecipients(new ArrayList()); // TODO: Real sakai users needed
255:
256:                PrivateMessage pmm2 = new PrivateMessageImpl();
257:                pmm2.setApproved(Boolean.TRUE);
258:                pmm2.setAttachments(getAttachments());
259:                pmm2.setAuthor("suzie q.");
260:                pmm2.setBody("Drafted this is the body 2");
261:                pmm2.setCreated(new Date());
262:                pmm2.setCreatedBy("john smith");
263:                pmm2.setGradebook("gb1");
264:                pmm2.setGradebookAssignment("asst1");
265:                pmm2.setId(new Long(42));
266:                pmm2.setInReplyTo(pmm1);
267:                pmm2.setLabel("Normal");
268:                pmm2.setModified(new Date());
269:                pmm2.setModifiedBy("joe davis");
270:                pmm2.setTitle("the second message posted");
271:                pmm2.setUuid("42");
272:                pmm2.setExternalEmail(Boolean.FALSE);
273:                pmm2.setExternalEmailAddress(null);
274:                pmm2.setRecipients(new ArrayList()); // TODO: Real sakai users needed
275:                privateMessages.add(pmm1);
276:                privateMessages.add(pmm2);
277:                return privateMessages;
278:
279:            }
280:
281:            private List getDeletedPrivateMessages() {
282:                List privateMessages = new ArrayList();
283:                PrivateMessage pmm1 = new PrivateMessageImpl();
284:                pmm1.setApproved(Boolean.TRUE);
285:                pmm1.setAttachments(getAttachments());
286:                pmm1.setAuthor("suzie q.");
287:                pmm1.setBody("getDeletedPrivateMessages this is the body 1");
288:                pmm1.setCreated(new Date());
289:                pmm1.setCreatedBy("john smith");
290:                pmm1.setGradebook("gb1");
291:                pmm1.setGradebookAssignment("asst1");
292:                pmm1.setId(new Long(1213));
293:                pmm1.setInReplyTo(null);
294:                pmm1.setLabel("Normal");
295:                pmm1.setModified(new Date());
296:                pmm1.setModifiedBy("joe davis");
297:                pmm1
298:                        .setTitle("getDeletedPrivateMessages the first message posted");
299:                pmm1.setUuid("admin");
300:                pmm1.setExternalEmail(Boolean.TRUE);
301:                pmm1.setExternalEmailAddress("fun@hotmail.com");
302:                pmm1.setRecipients(new ArrayList()); // TODO: Real sakai users needed
303:
304:                PrivateMessage pmm2 = new PrivateMessageImpl();
305:                pmm2.setApproved(Boolean.TRUE);
306:                pmm2.setAttachments(getAttachments());
307:                pmm2.setAuthor("suzie q.");
308:                pmm2.setBody("getDeletedPrivateMessages this is the body 2");
309:                pmm2.setCreated(new Date());
310:                pmm2.setCreatedBy("john smith");
311:                pmm2.setGradebook("gb1");
312:                pmm2.setGradebookAssignment("asst1");
313:                pmm2.setId(new Long(1214));
314:                pmm2.setInReplyTo(pmm1);
315:                pmm2.setLabel("getDeletedPrivateMessages Normal");
316:                pmm2.setModified(new Date());
317:                pmm2.setModifiedBy("joe davis");
318:                pmm2
319:                        .setTitle("getDeletedPrivateMessages the second message posted");
320:                pmm2.setUuid("1214");
321:                pmm2.setExternalEmail(Boolean.FALSE);
322:                pmm2.setExternalEmailAddress(null);
323:                pmm2.setRecipients(new ArrayList()); // TODO: Real sakai users needed
324:                privateMessages.add(pmm1);
325:                privateMessages.add(pmm2);
326:                return privateMessages;
327:
328:            }
329:
330:            private List getSentPrivateMessages() {
331:                List privateMessages = new ArrayList();
332:                PrivateMessage pmm1 = new PrivateMessageImpl();
333:                pmm1.setApproved(Boolean.TRUE);
334:                pmm1.setAttachments(getAttachments());
335:                pmm1.setAuthor("suzie q.");
336:                pmm1.setBody("this is the body 1");
337:                pmm1.setCreated(new Date());
338:                pmm1.setCreatedBy("john smith");
339:                pmm1.setGradebook("gb1");
340:                pmm1.setGradebookAssignment("asst1");
341:                pmm1.setId(new Long(13));
342:                pmm1.setInReplyTo(null);
343:                pmm1.setLabel("Normal");
344:                pmm1.setModified(new Date());
345:                pmm1.setModifiedBy("joe davis");
346:                pmm1.setTitle("the first message posted");
347:                pmm1.setUuid("3");
348:                pmm1.setExternalEmail(Boolean.TRUE);
349:                pmm1.setExternalEmailAddress("fun@hotmail.com");
350:                pmm1.setRecipients(new ArrayList()); // TODO: Real sakai users needed
351:
352:                PrivateMessage pmm2 = new PrivateMessageImpl();
353:                pmm2.setApproved(Boolean.TRUE);
354:                pmm2.setAttachments(getAttachments());
355:                pmm2.setAuthor("suzie q.");
356:                pmm2.setBody("this is the body 2");
357:                pmm2.setCreated(new Date());
358:                pmm2.setCreatedBy("john smith");
359:                pmm2.setGradebook("gb1");
360:                pmm2.setGradebookAssignment("asst1");
361:                pmm2.setId(new Long(4));
362:                pmm2.setInReplyTo(pmm1);
363:                pmm2.setLabel("Normal");
364:                pmm2.setModified(new Date());
365:                pmm2.setModifiedBy("joe davis");
366:                pmm2.setTitle("the second message posted");
367:                pmm2.setUuid("14");
368:                pmm2.setExternalEmail(Boolean.FALSE);
369:                pmm2.setExternalEmailAddress(null);
370:                pmm2.setRecipients(new ArrayList()); // TODO: Real sakai users needed
371:                privateMessages.add(pmm1);
372:                privateMessages.add(pmm2);
373:                return privateMessages;
374:
375:            }
376:
377:            private List getReceivedPrivateMessages() {
378:                List privateMessages = new ArrayList();
379:                PrivateMessage pmm1 = new PrivateMessageImpl();
380:                pmm1.setApproved(Boolean.TRUE);
381:                pmm1.setAttachments(getAttachments());
382:                pmm1.setAuthor("suzie q.");
383:                pmm1.setBody("this is the body 1");
384:                pmm1.setCreated(new Date());
385:                pmm1.setCreatedBy("john smith");
386:                pmm1.setGradebook("gb1");
387:                pmm1.setGradebookAssignment("asst1");
388:                pmm1.setId(new Long(13));
389:                pmm1.setInReplyTo(null);
390:                pmm1.setLabel("Normal");
391:                pmm1.setModified(new Date());
392:                pmm1.setModifiedBy("joe davis");
393:                pmm1.setTitle("the first message posted");
394:                pmm1.setUuid("3");
395:                pmm1.setExternalEmail(Boolean.TRUE);
396:                pmm1.setExternalEmailAddress("fun@hotmail.com");
397:                pmm1.setRecipients(new ArrayList()); // TODO: Real sakai users needed
398:
399:                PrivateMessage pmm2 = new PrivateMessageImpl();
400:                pmm2.setApproved(Boolean.TRUE);
401:                pmm2.setAttachments(getAttachments());
402:                pmm2.setAuthor("suzie q.");
403:                pmm2.setBody("this is the body 2");
404:                pmm2.setCreated(new Date());
405:                pmm2.setCreatedBy("john smith");
406:                pmm2.setGradebook("gb1");
407:                pmm2.setGradebookAssignment("asst1");
408:                pmm2.setId(new Long(4));
409:                pmm2.setInReplyTo(pmm1);
410:                pmm2.setLabel("Normal");
411:                pmm2.setModified(new Date());
412:                pmm2.setModifiedBy("joe davis");
413:                pmm2.setTitle("the second message posted");
414:                pmm2.setUuid("14");
415:                pmm2.setExternalEmail(Boolean.FALSE);
416:                pmm2.setExternalEmailAddress(null);
417:                pmm2.setRecipients(new ArrayList()); // TODO: Real sakai users needed
418:                privateMessages.add(pmm1);
419:                privateMessages.add(pmm2);
420:                return privateMessages;
421:            }
422:
423:            //**********************************************************************************
424:            public Area getDiscussionForumArea() {
425:                Area a2 = new AreaImpl();
426:                a2.setContextId("context2");
427:                a2.setHidden(Boolean.FALSE);
428:                a2.setName("Forums");
429:                a2.setCreated(new Date());
430:                a2.setCreatedBy("john doe");
431:                a2.setModified(new Date());
432:                a2.setModifiedBy("mary jane");
433:                a2.setId(new Long(2));
434:                a2.setUuid("2");
435:                //a2.setDiscussionForums(getDiscussionForums());
436:                return a2;
437:            }
438:
439:            private List getDiscussionForums() {
440:                List dicussionForums = new ArrayList();
441:                dicussionForums.add(getDiscussionForumByID5());
442:                dicussionForums.add(getDiscussionForumByID6());
443:                return dicussionForums;
444:            }
445:
446:            private DiscussionForum getDiscussionForumByID5() {
447:                DiscussionForum dfm1 = new DiscussionForumImpl();
448:                dfm1.setActorPermissions(getActorPermissions());
449:                dfm1.setAttachments(getAttachments());
450:                dfm1.setCreated(new Date());
451:                dfm1.setCreatedBy("admin");
452:                dfm1.setDateRestrictions(getDateRestrictions());
453:                dfm1
454:                        .setExtendedDescription("This forum is used to discuss assigned case studies. You should follow the case study preparation instructions before posting.");
455:                dfm1.setId(new Long(5));
456:                dfm1.setUuid("5");
457:                dfm1.setLabels(getLabels());
458:                dfm1.setLocked(Boolean.FALSE);
459:                dfm1.setModerated(Boolean.TRUE);
460:                dfm1.setModified(new Date());
461:                dfm1.setModifiedBy("admin");
462:                dfm1
463:                        .setShortDescription("This forum is used to discuss assigned case studies. You should follow the case study preparation instructions before posting.");
464:                dfm1.setTitle("Case Studies");
465:                dfm1.setTopics(list2set(getDiscussionTopics()));
466:                return dfm1;
467:            }
468:
469:            private DiscussionForum getDiscussionForumByID6() {
470:                DiscussionForum dfm2 = new DiscussionForumImpl();
471:                dfm2.setActorPermissions(getActorPermissions());
472:                dfm2.setAttachments(getAttachments());
473:                dfm2.setCreated(new Date());
474:                dfm2.setCreatedBy("jim johnson");
475:                dfm2.setDateRestrictions(getDateRestrictions());
476:                dfm2.setExtendedDescription("the extended description 2");
477:                dfm2.setId(new Long(6));
478:                dfm2.setUuid("6");
479:                dfm2.setLabels(getLabels());
480:                dfm2.setLocked(Boolean.TRUE);
481:                dfm2.setModerated(Boolean.FALSE);
482:                dfm2.setModified(new Date());
483:                dfm2.setModifiedBy("the moderator");
484:                dfm2.setShortDescription("sort desc here...");
485:                dfm2.setTitle("disc forum 2");
486:                dfm2.setTopics(list2set(getDiscussionTopics()));
487:                return dfm2;
488:            }
489:
490:            private List getForumMessages() {
491:                List forumMessages = new ArrayList();
492:                forumMessages.add(getMessageByID3());
493:                forumMessages.add(getMessageByID4());
494:                return forumMessages;
495:            }
496:
497:            private Message getMessageByID3() {
498:                Message mm1 = new MessageImpl();
499:                mm1.setApproved(Boolean.TRUE);
500:                mm1.setAttachments(getAttachments());
501:                mm1.setAuthor("suzie q.");
502:                mm1.setBody("this is the body 1");
503:                mm1.setCreated(new Date());
504:                mm1.setCreatedBy("john smith");
505:                mm1.setGradebook("gb1");
506:                mm1.setGradebookAssignment("asst1");
507:                mm1.setId(new Long(3));
508:                mm1.setInReplyTo(null);
509:                mm1.setLabel("Normal");
510:                mm1.setModified(new Date());
511:                mm1.setModifiedBy("joe davis");
512:                mm1.setTitle("the first message posted");
513:                mm1.setUuid("3");
514:                return mm1;
515:            }
516:
517:            private Message getMessageByID4() {
518:                Message mm2 = new MessageImpl();
519:                mm2.setApproved(Boolean.TRUE);
520:                mm2.setAttachments(getAttachments());
521:                mm2.setAuthor("suzie q.");
522:                mm2.setBody("this is the body 2");
523:                mm2.setCreated(new Date());
524:                mm2.setCreatedBy("john smith");
525:                mm2.setGradebook("gb1");
526:                mm2.setGradebookAssignment("asst1");
527:                mm2.setId(new Long(4));
528:                mm2.setInReplyTo(getMessageByID3());
529:                mm2.setLabel("Normal");
530:                mm2.setModified(new Date());
531:                mm2.setModifiedBy("joe davis");
532:                mm2.setTitle("the second message posted");
533:                mm2.setUuid("4");
534:                return mm2;
535:            }
536:
537:            private List getDiscussionTopics() {
538:                List discussionTopics = new ArrayList();
539:                discussionTopics.add(getDiscussionTopicByID11());
540:                discussionTopics.add(getDiscussionTopicByID511());
541:                discussionTopics.add(getDiscussionTopicByID521());
542:                return discussionTopics;
543:            }
544:
545:            //parent 5
546:            private DiscussionTopic getDiscussionTopicByID11() {
547:                DiscussionTopic dtm1 = new DiscussionTopicImpl();
548:                //dtm1.setBaseForum(getForumById("5"));
549:                dtm1.setActorPermissions(getActorPermissions());
550:                dtm1.setAttachments(getAttachments());
551:                dtm1.setCreated(new Date());
552:                dtm1.setCreatedBy("admin");
553:                dtm1.setDateRestrictions(getDateRestrictions());
554:                dtm1
555:                        .setExtendedDescription("Extended: The case requires at lease two decisions in setting your strategy to advance the project: 1. Which customer groups to include in the project scope? 2. Should Customs be included as a development partner?");
556:                dtm1.setId(new Long(11));
557:                dtm1.setUuid("11");
558:                dtm1.setLabels(getLabels());
559:                dtm1.setLocked(Boolean.FALSE);
560:                dtm1.setModerated(Boolean.TRUE);
561:                dtm1.setModified(new Date());
562:                dtm1.setModifiedBy("the moderator");
563:                dtm1.setShortDescription("sort desc here...");
564:                dtm1.setTitle("Dubai Port Authority Case ");
565:                // dtm1.setType(new TypeImpl());
566:                dtm1.setConfidentialResponses(Boolean.TRUE);
567:                dtm1.setGradebook("gb2-1");
568:                dtm1.setGradebookAssignment("asst2");
569:                dtm1.setHourBeforeResponsesVisible(new Integer(2));
570:                dtm1.setMustRespondBeforeReading(Boolean.TRUE);
571:                dtm1.setMutable(Boolean.TRUE);
572:                dtm1.setSortIndex(new Integer(1));
573:                dtm1.setMessages(getForumMessages());
574:                return dtm1;
575:            }
576:
577:            //parent 5
578:            private DiscussionTopic getDiscussionTopicByID511() {
579:                DiscussionTopic dtm1 = new DiscussionTopicImpl();
580:                // dtm1.setBaseForum(getForumById("5"));
581:                dtm1.setActorPermissions(getActorPermissions());
582:                dtm1.setAttachments(getAttachments());
583:                dtm1.setCreated(new Date());
584:                dtm1.setCreatedBy("admin");
585:                dtm1.setDateRestrictions(getDateRestrictions());
586:                dtm1
587:                        .setExtendedDescription("Extended: The case requires at lease two decisions in setting your strategy to advance the project: 1. Which customer groups to include in the project scope? 2. Should Customs be included as a development partner?");
588:                dtm1.setId(new Long(11));
589:                dtm1.setUuid("511");
590:                dtm1.setLabels(getLabels());
591:                dtm1.setLocked(Boolean.FALSE);
592:                dtm1.setModerated(Boolean.TRUE);
593:                dtm1.setModified(new Date());
594:                dtm1.setModifiedBy("the moderator");
595:                dtm1
596:                        .setShortDescription("Assess the technical choices rode by KPMG following the choice not to fund the Shadow Partner project. Do you believe they made wise or risky decisions? Why?");
597:                dtm1.setTitle("KPMG: One Giant Brain Case");
598:                // dtm1.setType(new TypeImpl());
599:                dtm1.setConfidentialResponses(Boolean.TRUE);
600:                dtm1.setGradebook("gb2-1");
601:                dtm1.setGradebookAssignment("asst2");
602:                dtm1.setHourBeforeResponsesVisible(new Integer(2));
603:                dtm1.setMustRespondBeforeReading(Boolean.TRUE);
604:                dtm1.setMutable(Boolean.TRUE);
605:                dtm1.setSortIndex(new Integer(1));
606:                dtm1.setMessages(getForumMessages());
607:                return dtm1;
608:            }
609:
610:            //parent 5
611:            private DiscussionTopic getDiscussionTopicByID521() {
612:                DiscussionTopic dtm1 = new DiscussionTopicImpl();
613:                //dtm1.setBaseForum(getForumById("5"));
614:                dtm1.setActorPermissions(getActorPermissions());
615:                dtm1.setAttachments(getAttachments());
616:                dtm1.setCreated(new Date());
617:                dtm1.setCreatedBy("admin");
618:                dtm1.setDateRestrictions(getDateRestrictions());
619:                dtm1
620:                        .setExtendedDescription("Extended: The case requires at lease two decisions in setting your strategy to advance the project: 1. Which customer groups to include in the project scope? 2. Should Customs be included as a development partner?");
621:                dtm1.setId(new Long(11));
622:                dtm1.setUuid("521");
623:                dtm1.setLabels(getLabels());
624:                dtm1.setLocked(Boolean.FALSE);
625:                dtm1.setModerated(Boolean.TRUE);
626:                dtm1.setModified(new Date());
627:                dtm1.setModifiedBy("the moderator");
628:                dtm1
629:                        .setShortDescription("What lessons, if any, should the Company learn from the Maxfli experience regarding future development?");
630:                dtm1.setTitle("Maxfli Case");
631:                // dtm1.setType(new TypeImpl());
632:                dtm1.setConfidentialResponses(Boolean.TRUE);
633:                dtm1.setGradebook("gb2-1");
634:                dtm1.setGradebookAssignment("asst2");
635:                dtm1.setHourBeforeResponsesVisible(new Integer(2));
636:                dtm1.setMustRespondBeforeReading(Boolean.TRUE);
637:                dtm1.setMutable(Boolean.TRUE);
638:                dtm1.setSortIndex(new Integer(1));
639:                dtm1.setMessages(getForumMessages());
640:                return dtm1;
641:            }
642:
643:            // helpers -- if someone needs to get access to one of these
644:            // just make it public... they were created so these object are
645:            // easy to still in the lists above
646:
647:            private List getAttachments() {
648:                List attachments = new ArrayList();
649:                Attachment a1 = new AttachmentImpl();
650:                a1.setAttachmentId("attach1");
651:                a1.setAttachmentName("file 1.doc");
652:                a1.setAttachmentSize("24K");
653:                a1.setAttachmentType("application/msword");
654:                a1.setAttachmentUrl("http://www.something.com/afile");
655:                Attachment a2 = new AttachmentImpl();
656:                a2.setAttachmentId("attach2");
657:                a2.setAttachmentName("file 2.doc");
658:                a2.setAttachmentSize("243K");
659:                a2.setAttachmentType("application/msword");
660:                a2.setAttachmentUrl("http://www.something.com/anotherfile");
661:                attachments.add(a1);
662:                attachments.add(a2);
663:                return attachments;
664:            }
665:
666:            private List getLabels() {
667:                List labels = new ArrayList();
668:                Label l1 = new LabelImpl();
669:                l1.setKey("group-key");
670:                l1.setValue("group");
671:                Label l2 = new LabelImpl();
672:                l2.setKey("partner-key");
673:                l2.setValue("partner");
674:                Label l3 = new LabelImpl();
675:                l3.setKey("alone-key");
676:                l3.setValue("alone");
677:                labels.add(l1);
678:                labels.add(l2);
679:                labels.add(l3);
680:                return labels;
681:            }
682:
683:            private ActorPermissions getActorPermissions() {
684:                ActorPermissions apm = new ActorPermissionsImpl();
685:                // TODO: Not sure how sakai handles users - empty lists for now
686:                apm.setAccessors(new ArrayList());
687:                apm.setContributors(new ArrayList());
688:                apm.setModerators(new ArrayList());
689:                apm.setId(new Long(123));
690:                return null;
691:            }
692:
693:            private ControlPermissions getControlPermissions() {
694:                ControlPermissions cpm = new ControlPermissionsImpl();
695:                cpm.setChangeSettings(Boolean.TRUE);
696:                cpm.setId(new Long(234));
697:                cpm.setMovePostings(Boolean.TRUE);
698:                cpm.setNewResponse(Boolean.TRUE);
699:                cpm.setNewTopic(Boolean.TRUE);
700:                cpm.setResponseToResponse(Boolean.TRUE);
701:                cpm.setRole("Not sure what sakai roles are");
702:                return cpm;
703:            }
704:
705:            private DateRestrictions getDateRestrictions() {
706:                DateRestrictions drm = new DateRestrictionsImpl();
707:                drm.setHidden(new Date());
708:                drm.setHiddenPostOnSchedule(Boolean.TRUE);
709:                drm.setId(new Long(22));
710:                drm.setPostingAllowed(new Date());
711:                drm.setPostingAllowedPostOnSchedule(Boolean.TRUE);
712:                drm.setReadOnly(new Date());
713:                drm.setReadOnlyPostOnSchedule(Boolean.TRUE);
714:                drm.setVisible(new Date());
715:                drm.setVisiblePostOnSchedule(Boolean.TRUE);
716:                return drm;
717:            }
718:
719:            private MessagePermissions getMessgePermissions() {
720:                MessagePermissions mpm = new MessagePermissionsImpl();
721:                mpm.setDeleteAny(Boolean.TRUE);
722:                mpm.setDeleteOwn(Boolean.TRUE);
723:                mpm.setId(new Long(22));
724:                mpm.setRead(Boolean.TRUE);
725:                mpm.setReadDrafts(Boolean.TRUE);
726:                mpm.setReviseAny(Boolean.TRUE);
727:                mpm.setReviseOwn(Boolean.TRUE);
728:                mpm.setRole("Not sure what sakai roles are");
729:                return mpm;
730:            }
731:
732:            private List list2set(List list) {
733:                List set = new ArrayList();
734:                for (Iterator iter = list.iterator(); iter.hasNext();) {
735:                    Object object = (Object) iter.next();
736:                    set.add(object);
737:                }
738:                return set;
739:            }
740:
741:            public boolean isPrivateAreaUnabled() {
742:                return true;
743:            }
744:
745:            public void setTypeMgr(MessageForumsTypeManager typeMgr) {
746:                this .typeMgr = typeMgr;
747:            }
748:
749:            public DiscussionForum getForumById(Long forumId) {
750:                if (forumId != null && forumId.equals(new Long(5))) {
751:
752:                    return getDiscussionForumByID5();
753:                } else {
754:                    return getDiscussionForumByID6();
755:                }
756:            }
757:
758:            public List getMessagesByTopicId(Long topicId) {
759:                // TODO Auto-generated method stub
760:                return null;
761:            }
762:
763:            public DiscussionTopic getTopicById(Long topicId) {
764:                if (topicId.equals(new Long(511))) {
765:                    return getDiscussionTopicByID511();
766:                }
767:                if (topicId.equals(new Long(521))) {
768:                    return getDiscussionTopicByID521();
769:                }
770:                return getDiscussionTopicByID11();
771:            }
772:
773:            public boolean hasNextTopic(DiscussionTopic topic) {
774:                if (topic.getUuid().equals("11")) {
775:                    return true;
776:                }
777:                if (topic.getUuid().equals("511")) {
778:                    return true;
779:                }
780:                return false;
781:            }
782:
783:            public boolean hasPreviousTopic(DiscussionTopic topic) {
784:                if (topic.getUuid().equals("521")) {
785:                    return true;
786:                }
787:                if (topic.getUuid().equals("511")) {
788:                    return true;
789:                }
790:                return false;
791:            }
792:
793:            public DiscussionTopic getNextTopic(DiscussionTopic topic) {
794:                if (topic.getUuid().equals("11")) {
795:                    return getDiscussionTopicByID511();
796:                }
797:                if (topic.getUuid().equals("511")) {
798:                    return getDiscussionTopicByID521();
799:                }
800:                return null;
801:            }
802:
803:            public DiscussionTopic getPreviousTopic(DiscussionTopic topic) {
804:                if (topic.getUuid().equals("512")) {
805:                    return getDiscussionTopicByID511();
806:                }
807:                if (topic.getUuid().equals("511")) {
808:                    return getDiscussionTopicByID11();
809:                }
810:                return null;
811:            }
812:
813:            public Message getMessageById(Long id) {
814:                if (id.equals(new Long(3)))
815:                    return getMessageByID3();
816:                else
817:                    return getMessageByID4();
818:            }
819:
820:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.