KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > geinuke > bizlogic > CategoryBL


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.bizlogic;
24
25 import java.sql.SQLException JavaDoc;
26 import java.util.ArrayList JavaDoc;
27
28 import com.geinuke.dao.CategoryDAO;
29 import com.geinuke.middle.ICategoryBL;
30 import com.geinuke.vo.CategoryVO;
31 import com.geinuke.vo.NewsVO;
32
33
34 public class CategoryBL implements ICategoryBL {
35     protected static ICategoryBL instance=null;
36
37     public CategoryBL(){
38     
39     }
40
41     
42     
43     public ArrayList JavaDoc getCategoriesByFId(int fid) throws BLException{
44         ArrayList JavaDoc list=null;
45         try{
46             CategoryDAO dao=new CategoryDAO();
47             list=dao.getCategoriesByFId(fid);
48             
49         }catch(SQLException JavaDoc sqle){
50             throw new DBException(sqle.getMessage());
51         }catch(Throwable JavaDoc t){
52             throw new BLException(t.getMessage());
53         }
54         return list;
55     }
56     
57     public void insCategory(CategoryVO c)throws BLException{
58         
59         try{
60             CategoryDAO dao=new CategoryDAO();
61             dao.insertCategory(c);
62             
63         }catch(SQLException JavaDoc sqle){
64             throw new DBException(sqle.getMessage());
65         }catch(Throwable JavaDoc t){
66             throw new BLException(t.getMessage());
67         }
68         
69     }
70     
71     public CategoryVO getCategoryById(CategoryVO c)throws BLException {
72         CategoryVO cc=null;
73         try{
74             CategoryDAO dao=new CategoryDAO();
75             cc=dao.getCategoryByIdAndCatType(c);
76         }catch(SQLException JavaDoc sqle){
77             throw new DBException(sqle.getMessage());
78         }catch(Throwable JavaDoc t){
79             throw new BLException(t.getMessage());
80         }
81         return cc;
82     }
83     
84     public CategoryVO getCategoryByTitleAndCatType(CategoryVO c)throws BLException {
85         CategoryVO cc=null;
86         try{
87             CategoryDAO dao=new CategoryDAO();
88             cc=dao.getCategoryByTitleAndCatType(c);
89         }catch(SQLException JavaDoc sqle){
90             throw new DBException(sqle.getMessage());
91         }catch(Throwable JavaDoc t){
92             throw new BLException(t.getMessage());
93         }
94         return cc;
95     }
96     
97     public ArrayList JavaDoc getCategoriesByCatType(String JavaDoc type) throws BLException{
98         ArrayList JavaDoc list=null;
99         try{
100             CategoryDAO dao=new CategoryDAO();
101             list=dao.getCategoriesByCatType(type);
102             
103         }catch(SQLException JavaDoc sqle){
104             throw new DBException(sqle.getMessage());
105         }catch(Throwable JavaDoc t){
106             throw new BLException(t.getMessage());
107         }
108         return list;
109     }
110     
111     public ArrayList JavaDoc getCategoriesByNews(NewsVO n) throws BLException{
112         ArrayList JavaDoc list=null;
113         try{
114             CategoryDAO dao=new CategoryDAO();
115             list=dao.getCategoriesByNews(n);
116             
117         }catch(SQLException JavaDoc sqle){
118             throw new DBException(sqle.getMessage());
119         }catch(Throwable JavaDoc t){
120             throw new BLException(t.getMessage());
121         }
122         return list;
123     }
124     
125     public ArrayList JavaDoc getAllCategories() throws BLException{
126         ArrayList JavaDoc list=null;
127         try{
128             CategoryDAO dao=new CategoryDAO();
129             list=dao.getAllCategories();
130             
131         }catch(SQLException JavaDoc sqle){
132             throw new DBException(sqle.getMessage());
133         }catch(Throwable JavaDoc t){
134             throw new BLException(t.getMessage());
135         }
136         return list;
137     }
138 }
139
Popular Tags