1 2 23 package com.geinuke.bizlogic; 24 25 import java.sql.SQLException ; 26 import java.util.ArrayList ; 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 getCategoriesByFId(int fid) throws BLException{ 44 ArrayList list=null; 45 try{ 46 CategoryDAO dao=new CategoryDAO(); 47 list=dao.getCategoriesByFId(fid); 48 49 }catch(SQLException sqle){ 50 throw new DBException(sqle.getMessage()); 51 }catch(Throwable 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 sqle){ 64 throw new DBException(sqle.getMessage()); 65 }catch(Throwable 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 sqle){ 77 throw new DBException(sqle.getMessage()); 78 }catch(Throwable 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 sqle){ 90 throw new DBException(sqle.getMessage()); 91 }catch(Throwable t){ 92 throw new BLException(t.getMessage()); 93 } 94 return cc; 95 } 96 97 public ArrayList getCategoriesByCatType(String type) throws BLException{ 98 ArrayList list=null; 99 try{ 100 CategoryDAO dao=new CategoryDAO(); 101 list=dao.getCategoriesByCatType(type); 102 103 }catch(SQLException sqle){ 104 throw new DBException(sqle.getMessage()); 105 }catch(Throwable t){ 106 throw new BLException(t.getMessage()); 107 } 108 return list; 109 } 110 111 public ArrayList getCategoriesByNews(NewsVO n) throws BLException{ 112 ArrayList list=null; 113 try{ 114 CategoryDAO dao=new CategoryDAO(); 115 list=dao.getCategoriesByNews(n); 116 117 }catch(SQLException sqle){ 118 throw new DBException(sqle.getMessage()); 119 }catch(Throwable t){ 120 throw new BLException(t.getMessage()); 121 } 122 return list; 123 } 124 125 public ArrayList getAllCategories() throws BLException{ 126 ArrayList list=null; 127 try{ 128 CategoryDAO dao=new CategoryDAO(); 129 list=dao.getAllCategories(); 130 131 }catch(SQLException sqle){ 132 throw new DBException(sqle.getMessage()); 133 }catch(Throwable t){ 134 throw new BLException(t.getMessage()); 135 } 136 return list; 137 } 138 } 139 | Popular Tags |