Source Code Cross Referenced for DatabaseComment.java in  » Blogger-System » blojsom-3.1 » org » blojsom » blog » database » 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 » Blogger System » blojsom 3.1 » org.blojsom.blog.database 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Copyright (c) 2003-2007, David A. Czarnecki
003:         * All rights reserved.
004:         *
005:         * Redistribution and use in source and binary forms, with or without
006:         * modification, are permitted provided that the following conditions are met:
007:         *
008:         * Redistributions of source code must retain the above copyright notice, this list of conditions and the
009:         *     following disclaimer.
010:         * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
011:         *     following disclaimer in the documentation and/or other materials provided with the distribution.
012:         * Neither the name of "David A. Czarnecki" and "blojsom" nor the names of its contributors may be used to
013:         *     endorse or promote products derived from this software without specific prior written permission.
014:         * Products derived from this software may not be called "blojsom", nor may "blojsom" appear in their name,
015:         *     without prior written permission of David A. Czarnecki.
016:         *
017:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
018:         * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
019:         * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
020:         * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
021:         * EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
022:         * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
023:         * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
024:         * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
025:         * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
026:         * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
027:         * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
028:         * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
029:         * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
030:         */package org.blojsom.blog.database;
031:
032:        import org.blojsom.blog.Comment;
033:        import org.blojsom.blog.Entry;
034:        import org.blojsom.util.BlojsomUtils;
035:
036:        import java.io.Serializable;
037:        import java.util.Date;
038:        import java.util.Map;
039:        import java.util.HashMap;
040:        import java.util.Locale;
041:        import java.text.SimpleDateFormat;
042:
043:        /**
044:         * DatabaseComment
045:         *
046:         * @author David Czarnecki
047:         * @since blojsom 3.0
048:         * @version $Id: DatabaseComment.java,v 1.8 2007/01/17 02:35:16 czarneckid Exp $
049:         */
050:        public class DatabaseComment implements  Comment, Serializable {
051:
052:            protected Integer _id;
053:            protected Integer _blogId;
054:            protected Integer _blogEntryId;
055:            protected Entry _entry;
056:
057:            protected String _author;
058:            protected String _authorEmail;
059:            protected String _authorURL;
060:            protected String _comment;
061:            protected Date _commentDate;
062:            protected Map _metaData;
063:            protected Integer _parentId;
064:            protected String _status;
065:            protected String _ip;
066:
067:            /**
068:             * Create a new instance of the database comment
069:             */
070:            public DatabaseComment() {
071:            }
072:
073:            /**
074:             * Get the id of this blog comment
075:             *
076:             * @return Id
077:             */
078:            public Integer getId() {
079:                return _id;
080:            }
081:
082:            /**
083:             * Set the id of this blog comment. This method can only be called if the id has not been set.
084:             *
085:             * @param id New id
086:             */
087:            public void setId(Integer id) {
088:                if (_id == null) {
089:                    _id = id;
090:                }
091:            }
092:
093:            /**
094:             * Set the blog ID
095:             *
096:             * @param blogId Blog ID
097:             */
098:            public void setBlogId(Integer blogId) {
099:                _blogId = blogId;
100:            }
101:
102:            /**
103:             * Get the blog ID
104:             *
105:             * @return Blog ID
106:             */
107:            public Integer getBlogId() {
108:                return _blogId;
109:            }
110:
111:            /**
112:             * Get the blog entry ID
113:             *
114:             * @return Blog entry ID
115:             */
116:            public Integer getBlogEntryId() {
117:                return _blogEntryId;
118:            }
119:
120:            /**
121:             * Set the blog entry ID
122:             *
123:             * @param blogEntryId Blog entry ID
124:             */
125:            public void setBlogEntryId(Integer blogEntryId) {
126:                _blogEntryId = blogEntryId;
127:            }
128:
129:            /**
130:             * Get the {@link Entry}
131:             *
132:             * @return {@link Entry}
133:             */
134:            public Entry getEntry() {
135:                return _entry;
136:            }
137:
138:            /**
139:             * Set the {@link Entry}
140:             *
141:             * @param entry {@link Entry}
142:             */
143:            public void setEntry(Entry entry) {
144:                _entry = entry;
145:                _blogEntryId = _entry.getId();
146:            }
147:
148:            /**
149:             * Get the author of the comment
150:             *
151:             * @return Comment author
152:             */
153:            public String getAuthor() {
154:                return _author;
155:            }
156:
157:            /**
158:             * Get the author as an escaped string
159:             *
160:             * @return Escaped author
161:             */
162:            public String getEscapedAuthor() {
163:                return BlojsomUtils.escapeString(_author);
164:            }
165:
166:            /**
167:             * Set the author of the comment
168:             *
169:             * @param author Comment's new author
170:             */
171:            public void setAuthor(String author) {
172:                _author = author;
173:            }
174:
175:            /**
176:             * Get the e-mail of the author of the comment
177:             *
178:             * @return Author's e-mail
179:             */
180:            public String getAuthorEmail() {
181:                return _authorEmail;
182:            }
183:
184:            /**
185:             * Get the escaped e-mail of the author of the comment
186:             *
187:             * @return Escaped author e-mail
188:             */
189:            public String getEscapedAuthorEmail() {
190:                return BlojsomUtils.escapeString(_authorEmail);
191:            }
192:
193:            /**
194:             * Set the e-mail of the author of the comment
195:             *
196:             * @param authorEmail Author's new e-mail
197:             */
198:            public void setAuthorEmail(String authorEmail) {
199:                _authorEmail = authorEmail;
200:            }
201:
202:            /**
203:             * Get the URL of the author
204:             *
205:             * @return Author's URL
206:             */
207:            public String getAuthorURL() {
208:                return _authorURL;
209:            }
210:
211:            /**
212:             * Get the escaped URL of the author
213:             *
214:             * @return Escaped URL
215:             */
216:            public String getEscapedAuthorURL() {
217:                return BlojsomUtils.escapeString(_authorURL);
218:            }
219:
220:            /**
221:             * Set the URL for the author
222:             *
223:             * @param authorURL New URL for the author
224:             */
225:            public void setAuthorURL(String authorURL) {
226:                _authorURL = authorURL;
227:            }
228:
229:            /**
230:             * Get the comment as a escaped string
231:             * @return Escaped Comment
232:             */
233:            public String getEscapedComment() {
234:                return BlojsomUtils.escapeString(_comment);
235:            }
236:
237:            /**
238:             * Get the comment
239:             *
240:             * @return Comment
241:             */
242:            public String getComment() {
243:                return _comment;
244:            }
245:
246:            /**
247:             * Set the new comment
248:             *
249:             * @param comment New comment
250:             */
251:            public void setComment(String comment) {
252:                _comment = comment;
253:            }
254:
255:            /**
256:             * Get the date the comment was entered
257:             *
258:             * @return Comment date
259:             */
260:            public Date getCommentDate() {
261:                return _commentDate;
262:            }
263:
264:            /**
265:             * Return an ISO 8601 style date
266:             * http://www.w3.org/TR/NOTE-datetime
267:             *
268:             * @return Date formatted in ISO 8601 format
269:             */
270:            public String getISO8601Date() {
271:                return BlojsomUtils.getISO8601Date(_commentDate);
272:            }
273:
274:            /**
275:             * Return an RFC 822 style date
276:             *
277:             * @return Date formatted in RFC 822 format
278:             */
279:            public String getRFC822Date() {
280:                return BlojsomUtils.getRFC822Date(_commentDate);
281:            }
282:
283:            /**
284:             * Get the comment meta-data
285:             *
286:             * @return Meta-data as a {@link Map}
287:             */
288:            public Map getMetaData() {
289:                if (_metaData == null) {
290:                    return new HashMap();
291:                }
292:
293:                return _metaData;
294:            }
295:
296:            /**
297:             * Set the date for the comment
298:             *
299:             * @param commentDate Comment date
300:             */
301:            public void setCommentDate(Date commentDate) {
302:                _commentDate = commentDate;
303:            }
304:
305:            /**
306:             * Set the comment meta-data
307:             *
308:             * @param metaData {@link Map} containing meta-data for this comment
309:             */
310:            public void setMetaData(Map metaData) {
311:                _metaData = metaData;
312:            }
313:
314:            /**
315:             * Return the comment date formatted with a specified date format
316:             *
317:             * @param format Date format
318:             * @return <code>null</code> if the comment date or format is null, otherwise returns the comment date
319:             *         formatted to the specified format. If the format is invalid, returns <tt>commentDate.toString()</tt>
320:             */
321:            public String getDateAsFormat(String format) {
322:                return getDateAsFormat(format, null);
323:            }
324:
325:            /**
326:             * Return the comment date formatted with a specified date format
327:             *
328:             * @param format Date format
329:             * @param locale Locale for date formatting
330:             * @return <code>null</code> if the entry date or format is null, otherwise returns the entry date formatted to the specified format. If the format is invalid, returns <tt>commentDate.toString()</tt>
331:             */
332:            public String getDateAsFormat(String format, Locale locale) {
333:                if (_commentDate == null || format == null) {
334:                    return null;
335:                }
336:
337:                SimpleDateFormat sdf;
338:                try {
339:                    if (locale == null) {
340:                        sdf = new SimpleDateFormat(format);
341:                    } else {
342:                        sdf = new SimpleDateFormat(format, locale);
343:                    }
344:
345:                    return sdf.format(_commentDate);
346:                } catch (IllegalArgumentException e) {
347:                    return _commentDate.toString();
348:                }
349:            }
350:
351:            /**
352:             * Get the comment parent ID
353:             *
354:             * @return Comment parent ID
355:             */
356:            public Integer getParentId() {
357:                return _parentId;
358:            }
359:
360:            /**
361:             * Set the comment parent ID
362:             *
363:             * @param parentId Comment parent ID
364:             */
365:            public void setParentId(Integer parentId) {
366:                _parentId = parentId;
367:            }
368:
369:            /**
370:             * Get the IP
371:             *
372:             * @return IP
373:             */
374:            public String getIp() {
375:                return _ip;
376:            }
377:
378:            /**
379:             * Set the IP
380:             *
381:             * @param ip IP
382:             */
383:            public void setIp(String ip) {
384:                _ip = ip;
385:            }
386:
387:            /**
388:             * Get the status
389:             *
390:             * @return Status
391:             */
392:            public String getStatus() {
393:                return _status;
394:            }
395:
396:            /**
397:             * Set the status
398:             *
399:             * @param status Status
400:             */
401:            public void setStatus(String status) {
402:                _status = status;
403:            }
404:
405:            /**
406:             * Retrieve the date for this object
407:             *
408:             * @return Date
409:             */
410:            public Date getDate() {
411:                return _commentDate;
412:            }
413:
414:            /**
415:             * Get the response type
416:             *
417:             * @return Response type
418:             */
419:            public String getType() {
420:                return COMMENT_TYPE;
421:            }
422:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.