Source Code Cross Referenced for LibraryItemDO.java in  » Groupware » ivatagroupware » com » ivata » groupware » business » library » item » 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 » Groupware » ivatagroupware » com.ivata.groupware.business.library.item 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2001 - 2005 ivata limited.
003:         * All rights reserved.
004:         * -----------------------------------------------------------------------------
005:         * ivata groupware may be redistributed under the GNU General Public
006:         * License as published by the Free Software Foundation;
007:         * version 2 of the License.
008:         *
009:         * These programs are free software; you can redistribute them and/or
010:         * modify them under the terms of the GNU General Public License
011:         * as published by the Free Software Foundation; version 2 of the License.
012:         *
013:         * These programs are distributed in the hope that they will be useful,
014:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016:         *
017:         * See the GNU General Public License in the file LICENSE.txt for more
018:         * details.
019:         *
020:         * If you would like a copy of the GNU General Public License write to
021:         *
022:         * Free Software Foundation, Inc.
023:         * 59 Temple Place - Suite 330
024:         * Boston, MA 02111-1307, USA.
025:         *
026:         *
027:         * To arrange commercial support and licensing, contact ivata at
028:         *                  http://www.ivata.com/contact.jsp
029:         * -----------------------------------------------------------------------------
030:         * $Log: LibraryItemDO.java,v $
031:         * Revision 1.4  2005/04/26 15:18:45  colinmacleod
032:         * Renamed Faq to FAQ.
033:         *
034:         * Revision 1.3  2005/04/10 20:31:59  colinmacleod
035:         * Added new themes.
036:         * Changed id type to String.
037:         * Changed i tag to em and b tag to strong.
038:         * Improved PicoContainerFactory with NanoContainer scripts.
039:         *
040:         * Revision 1.2  2005/04/09 17:19:45  colinmacleod
041:         * Changed copyright text to GPL v2 explicitly.
042:         *
043:         * Revision 1.1.1.1  2005/03/10 17:51:59  colinmacleod
044:         * Restructured ivata op around Hibernate/PicoContainer.
045:         * Renamed ivata groupware.
046:         *
047:         * Revision 1.3  2004/07/13 19:47:28  colinmacleod
048:         * Moved project to POJOs from EJBs.
049:         * Applied PicoContainer to services layer (replacing session EJBs).
050:         * Applied Hibernate to persistence layer (replacing entity EJBs).
051:         *
052:         * Revision 1.2  2004/03/21 21:16:29  colinmacleod
053:         * Shortened name to ivata op.
054:         *
055:         * Revision 1.1.1.1  2004/01/27 20:58:40  colinmacleod
056:         * Moved ivata openportal to SourceForge..
057:         *
058:         * Revision 1.4  2004/01/19 21:13:14  colin
059:         * Removed minutes for ivata groupware v0.9
060:         *
061:         * Revision 1.3  2003/10/28 13:16:14  jano
062:         * commiting library,
063:         * still fixing compile and building openGroupware project
064:         *
065:         * Revision 1.2  2003/10/15 14:16:53  colin
066:         * fixing for XDoclet
067:         *
068:         * Revision 1.1  2003/02/24 19:09:22  colin
069:         * moved to business
070:         *
071:         * Revision 1.3  2003/02/04 17:43:47  colin
072:         * copyright notice
073:         *
074:         * Revision 1.2  2002/07/02 14:56:31  colin
075:         * tried to fix jbuilder EJB designer
076:         *
077:         * Revision 1.1  2002/06/18 11:40:13  colin
078:         * first version of library
079:         * -----------------------------------------------------------------------------
080:         */
081:        package com.ivata.groupware.business.library.item;
082:
083:        import java.beans.XMLDecoder;
084:        import java.beans.XMLEncoder;
085:        import java.io.File;
086:        import java.io.FileOutputStream;
087:        import java.io.IOException;
088:        import java.util.List;
089:
090:        import com.ivata.groupware.business.drive.file.FileContentDO;
091:        import com.ivata.groupware.business.library.topic.TopicDO;
092:        import com.ivata.groupware.container.persistence.TimestampDO;
093:
094:        /**
095:         * <p>Represents a single item within the library. The item can be one of six
096:         * types:<br/>
097:         * <ul>
098:         *   <li>document</li>
099:         *   <li>Faq (Frequently Asked Question)</li>
100:         *   <li>memo</li>
101:         *   <li>note</li>
102:         *   <li>news item</li>
103:         *   <li>meeting agenda/minutes</li>
104:         * </ul></p>
105:         *
106:         * <p>This is a dependent value class, used to pass data back from the.</p>
107:         * {@link LibraryItemBean LibraryItemBean} to a client application.</p>
108:         *
109:         * <p><strong>Note:</strong> This class provides data from {@link LibraryItemBean LibraryItemBean}.
110:         * This is no local copy of the bean class, however, and changes here
111:         * will not be automatically reflected in {@link LibraryItemBean LibraryItemBean}.</p>
112:         *
113:         * @since   2002-06-14
114:         * @author Colin MacLeod
115:         * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
116:         * @version $Revision: 1.4 $
117:         * @see LibraryItemBean
118:         *
119:         * @hibernate.class
120:         *      table="library_item"
121:         */
122:        public class LibraryItemDO extends TimestampDO {
123:
124:            /**
125:             * <p>This method converts an XML file to a LibraryItemDO.</p>
126:             *
127:             * @param fileContent contains the XML to be converted
128:             * @return valid library item.
129:             */
130:            public static LibraryItemDO convertFromFile(
131:                    FileContentDO fileContent) {
132:                XMLDecoder decoder = new XMLDecoder(fileContent.getContent()
133:                        .getInputStream());
134:                LibraryItemDO itemDO = (LibraryItemDO) decoder.readObject();
135:
136:                decoder.close();
137:                return itemDO;
138:            }
139:
140:            /**
141:             * <p>If the item is frequently asked questions, store all the categoreies
142:             * of questions here.</p>
143:             */
144:            private List fAQCategories;
145:
146:            /**
147:             * <p>Store the directory to store images in for this library item.</p>
148:             */
149:            private String imageDirectory;
150:
151:            /**
152:             * <p>Store all the pages of this item, if it has pages.</p>
153:             */
154:            private List pages;
155:
156:            /**
157:             * <p>Store the summary text. This summary will appear on the noticeboard page,
158:             * giving an overview of the content of the item.</p>
159:             */
160:            private String summary;
161:
162:            /**
163:             * <p>Store the title for this item. Is usually used in the titlebar of the
164:             * window which displays the item.</p>
165:             */
166:            private String title;
167:
168:            /**
169:             * <p>Topics are used to group items together and apply rights.</p>
170:             */
171:            private TopicDO topic;
172:            /**
173:             * <p>Store the type of the item, to one of the values found in {@link LibraryItemConstants
174:             * LibraryItemConstants}.</p>
175:             */
176:            private Integer type;
177:
178:            /**
179:             * <p>If the item is frequently asked questions, set all the categoreies
180:             * of questions here.</p>
181:             *
182:             * @return fAQCategories <code>List</code> of <code>FAQCategoryDO</code>
183:             * instances.
184:             *
185:             * @hibernate.bag
186:             *      cascade="all"
187:             * @hibernate.collection-key
188:             *      column="library_item"
189:             * @hibernate.collection-one-to-many
190:             *      class="com.ivata.groupware.business.library.faq.category.FAQCategoryDO"
191:             */
192:            public List getFAQCategories() {
193:                return fAQCategories;
194:            }
195:
196:            /**
197:             * <p>Get the directory to store images in for this library item.</p>
198:             *
199:             * @return the directory to store images in for this library item.
200:             * @hibernate.property
201:             *      column="image_directory"
202:             */
203:            public final String getImageDirectory() {
204:                return imageDirectory;
205:            }
206:
207:            /**
208:             * <p>Set all the pages of this item, as a <code>List</code> of
209:             * <code>PageDO</code> instances.</p>
210:             *
211:             * <p>
212:             * <strong>Note:</strong> not all types have pages. Use this method only if this
213:             * library item represents a document, news item or meeting minutes.</p>
214:             *
215:             * @return page texts as a set of DO instances.
216:             *
217:             * @hibernate.bag
218:             *      cascade="all"
219:             * @hibernate.collection-key
220:             *      column="library_item"
221:             * @hibernate.collection-one-to-many
222:             *      class="com.ivata.groupware.business.library.page.PageDO"
223:             */
224:            public List getPages() {
225:                return pages;
226:            }
227:
228:            /**
229:             * <p>Set the summary text. This summary will appear on the noticeboard page,
230:             * giving an overview of the content of the item.</p>
231:             *
232:             * @return the summary text.
233:             * @hibernate.property
234:             */
235:            public final String getSummary() {
236:                return summary;
237:            }
238:
239:            /**
240:             * <p>Set the title for this item. Is usually used in the titlebar of the
241:             * window which displays the item.</p>
242:             *
243:             * @return the title for this item. Is usually used in the titlebar of the
244:             * window which displays the item.
245:             * @hibernate.property
246:             */
247:            public final String getTitle() {
248:                return title;
249:            }
250:
251:            /**
252:             * <p>Topics are used to group items together and apply rights.</p>
253:             *
254:             * @return current value of topic.
255:             * @hibernate.many-to-one
256:             *      column="library_topic"
257:             */
258:            public final TopicDO getTopic() {
259:                return topic;
260:            }
261:
262:            /**
263:             * <p>Get the type of the item, as one of the values found in {@link LibraryItemConstants
264:             * LibraryItemConstants}.</p>
265:             * @hibernate.property
266:             */
267:            public final Integer getType() {
268:                return type;
269:            }
270:
271:            /**
272:             * <p>This method will convert a library item to a to a file.
273:             * In this case it will be an XML file.</p>
274:             *
275:             * @return name of the file this library item was saved to.
276:             */
277:            public String saveToFile() throws IOException {
278:                String returnFileName = "";
279:
280:                // create temporary file
281:                File tmpFile = File.createTempFile("drive", "xml");
282:
283:                returnFileName = tmpFile.getPath();
284:                // write itemDO to file
285:                FileOutputStream file = new FileOutputStream(returnFileName);
286:                XMLEncoder encoder = new XMLEncoder(file);
287:
288:                encoder.writeObject(this );
289:                encoder.close();
290:                file.close();
291:
292:                return returnFileName;
293:            }
294:
295:            /**
296:             * <p>If the item is frequently asked questions, set all the categoreies
297:             * of questions here.</p>
298:             *
299:             * @param fAQCategories <code>List</code> of <code>FAQCategoryDO</code>
300:             * instances.
301:             */
302:            public final void setFAQCategories(final List fAQCategories) {
303:                this .fAQCategories = fAQCategories;
304:            }
305:
306:            /**
307:             * <p>Set the directory to store images in for this library item.</p>
308:             *
309:             * @param imageDirectory new value of image directory.
310:             */
311:            public final void setImageDirectory(final String imageDirectory) {
312:                this .imageDirectory = imageDirectory;
313:            }
314:
315:            /**
316:             * <p>Set all the pages of this item, as a <code>List</code> of
317:             * <code>PageDO</code> instances.</p>
318:             *
319:             * <p>
320:             * <strong>Note:</strong> not all types have pages. Use this method only if this
321:             * library item represents a document, news item or meeting minutes.</p>
322:             *
323:             * @param pages new value of page texts as a set of DO instances.
324:             */
325:            public final void setPages(final List pages) {
326:                this .pages = pages;
327:            }
328:
329:            /**
330:             * <p>Set the summary text. This summary will appear on the noticeboard page,
331:             * giving an overview of the content of the item.</p>
332:             *
333:             * @param summary summary of the item's contents.
334:             */
335:            public final void setSummary(final String summary) {
336:                this .summary = summary;
337:            }
338:
339:            /**
340:             * <p>Set the title for this item. Is usually used in the titlebar of the
341:             * window which displays the item.</p>
342:             *
343:             * @param title new value of title.
344:             */
345:            public final void setTitle(final String title) {
346:                this .title = title;
347:            }
348:
349:            /**
350:             * <p>Topics are used to group items together and apply rights.</p>
351:             *
352:             * @param topic new value of topic.
353:             */
354:            public final void setTopic(final TopicDO topic) {
355:                this .topic = topic;
356:            }
357:
358:            /**
359:             * <p>Set the type of the item, to one of the values found in {@link LibraryItemConstants
360:             * LibraryItemConstants}.</p>
361:             */
362:            public final void setType(final Integer type) {
363:                this.type = type;
364:            }
365:
366:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.