KickJava   Java API By Example, From Geeks To Geeks.

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


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

23 package com.geinuke.dao;
24
25 import java.util.List JavaDoc;
26
27 import com.geinuke.common.UserI;
28 import com.geinuke.vo.ModuleDBVO;
29
30
31 public class ModuleDAO extends GeiDAO{
32
33     
34     public ModuleDAO() throws Exception JavaDoc {
35         super();
36         
37     }
38     /**
39      *
40      * @return return a list ModuleLinkInfoVO
41      * @throws Exception
42      */

43     public List JavaDoc getAllModuleInMainBlock(UserI user)throws Exception JavaDoc{
44         List JavaDoc list=null;
45         try{
46             this.sqlMap().startTransaction();
47             list=this.sqlMap().queryForList("getModulesInMainBlock",user);
48             this.sqlMap().commitTransaction();
49         }finally{
50             this.sqlMap().endTransaction();
51         }
52         return list;
53         
54     }
55     
56     public void updateDBModule(ModuleDBVO mod)throws Exception JavaDoc{
57         try{
58             this.sqlMap().startTransaction();
59             this.sqlMap().update("updateDBModule",mod);
60             this.sqlMap().commitTransaction();
61         }finally{
62             this.sqlMap().endTransaction();
63         }
64     
65     }
66     
67     public void insertDBStoredModule(ModuleDBVO mod)throws Exception JavaDoc{
68         try{
69             this.sqlMap().startTransaction();
70             this.sqlMap().update("insertDBStoredModule",mod);
71             this.sqlMap().commitTransaction();
72         }finally{
73             this.sqlMap().endTransaction();
74         }
75     
76     }
77     
78     public void delDBModule(int id)throws Exception JavaDoc{
79         try{
80             this.sqlMap().startTransaction();
81             this.sqlMap().delete("delDBModule",new Integer JavaDoc(id));
82             this.sqlMap().commitTransaction();
83         }finally{
84             this.sqlMap().endTransaction();
85         }
86     
87     }
88     
89     public List JavaDoc getAllDBModules()throws Exception JavaDoc{
90         List JavaDoc list=null;
91         try{
92             this.sqlMap().startTransaction();
93             list=this.sqlMap().queryForList("getAllDBModules","");
94             this.sqlMap().commitTransaction();
95         }finally{
96             this.sqlMap().endTransaction();
97         }
98         return list;
99         
100     }
101     
102     public List JavaDoc getAllDBStoredModules()throws Exception JavaDoc{
103         List JavaDoc list=null;
104         try{
105             this.sqlMap().startTransaction();
106             list=this.sqlMap().queryForList("getAllDBStoredModules","");
107             this.sqlMap().commitTransaction();
108         }finally{
109             this.sqlMap().endTransaction();
110         }
111         return list;
112         
113     }
114     
115     public List JavaDoc getModulesInHomePage(UserI user)throws Exception JavaDoc{
116         List JavaDoc list=null;
117         try{
118             this.sqlMap().startTransaction();
119             list=this.sqlMap().queryForList("getModulesInHomePage",user);
120             this.sqlMap().commitTransaction();
121         }finally{
122             this.sqlMap().endTransaction();
123         }
124         return list;
125         
126     }
127     
128     public ModuleDBVO getDefModule()throws Exception JavaDoc{
129         ModuleDBVO mod=null;
130         try{
131             this.sqlMap().startTransaction();
132             mod=(ModuleDBVO)this.sqlMap().queryForObject("getDefModule","");
133             this.sqlMap().commitTransaction();
134         }finally{
135             this.sqlMap().endTransaction();
136         }
137         return mod;
138     }
139     
140     public ModuleDBVO getModuleByName(String JavaDoc name)throws Exception JavaDoc{
141         ModuleDBVO mod=null;
142         try{
143             this.sqlMap().startTransaction();
144             mod=(ModuleDBVO)this.sqlMap().queryForObject("getModuleByName",name);
145             this.sqlMap().commitTransaction();
146         }finally{
147             this.sqlMap().endTransaction();
148         }
149         return mod;
150     }
151     
152     public ModuleDBVO getModuleById(int id)throws Exception JavaDoc{
153         ModuleDBVO mod=null;
154         try{
155             this.sqlMap().startTransaction();
156             mod=(ModuleDBVO)this.sqlMap().queryForObject("getModuleById",new Integer JavaDoc(id));
157             this.sqlMap().commitTransaction();
158         }finally{
159             this.sqlMap().endTransaction();
160         }
161         return mod;
162     }
163     
164     
165
166 }
167
Popular Tags