Source Code Cross Referenced for PhpbbPrivmMsgsDAOImpl.java in  » Forum » mvnforum-1.1 » org » mvnforum » phpbb2mvnforum » db » jdbc » 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 » Forum » mvnforum 1.1 » org.mvnforum.phpbb2mvnforum.db.jdbc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Header: /cvsroot/mvnforum/mvnforum/contrib/phpbb2mvnforum/src/org/mvnforum/phpbb2mvnforum/db/jdbc/PhpbbPrivmMsgsDAOImpl.java,v 1.5 2007/01/15 10:27:11 dungbtm Exp $
003:         * $Author: dungbtm $
004:         * $Revision: 1.5 $
005:         * $Date: 2007/01/15 10:27:11 $
006:         *
007:         * ====================================================================
008:         *
009:         * Copyright (C) 2002-2007 by MyVietnam.net
010:         *
011:         * All copyright notices regarding mvnForum MUST remain 
012:         * intact in the scripts and in the outputted HTML.
013:         * The "powered by" text/logo with a link back to
014:         * http://www.mvnForum.com and http://www.MyVietnam.net in 
015:         * the footer of the pages MUST remain visible when the pages
016:         * are viewed on the internet or intranet.
017:         *
018:         * This program is free software; you can redistribute it and/or modify
019:         * it under the terms of the GNU General Public License as published by
020:         * the Free Software Foundation; either version 2 of the License, or
021:         * any later version.
022:         *
023:         * This program is distributed in the hope that it will be useful,
024:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
025:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
026:         * GNU General Public License for more details.
027:         *
028:         * You should have received a copy of the GNU General Public License
029:         * along with this program; if not, write to the Free Software
030:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
031:         *
032:         * Support can be obtained from support forums at:
033:         * http://www.mvnForum.com/mvnforum/index
034:         *
035:         * Correspondence and Marketing Questions can be sent to:
036:         * info at MyVietnam net
037:         *
038:         * @author: 
039:         */
040:        package org.mvnforum.phpbb2mvnforum.db.jdbc;
041:
042:        import java.sql.Connection;
043:        import java.sql.PreparedStatement;
044:        import java.sql.ResultSet;
045:        import java.sql.SQLException;
046:        import java.util.ArrayList;
047:        import java.util.Collection;
048:
049:        import net.myvietnam.mvncore.exception.DatabaseException;
050:
051:        import org.mvnforum.phpbb2mvnforum.db.PhpbbPrivmMsgs;
052:        import org.mvnforum.phpbb2mvnforum.db.PhpbbPrivmMsgsDAO;
053:        import org.mvnforum.util.DBUtils;
054:
055:        public class PhpbbPrivmMsgsDAOImpl implements  PhpbbPrivmMsgsDAO {
056:
057:            /*
058:             * Included columns: privmsgs_id, privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, 
059:             *                   privmsgs_date, privmsgs_ip, privmsgs_enable_bbcode, privmsgs_enable_html, privmsgs_enable_smilies, 
060:             *                   privmsgs_attach_sig
061:             * Excluded columns: 
062:             */
063:            public Collection getBeans() throws DatabaseException {
064:
065:                Connection connection = null;
066:                PreparedStatement statement = null;
067:                ResultSet resultSet = null;
068:                Collection retValue = new ArrayList();
069:                StringBuffer sql = new StringBuffer(512);
070:                sql
071:                        .append("SELECT privmsgs_id, privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_bbcode, privmsgs_enable_html, privmsgs_enable_smilies, privmsgs_attach_sig");
072:                sql.append(" FROM " + TABLE_NAME);
073:                //sql.append(" WHERE "); // @todo: uncomment as needed
074:                //sql.append(" ORDER BY ColumnName ASC|DESC "); // @todo: uncomment as needed
075:                try {
076:                    connection = DBUtils.getPhpbbConnection();
077:                    statement = connection.prepareStatement(sql.toString());
078:                    resultSet = statement.executeQuery();
079:                    while (resultSet.next()) {
080:                        PhpbbPrivmMsgs bean = new PhpbbPrivmMsgs();
081:                        bean.setprivmsgs_id(resultSet.getInt("privmsgs_id"));
082:                        bean
083:                                .setprivmsgs_type(resultSet
084:                                        .getInt("privmsgs_type"));
085:                        bean.setprivmsgs_subject(resultSet
086:                                .getString("privmsgs_subject"));
087:                        bean.setprivmsgs_from_userid(resultSet
088:                                .getInt("privmsgs_from_userid"));
089:                        bean.setprivmsgs_to_userid(resultSet
090:                                .getInt("privmsgs_to_userid"));
091:                        bean
092:                                .setprivmsgs_date(resultSet
093:                                        .getInt("privmsgs_date"));
094:                        bean.setprivmsgs_ip(resultSet.getString("privmsgs_ip"));
095:                        bean.setprivmsgs_enable_bbcode(resultSet
096:                                .getInt("privmsgs_enable_bbcode"));
097:                        bean.setprivmsgs_enable_html(resultSet
098:                                .getInt("privmsgs_enable_html"));
099:                        bean.setprivmsgs_enable_smilies(resultSet
100:                                .getInt("privmsgs_enable_smilies"));
101:                        bean.setprivmsgs_attach_sig(resultSet
102:                                .getInt("privmsgs_attach_sig"));
103:                        retValue.add(bean);
104:                    }
105:                    return retValue;
106:                } catch (SQLException sqle) {
107:                    throw new DatabaseException(
108:                            "Error executing SQL in phpbb_privmsgsDAOImplJDBC.getBeans.");
109:                } finally {
110:                    DBUtils.closeResultSet(resultSet);
111:                    DBUtils.closeStatement(statement);
112:                    DBUtils.closeConnection(connection);
113:                }
114:            }
115:
116:            public Collection getBeansBySenderID(int senderID)
117:                    throws DatabaseException {
118:
119:                Connection connection = null;
120:                PreparedStatement statement = null;
121:                ResultSet resultSet = null;
122:                Collection retValue = new ArrayList();
123:                StringBuffer sql = new StringBuffer(512);
124:                sql
125:                        .append("SELECT privmsgs_id, privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_bbcode, privmsgs_enable_html, privmsgs_enable_smilies, privmsgs_attach_sig");
126:                sql.append(" FROM " + TABLE_NAME);
127:                sql.append(" WHERE privmsgs_from_userid=?"); // @todo: uncomment as needed
128:                //sql.append(" ORDER BY ColumnName ASC|DESC "); // @todo: uncomment as needed
129:                try {
130:                    connection = DBUtils.getPhpbbConnection();
131:                    statement = connection.prepareStatement(sql.toString());
132:                    statement.setInt(1, senderID);
133:                    resultSet = statement.executeQuery();
134:                    while (resultSet.next()) {
135:                        PhpbbPrivmMsgs bean = new PhpbbPrivmMsgs();
136:                        bean.setprivmsgs_id(resultSet.getInt("privmsgs_id"));
137:                        bean
138:                                .setprivmsgs_type(resultSet
139:                                        .getInt("privmsgs_type"));
140:                        bean.setprivmsgs_subject(resultSet
141:                                .getString("privmsgs_subject"));
142:                        bean.setprivmsgs_from_userid(resultSet
143:                                .getInt("privmsgs_from_userid"));
144:                        bean.setprivmsgs_to_userid(resultSet
145:                                .getInt("privmsgs_to_userid"));
146:                        bean
147:                                .setprivmsgs_date(resultSet
148:                                        .getInt("privmsgs_date"));
149:                        bean.setprivmsgs_ip(resultSet.getString("privmsgs_ip"));
150:                        bean.setprivmsgs_enable_bbcode(resultSet
151:                                .getInt("privmsgs_enable_bbcode"));
152:                        bean.setprivmsgs_enable_html(resultSet
153:                                .getInt("privmsgs_enable_html"));
154:                        bean.setprivmsgs_enable_smilies(resultSet
155:                                .getInt("privmsgs_enable_smilies"));
156:                        bean.setprivmsgs_attach_sig(resultSet
157:                                .getInt("privmsgs_attach_sig"));
158:                        retValue.add(bean);
159:                    }
160:                    return retValue;
161:                } catch (SQLException sqle) {
162:                    throw new DatabaseException(
163:                            "Error executing SQL in phpbb_privmsgsDAOImplJDBC.getBeans.");
164:                } finally {
165:                    DBUtils.closeResultSet(resultSet);
166:                    DBUtils.closeStatement(statement);
167:                    DBUtils.closeConnection(connection);
168:                }
169:            }
170:
171:            public Collection getBeansByReceiverID(int receiverID)
172:                    throws DatabaseException {
173:
174:                Connection connection = null;
175:                PreparedStatement statement = null;
176:                ResultSet resultSet = null;
177:                Collection retValue = new ArrayList();
178:                StringBuffer sql = new StringBuffer(512);
179:                sql
180:                        .append("SELECT privmsgs_id, privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_bbcode, privmsgs_enable_html, privmsgs_enable_smilies, privmsgs_attach_sig");
181:                sql.append(" FROM " + TABLE_NAME);
182:                sql.append(" WHERE privmsgs_to_userid=?"); // @todo: uncomment as needed
183:                //sql.append(" ORDER BY ColumnName ASC|DESC "); // @todo: uncomment as needed
184:                try {
185:                    connection = DBUtils.getPhpbbConnection();
186:                    statement = connection.prepareStatement(sql.toString());
187:                    statement.setInt(1, receiverID);
188:                    resultSet = statement.executeQuery();
189:                    while (resultSet.next()) {
190:                        PhpbbPrivmMsgs bean = new PhpbbPrivmMsgs();
191:                        bean.setprivmsgs_id(resultSet.getInt("privmsgs_id"));
192:                        bean
193:                                .setprivmsgs_type(resultSet
194:                                        .getInt("privmsgs_type"));
195:                        bean.setprivmsgs_subject(resultSet
196:                                .getString("privmsgs_subject"));
197:                        bean.setprivmsgs_from_userid(resultSet
198:                                .getInt("privmsgs_from_userid"));
199:                        bean.setprivmsgs_to_userid(resultSet
200:                                .getInt("privmsgs_to_userid"));
201:                        bean
202:                                .setprivmsgs_date(resultSet
203:                                        .getInt("privmsgs_date"));
204:                        bean.setprivmsgs_ip(resultSet.getString("privmsgs_ip"));
205:                        bean.setprivmsgs_enable_bbcode(resultSet
206:                                .getInt("privmsgs_enable_bbcode"));
207:                        bean.setprivmsgs_enable_html(resultSet
208:                                .getInt("privmsgs_enable_html"));
209:                        bean.setprivmsgs_enable_smilies(resultSet
210:                                .getInt("privmsgs_enable_smilies"));
211:                        bean.setprivmsgs_attach_sig(resultSet
212:                                .getInt("privmsgs_attach_sig"));
213:                        retValue.add(bean);
214:                    }
215:                    return retValue;
216:                } catch (SQLException sqle) {
217:                    throw new DatabaseException(
218:                            "Error executing SQL in phpbb_privmsgsDAOImplJDBC.getBeans.");
219:                } finally {
220:                    DBUtils.closeResultSet(resultSet);
221:                    DBUtils.closeStatement(statement);
222:                    DBUtils.closeConnection(connection);
223:                }
224:            }
225:
226:            public Collection getBeansByType(int privmsgsType, int memberID)
227:                    throws DatabaseException {
228:
229:                Connection connection = null;
230:                PreparedStatement statement = null;
231:                ResultSet resultSet = null;
232:                Collection retValue = new ArrayList();
233:                StringBuffer sql = new StringBuffer(512);
234:                sql
235:                        .append("SELECT privmsgs_id, privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_bbcode, privmsgs_enable_html, privmsgs_enable_smilies, privmsgs_attach_sig");
236:                sql.append(" FROM " + TABLE_NAME);
237:                sql.append(" WHERE  privmsgs_type=? and privmsgs_to_userid=?"); // @todo: uncomment as needed
238:                //sql.append(" ORDER BY ColumnName ASC|DESC "); // @todo: uncomment as needed
239:                try {
240:                    connection = DBUtils.getPhpbbConnection();
241:                    statement = connection.prepareStatement(sql.toString());
242:                    statement.setInt(1, privmsgsType);
243:                    statement.setInt(2, memberID);
244:                    resultSet = statement.executeQuery();
245:                    while (resultSet.next()) {
246:                        PhpbbPrivmMsgs bean = new PhpbbPrivmMsgs();
247:                        bean.setprivmsgs_id(resultSet.getInt("privmsgs_id"));
248:                        bean
249:                                .setprivmsgs_type(resultSet
250:                                        .getInt("privmsgs_type"));
251:                        bean.setprivmsgs_subject(resultSet
252:                                .getString("privmsgs_subject"));
253:                        bean.setprivmsgs_from_userid(resultSet
254:                                .getInt("privmsgs_from_userid"));
255:                        bean.setprivmsgs_to_userid(resultSet
256:                                .getInt("privmsgs_to_userid"));
257:                        bean
258:                                .setprivmsgs_date(resultSet
259:                                        .getInt("privmsgs_date"));
260:                        bean.setprivmsgs_ip(resultSet.getString("privmsgs_ip"));
261:                        bean.setprivmsgs_enable_bbcode(resultSet
262:                                .getInt("privmsgs_enable_bbcode"));
263:                        bean.setprivmsgs_enable_html(resultSet
264:                                .getInt("privmsgs_enable_html"));
265:                        bean.setprivmsgs_enable_smilies(resultSet
266:                                .getInt("privmsgs_enable_smilies"));
267:                        bean.setprivmsgs_attach_sig(resultSet
268:                                .getInt("privmsgs_attach_sig"));
269:                        retValue.add(bean);
270:                    }
271:                    return retValue;
272:                } catch (SQLException sqle) {
273:                    throw new DatabaseException(
274:                            "Error executing SQL in phpbb_privmsgsDAOImplJDBC.getBeans.");
275:                } finally {
276:                    DBUtils.closeResultSet(resultSet);
277:                    DBUtils.closeStatement(statement);
278:                    DBUtils.closeConnection(connection);
279:                }
280:            }
281:
282:            public Collection getBeansByTypeAndReceiveUser(int privmsgsType,
283:                    int memberID) throws DatabaseException {
284:
285:                Connection connection = null;
286:                PreparedStatement statement = null;
287:                ResultSet resultSet = null;
288:                Collection retValue = new ArrayList();
289:                StringBuffer sql = new StringBuffer(512);
290:                sql
291:                        .append("SELECT privmsgs_id, privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_bbcode, privmsgs_enable_html, privmsgs_enable_smilies, privmsgs_attach_sig");
292:                sql.append(" FROM " + TABLE_NAME);
293:                sql
294:                        .append(" WHERE  privmsgs_type=? and privmsgs_from_userid=?"); // @todo: uncomment as needed
295:                //sql.append(" ORDER BY ColumnName ASC|DESC "); // @todo: uncomment as needed
296:                try {
297:                    connection = DBUtils.getPhpbbConnection();
298:                    statement = connection.prepareStatement(sql.toString());
299:                    statement.setInt(1, privmsgsType);
300:                    statement.setInt(2, memberID);
301:                    resultSet = statement.executeQuery();
302:                    while (resultSet.next()) {
303:                        PhpbbPrivmMsgs bean = new PhpbbPrivmMsgs();
304:                        bean.setprivmsgs_id(resultSet.getInt("privmsgs_id"));
305:                        bean
306:                                .setprivmsgs_type(resultSet
307:                                        .getInt("privmsgs_type"));
308:                        bean.setprivmsgs_subject(resultSet
309:                                .getString("privmsgs_subject"));
310:                        bean.setprivmsgs_from_userid(resultSet
311:                                .getInt("privmsgs_from_userid"));
312:                        bean.setprivmsgs_to_userid(resultSet
313:                                .getInt("privmsgs_to_userid"));
314:                        bean
315:                                .setprivmsgs_date(resultSet
316:                                        .getInt("privmsgs_date"));
317:                        bean.setprivmsgs_ip(resultSet.getString("privmsgs_ip"));
318:                        bean.setprivmsgs_enable_bbcode(resultSet
319:                                .getInt("privmsgs_enable_bbcode"));
320:                        bean.setprivmsgs_enable_html(resultSet
321:                                .getInt("privmsgs_enable_html"));
322:                        bean.setprivmsgs_enable_smilies(resultSet
323:                                .getInt("privmsgs_enable_smilies"));
324:                        bean.setprivmsgs_attach_sig(resultSet
325:                                .getInt("privmsgs_attach_sig"));
326:                        retValue.add(bean);
327:                    }
328:                    return retValue;
329:                } catch (SQLException sqle) {
330:                    throw new DatabaseException(
331:                            "Error executing SQL in phpbb_privmsgsDAOImplJDBC.getBeans.");
332:                } finally {
333:                    DBUtils.closeResultSet(resultSet);
334:                    DBUtils.closeStatement(statement);
335:                    DBUtils.closeConnection(connection);
336:                }
337:            }
338:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.