businessmanager.java

来自「这是一本描述JDBC数据库的书籍」· Java 代码 · 共 88 行

JAVA
88
字号
/* * BusinessManager.java * * Created on June 10, 2005, 3:46 PM * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */package ch02.business;import ch02.pojo.*;import ch02.manager.*;import ch02.jdbc.*;import java.util.*;import ch02.locator.*;/** * * @author kevin */public class BusinessManager {       EmployeeDAO empDao = null;    /** Creates a new instance of BusinessManager */    public BusinessManager() throws Exception{       empDao = ServiceLocator.getEmployeeDAO();            }            /**     *      * @param emp      */    public synchronized void addEmployee(IEmployee emp){        empDao.addEmployee(emp);    }        /**     *      * @param id      */    public synchronized void deleteEmployee(String id){        empDao.deleteEmployee(id);    }        /**     *      * @param firstName      * @param lastName      * @return      */    public List getEmployeeByName(String firstName, String lastName){        List emps = empDao.loadEmployee();        List results = new ArrayList();        Iterator iter = emps.iterator();        while(iter.hasNext()){            IEmployee emp = (IEmployee)iter.next();                       if(emp.getFirstName().trim().equals(firstName) &&                emp.getLastName().trim().equals(lastName)){                           results.add(emp);            }        }        return results;    }        /**     *      * @param employeeID      * @return      */    public IEmployee getEmployeeByID(String employeeID){        return empDao.getEmployee(employeeID);    }        }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?