KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > geinuke > dao > PMessageDAO


1 /*
2 -- GeiNuke --
3 Copyright (c) 2005 by Roberto Sidoti [geinuke@users.sourceforge.net]
4 http://www.hostingjava.it/-geinuke/
5
6 This file is part of GeiNuke.
7
8    GeiNuke is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 2 of the License, or
11    (at your option) any later version.
12
13    GeiNuke is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16    GNU General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with GeiNuke; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */

22 package com.geinuke.dao;
23
24 import java.util.ArrayList JavaDoc;
25 import java.util.List JavaDoc;
26
27 import com.geinuke.bizlogic.BLException;
28 import com.geinuke.vo.NewsVO;
29 import com.geinuke.vo.PMessageVO;
30
31 public class PMessageDAO extends GeiDAO{
32
33     
34     public PMessageDAO() throws Exception JavaDoc {
35         super();
36         
37     }
38     
39     
40     public PMessageVO getPMessageById(int id) throws Exception JavaDoc {
41         PMessageVO m=null;
42         try{
43             this.sqlMap().startTransaction();
44             m=(PMessageVO)this.sqlMap().queryForObject("getPMessageById",new Integer JavaDoc(id));
45             this.sqlMap().commitTransaction();
46         }finally{
47             this.sqlMap().endTransaction();
48         }
49         return m;
50     }
51     
52     public List JavaDoc getReceivedPMessagesByUId(int uid) throws Exception JavaDoc {
53         List JavaDoc list=null;
54         try{
55             this.sqlMap().startTransaction();
56             list=this.sqlMap().queryForList("getReceivedPMessagesByUId",new Integer JavaDoc(uid));
57             this.sqlMap().commitTransaction();
58         }finally{
59             this.sqlMap().endTransaction();
60         }
61         return list;
62     }
63     
64     public List JavaDoc getSentPMessagesByUId(int uid) throws Exception JavaDoc {
65         List JavaDoc list=null;
66         try{
67             this.sqlMap().startTransaction();
68             list=this.sqlMap().queryForList("getSentPMessagesByUId",new Integer JavaDoc(uid));
69             this.sqlMap().commitTransaction();
70         }finally{
71             this.sqlMap().endTransaction();
72         }
73         return list;
74     }
75     
76     public void deletePMessageByPID(int pid) throws Exception JavaDoc {
77         try{
78             this.sqlMap().startTransaction();
79             this.sqlMap().delete("deletePMessageByPID",new Integer JavaDoc(pid));
80             this.sqlMap().commitTransaction();
81         }finally{
82             this.sqlMap().endTransaction();
83         }
84     }
85     
86     public void updatePMessage(PMessageVO p) throws Exception JavaDoc {
87         try{
88             this.sqlMap().startTransaction();
89             this.sqlMap().update("updatePMessageByPID",p);
90             this.sqlMap().commitTransaction();
91         }finally{
92             this.sqlMap().endTransaction();
93         }
94     }
95     
96     public void addPMessage(PMessageVO p) throws Exception JavaDoc {
97         try{
98             this.sqlMap().startTransaction();
99             this.sqlMap().insert("addPMessage",p);
100             this.sqlMap().commitTransaction();
101         }finally{
102             this.sqlMap().endTransaction();
103         }
104     }
105
106 }
107
Popular Tags