Source Code Cross Referenced for Blog.java in  » J2EE » OpenCore » org » opensubsystems » blog » data » 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 » J2EE » OpenCore » org.opensubsystems.blog.data 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2003 - 2007 OpenSubsystems s.r.o. Slovak Republic. All rights reserved.
003:         * 
004:         * Project: OpenChronicle
005:         * 
006:         * $Id: Blog.java,v 1.4 2007/01/18 06:03:31 bastafidli Exp $
007:         * 
008:         * This program is free software; you can redistribute it and/or modify
009:         * it under the terms of the GNU General Public License as published by
010:         * the Free Software Foundation; version 2 of the License. 
011:         * 
012:         * This program is distributed in the hope that it will be useful,
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
015:         * GNU General Public License for more details.
016:         * 
017:         * You should have received a copy of the GNU General Public License
018:         * along with this program; if not, write to the Free Software
019:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
020:         */
021:
022:        package org.opensubsystems.blog.data;
023:
024:        import java.sql.Timestamp;
025:
026:        import org.opensubsystems.core.data.DataConstant;
027:        import org.opensubsystems.core.data.DataObject;
028:        import org.opensubsystems.core.data.ModifiableDataObject;
029:        import org.opensubsystems.patterns.listdata.data.ListDefinition;
030:
031:        /**
032:         * Blog is a list of entries. Simples blog has name, description and set of 
033:         * entries added over the time.
034:         *
035:         * @version $Id: Blog.java,v 1.4 2007/01/18 06:03:31 bastafidli Exp $
036:         * @author Miro Halas
037:         * @code.reviewer Miro Halas
038:         * @code.reviewed Initial revision
039:         */
040:        public class Blog extends ModifiableDataObject {
041:            // Constants ////////////////////////////////////////////////////////////////
042:
043:            // List constants ///////////////////////////////////////////////////////////
044:
045:            /**
046:             * Code for table column.
047:             */
048:            public static final int COL_BLOG_ID = DataConstant.BLOG_DATA_TYPE + 1;
049:
050:            /**
051:             * Object code for table column.
052:             */
053:            public static final Integer COL_BLOG_ID_OBJ = new Integer(
054:                    COL_BLOG_ID);
055:
056:            /**
057:             * Code for table column.
058:             */
059:            public static final int COL_BLOG_DOMAIN_ID = DataConstant.BLOG_DATA_TYPE + 2;
060:
061:            /**
062:             * Code for table column.
063:             */
064:            public static final int COL_BLOG_FOLDER = DataConstant.BLOG_DATA_TYPE + 3;
065:
066:            /**
067:             * Object code for table column.
068:             */
069:            public static final Integer COL_BLOG_FOLDER_OBJ = new Integer(
070:                    COL_BLOG_FOLDER);
071:
072:            /**
073:             * Code for table column.
074:             */
075:            public static final int COL_BLOG_CAPTION = DataConstant.BLOG_DATA_TYPE + 4;
076:
077:            /**
078:             * Object code for table column.
079:             */
080:            public static final Integer COL_BLOG_CAPTION_OBJ = new Integer(
081:                    COL_BLOG_CAPTION);
082:
083:            /**
084:             * Code for table column.
085:             */
086:            public static final int COL_BLOG_COMMENTS = DataConstant.BLOG_DATA_TYPE + 5;
087:
088:            /**
089:             * Object code for table column.
090:             */
091:            public static final Integer COL_BLOG_COMMENTS_OBJ = new Integer(
092:                    COL_BLOG_COMMENTS);
093:
094:            /**
095:             * Code for table column.
096:             */
097:            public static final int COL_BLOG_CREATION_DATE = DataConstant.BLOG_DATA_TYPE + 6;
098:
099:            /**
100:             * Code for table column.
101:             */
102:            public static final int COL_BLOG_MODIFICATION_DATE = DataConstant.BLOG_DATA_TYPE + 7;
103:
104:            /**
105:             * Static variable for array of all columns codes.
106:             * The order is important since it is used to retrieve all data from the
107:             * persistence store efficiently so do not modify it unless you make
108:             * changes to other places as well.
109:             */
110:            public static final int[] ALL_COLUMNS = { COL_BLOG_ID,
111:                    COL_BLOG_DOMAIN_ID, COL_BLOG_CAPTION, COL_BLOG_COMMENTS,
112:                    COL_BLOG_FOLDER, COL_BLOG_CREATION_DATE,
113:                    COL_BLOG_MODIFICATION_DATE, };
114:
115:            /**
116:             * Default columns to retrieve when asked for list of objects. 
117:             * These should be only columns visible to user on the screen and not any
118:             * internal columns. Also the columns should be retrievable efficiently so
119:             * that the default view is very quick. 
120:             */
121:            public static final int[] DEFAULT_LIST_COLUMNS = {
122:                    COL_BLOG_CAPTION, COL_BLOG_COMMENTS, COL_BLOG_FOLDER,
123:                    COL_BLOG_CREATION_DATE, COL_BLOG_MODIFICATION_DATE, };
124:
125:            /**
126:             * Default columns to sort by when asked for list of objects. 
127:             */
128:            public static final int[] DEFAULT_LIST_SORT_COLUMNS = { COL_BLOG_CAPTION };
129:
130:            /**
131:             * Default order in which the columns will be sorted. 
132:             */
133:            public static final String[] DEFAULT_LIST_SORT_ORDER = ListDefinition.ORDER_ASCENDING_ARRAY;
134:
135:            // Cached values ////////////////////////////////////////////////////////////
136:
137:            /**
138:             * Maximal length of the folder field. The value depends on the underlying
139:             * persistance mechanism and it is set once the persistance is initialized.
140:             */
141:            protected static int s_iFolderMaxLength;
142:
143:            /**
144:             * Maximal length of the caption field. The value depends on the underlying
145:             * persistance mechanism and it is set once the persistance is initialized.
146:             */
147:            protected static int s_iCaptionMaxLength;
148:
149:            /**
150:             * Maximal length of the comments field. The value depends on the underlying
151:             * persistance mechanism and it is set once the persistance is initialized.
152:             */
153:            protected static int s_iCommentsMaxLength;
154:
155:            /**
156:             * Flag signaling if the text contains formatting or not. Example of such 
157:             * formatting is a newline character.
158:             */
159:            protected Boolean m_bIsPreformated = null;
160:
161:            // Attributes ///////////////////////////////////////////////////////////////
162:
163:            /**
164:             * Generated serial version id for this class.
165:             */
166:            private static final long serialVersionUID = -6839950852321644561L;
167:
168:            /**
169:             * Folder allows to organize blogs within folders.
170:             */
171:            protected String m_strFolder;
172:
173:            /**
174:             * Caption is more descriptive name of the blog.
175:             */
176:            protected String m_strCaption;
177:
178:            /**
179:             * Comments is any additional description of the blog.
180:             */
181:            protected String m_strComments;
182:
183:            // Constructors /////////////////////////////////////////////////////////////
184:
185:            static {
186:                DataConstant.setDataTypeName(DataConstant.BLOG_DATA_TYPE_OBJ,
187:                        "Chronicle");
188:            }
189:
190:            /**
191:             * Empty blog initialized to default parameters
192:             */
193:            public Blog() {
194:                this (DataObject.NEW_ID, DataObject.NEW_ID, "", "", "", null,
195:                        null);
196:            }
197:
198:            /**
199:             * Empty blog for a specified domain initialized to default parameters
200:             *
201:             * @param iDomainId - Id of the domain this blog belongs to 
202:             */
203:            public Blog(int iDomainId) {
204:                this (DataObject.NEW_ID, iDomainId, "", "", "", null, null);
205:            }
206:
207:            /**
208:             * Create blog from a given parameters.
209:             *
210:             * @param iId - Unique ID identifying this Blog
211:             * @param iDomainId - Id of the domain this blog belongs to 
212:             * @param strBlogFolder - Folder allows to categorize Blogs to groups
213:             * @param strCaption - More descriptive name of the Blog
214:             * @param strComments - Any additional description of the Blog
215:             * @param creationTimestamp - Timestamp when the Blog was created
216:             * @param modificationTimestamp - Timestamp when the Blog was last time modified
217:             */
218:            public Blog(int iId, int iDomainId, String strBlogFolder,
219:                    String strCaption, String strComments,
220:                    Timestamp creationTimestamp, Timestamp modificationTimestamp) {
221:                super (iId, iDomainId, creationTimestamp, modificationTimestamp);
222:
223:                m_strFolder = strBlogFolder.trim();
224:                m_strCaption = strCaption;
225:                m_strComments = strComments;
226:            }
227:
228:            // Public methods ///////////////////////////////////////////////////////////
229:
230:            /**
231:             * Folder allows to organize blogs within folders.
232:             *
233:             * @return String
234:             */
235:            public String getFolder() {
236:                return m_strFolder;
237:            }
238:
239:            /**
240:             * Caption is more descriptive name of the blog.
241:             *
242:             * @return String
243:             */
244:            public String getCaption() {
245:                return m_strCaption;
246:            }
247:
248:            /**
249:             * Comments is any additional description of the blog.
250:             *
251:             * @return String
252:             */
253:            public String getComments() {
254:                return m_strComments;
255:            }
256:
257:            /**
258:             * @return int
259:             */
260:            public static int getCaptionMaxLengthStatic() {
261:                return s_iCaptionMaxLength;
262:            }
263:
264:            /**
265:             * @return int
266:             */
267:            public int getCaptionMaxLength() {
268:                return s_iCaptionMaxLength;
269:            }
270:
271:            /**
272:             * @return int
273:             */
274:            public static int getCommentsMaxLengthStatic() {
275:                return s_iCommentsMaxLength;
276:            }
277:
278:            /**
279:             * @return int
280:             */
281:            public int getCommentsMaxLength() {
282:                return s_iCommentsMaxLength;
283:            }
284:
285:            /**
286:             * @return int
287:             */
288:            public static int getFolderMaxLengthStatic() {
289:                return s_iFolderMaxLength;
290:            }
291:
292:            /**
293:             * @return int
294:             */
295:            public int getFolderMaxLength() {
296:                return s_iFolderMaxLength;
297:            }
298:
299:            /**
300:             * @param iCaptionMaxLength - maximal length for caption
301:             */
302:            public static void setCaptionMaxLength(int iCaptionMaxLength) {
303:                s_iCaptionMaxLength = iCaptionMaxLength;
304:            }
305:
306:            /**
307:             * @param iCommentsMaxLength - maximal length for comments
308:             */
309:            public static void setCommentsMaxLength(int iCommentsMaxLength) {
310:                s_iCommentsMaxLength = iCommentsMaxLength;
311:            }
312:
313:            /**
314:             * @param iFolderMaxLength - maximal length for folder
315:             */
316:            public static void setFolderMaxLength(int iFolderMaxLength) {
317:                s_iFolderMaxLength = iFolderMaxLength;
318:            }
319:
320:            /**
321:             * Flag signaling if the text contains formatting or not. Example of such 
322:             * formatting is a newline character.
323:             * 
324:             * @return boolean
325:             */
326:            public boolean getIsPreformated() {
327:                if (m_bIsPreformated == null) {
328:                    if (m_strComments == null) {
329:                        m_bIsPreformated = Boolean.FALSE;
330:                    } else {
331:                        m_bIsPreformated = ((m_strComments.indexOf('\n') != -1) ? Boolean.TRUE
332:                                : Boolean.FALSE);
333:                    }
334:                }
335:
336:                return (m_bIsPreformated == Boolean.TRUE);
337:            }
338:
339:            /**
340:             * {@inheritDoc}
341:             */
342:            public boolean isSame(Object oObject) {
343:                boolean bReturn = false;
344:                Blog data;
345:
346:                if (oObject == this ) {
347:                    bReturn = true;
348:                } else {
349:                    if (oObject != null && oObject instanceof  Blog) {
350:                        data = (Blog) oObject;
351:                        bReturn = ((data.getFolder() == null && m_strFolder == null) || data
352:                                .getFolder().equals(m_strFolder))
353:                                && ((data.getCaption() == null && m_strCaption == null) || data
354:                                        .getCaption().equals(m_strCaption))
355:                                && ((data.getComments() == null && m_strComments == null) || data
356:                                        .getComments().equals(m_strComments));
357:                    }
358:                }
359:                return bReturn;
360:            }
361:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.