package com.abc.service; import java.util.List; import com.abc.dao.AdminDAO; import com.abc.dao.DAO; import com.abc.dao.DeptDAO; import com.abc.entities.Dept; import com.abc.entities.Employee; import com.abc.exceptions.AppException; public class AdminServiceImpl implements AdminService { AdminDAO adminDAO; DeptDAO deptDAO; public Employee registerEmployee(Integer psno, String name, String pass, Dept dept) throws AppException { Employee newEmp = new Employee(psno, name, pass); newEmp.setDept(dept); adminDAO.create(newEmp); DAO.close(); return newEmp; } public AdminDAO getAdminDAO() { return adminDAO; } public void setAdminDAO(AdminDAO adminDAO) { this.adminDAO = adminDAO; } public DeptDAO getDeptDAO() { return deptDAO; } public void setDeptDAO(DeptDAO deptDAO) { this.deptDAO = deptDAO; } public List getAllEmployees() throws AppException { return adminDAO.list(); } public Employee getEmployee(Integer psno) throws AppException { Employee emp = adminDAO.get(psno); DAO.close(); return emp; } public List getEmployeeInPages(int start, int pageSize) throws AppException { List list = adminDAO.list(start, pageSize); DAO.close(); return list; } }