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


001:        /*
002:         * Copyright (c) 2007 OpenSubsystems s.r.o. Slovak Republic. All rights reserved.
003:         * 
004:         * Project: OpenSubsystems
005:         * 
006:         * $Id: EntryListDatabaseTestUtils.java,v 1.1 2007/02/01 07:31:05 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; either version 2 of the License, or
011:         * (at your option) any later version.
012:         * 
013:         * This program is distributed in the hope that it will be useful,
014:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016:         * GNU General Public License for more details.
017:         * 
018:         * You should have received a copy of the GNU General Public License
019:         * along with this program; if not, write to the Free Software
020:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
021:         */
022:
023:        package org.opensubsystems.blog.persist.db;
024:
025:        import org.opensubsystems.blog.data.Blog;
026:        import org.opensubsystems.blog.data.Entry;
027:        import org.opensubsystems.blog.persist.BlogFactory;
028:        import org.opensubsystems.blog.persist.EntryFactory;
029:        import org.opensubsystems.core.data.DataConstant;
030:        import org.opensubsystems.core.data.DataObject;
031:        import org.opensubsystems.core.error.OSSException;
032:        import org.opensubsystems.core.persist.DataFactoryManager;
033:        import org.opensubsystems.patterns.listdata.data.ListOptions;
034:        import org.opensubsystems.patterns.listdata.persist.db.ListDatabaseTestUtils;
035:
036:        /**
037:         * Utility class to enable test list pattern implementation for blog entries.
038:         * 
039:         * @version $Id: EntryListDatabaseTestUtils.java,v 1.1 2007/02/01 07:31:05 bastafidli Exp $
040:         * @author Miro Halas
041:         * @code.reviewer Miro Halas
042:         * @code.reviewed Initial revision
043:         */
044:        public class EntryListDatabaseTestUtils extends ListDatabaseTestUtils {
045:            // Cached values ////////////////////////////////////////////////////////////
046:
047:            /**
048:             * Factory to use to execute persistence operations.
049:             */
050:            protected BlogFactory m_blogFactory;
051:
052:            // Constructors /////////////////////////////////////////////////////////////
053:
054:            /**
055:             * Constructor
056:             * 
057:             * @throws OSSException - an error has occured
058:             */
059:            public EntryListDatabaseTestUtils() throws OSSException {
060:                super (EntryFactory.class, BlogDatabaseSchema.class,
061:                        Entry.ALL_COLUMNS, Entry.COL_BLOGENTRY_CAPTION,
062:                        Entry.COL_BLOGENTRY_COMMENTS);
063:
064:                m_blogFactory = (BlogFactory) DataFactoryManager
065:                        .getInstance(BlogFactory.class);
066:            }
067:
068:            // Implemented abstract methods /////////////////////////////////////////////
069:
070:            /**
071:             * {@inheritDoc}
072:             */
073:            public Object insertParent(int iDomainId, String str1, String str2)
074:                    throws Exception {
075:                Blog blog = new Blog(DataObject.NEW_ID, iDomainId, str1, str2,
076:                        str1 + str2, null, null);
077:                blog = (Blog) m_blogFactory.create(blog);
078:
079:                return blog;
080:            }
081:
082:            /**
083:             * {@inheritDoc}
084:             */
085:            public void deleteParent(Object parent, int iDomainId)
086:                    throws Exception {
087:                m_blogFactory.delete(((Blog) parent).getId(), iDomainId);
088:            }
089:
090:            /**
091:             * {@inheritDoc}
092:             */
093:            public DataObject constructData(Object parent, int iDomainId,
094:                    String str1, String str2) throws Exception {
095:                return new Entry(DataObject.NEW_ID, iDomainId, ((Blog) parent)
096:                        .getId(), str1, str2, str1 + str2, str2 + str1, null,
097:                        null);
098:            }
099:
100:            /**
101:             * {@inheritDoc}
102:             */
103:            protected void deleteData(Object parent, final int iDomainId,
104:                    final String strPrefix1, final String strPrefix2)
105:                    throws Exception {
106:                deleteData(parent, iDomainId, strPrefix1, strPrefix2,
107:                        "DELETE FROM "
108:                                + BlogDatabaseSchema.BLOGENTRY_TABLE_NAME
109:                                + " WHERE (CAPTION LIKE '" + strPrefix1
110:                                + "%' OR COMMENTS LIKE '" + strPrefix2
111:                                + "%') AND BLOG_ID = "
112:                                + ((Blog) parent).getId() + " AND DOMAIN_ID = "
113:                                + iDomainId, false);
114:            }
115:
116:            /**
117:             * {@inheritDoc}
118:             */
119:            public String getColumnOneValue(DataObject data) {
120:                // In constructor we have specified that the first column is folder
121:                return ((Entry) data).getCaption();
122:            }
123:
124:            /**
125:             * {@inheritDoc}
126:             */
127:            public String getColumnTwoValue(DataObject data) {
128:                // In constructor we have specified that the second column is caption
129:                return ((Entry) data).getComments();
130:            }
131:
132:            // Overrident methods ///////////////////////////////////////////////////////
133:
134:            /**
135:             * {@inheritDoc}
136:             */
137:            public ListOptions getDefaultListOptions(Object parent)
138:                    throws OSSException {
139:                ListOptions options = super .getDefaultListOptions(parent);
140:
141:                if (parent != null) {
142:                    options.setParentDataType(DataConstant.BLOG_DATA_TYPE);
143:                    options.setParentId(((Blog) parent).getId());
144:                }
145:
146:                return options;
147:            }
148:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.