?? coursemanager.java
字號:
package com.xuanke.student.control;
import java.util.List;
import com.xuanke.student.model.CoursetBean;
import com.xuanke.student.model.CourseDAO;
import com.xuanke.utils.DBConnectionManager;
import com.xuanke.utils.MyJDBCException;
public class CourseManager {
private static CourseManager instance=null;
private CourseDAO dao=null;
/*
* 下列代碼的基本意圖是,保證StudentManager類僅有一個實例對象
* 有利于進行內存控制
* 還有利于繼承StudentManager類,并在getInstance方法中返回其子類
* 如有如下類:
* public class NewStudentManager extends StudentManager{
* ......
* }
* 如果希望StudentManager的getInstance方法返回NewStudentManager的實例
* 則只需要把getInstance方法修改為
* public static StudentManager getInstance(){
if(instance==null)
instance=new NewStudentManager();
return instance;
}
*/
private CourseManager(){
}
public static CourseManager getInstance(){
if(instance==null)
instance=new CourseManager();
return instance;
}
public List findAll() throws BusinessException{
// TODO 自動生成方法存根
try {
dao=new CourseDAO(DBConnectionManager.getConnection());
return dao.findAll();
} catch (MyJDBCException e) {
throw new BusinessException(e.getMessage());
}
}
public List findPersonalAll() throws BusinessException{
// TODO 自動生成方法存根
try {
dao=new CourseDAO(DBConnectionManager.getConnection());
return dao.findPersonalAll();
} catch (MyJDBCException e) {
throw new BusinessException(e.getMessage());
}
}
public void delete(String id) throws BusinessException{
// TODO 自動生成方法存根
try {
dao=new CourseDAO(DBConnectionManager.getConnection());
dao.delete(id);
} catch (MyJDBCException e) {
throw new BusinessException(e.getMessage());
}
}
public void add(String id) throws BusinessException{
try {
dao=new CourseDAO(DBConnectionManager.getConnection());
dao.add(id);
} catch (MyJDBCException e) {
throw new BusinessException(e.getMessage());
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -