⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 staffmanagerimpl.java

📁 《JSP网站开发典型模块与实例精讲》一书光盘源码
💻 JAVA
字号:
package org.appfuse.service.impl;

import java.util.List;
import org.appfuse.service.impl.BaseManager;
import org.appfuse.dao.StaffDAO;
import org.appfuse.model.*;
import org.apache.commons.logging.*;
import org.appfuse.service.StaffManager;
import org.appfuse.util.exception.*;

public class StaffManagerImpl
    extends BaseManager
    implements StaffManager {
    private StaffDAO dao;
    protected final Log log = LogFactory.getLog(StaffManagerImpl.class);

    /**
     * Set the DAO for communication with the data layer.
     *
     * @param dao
     */
    public void setStaffDAO(StaffDAO dao) {
        this.dao = dao;
    }

    /**
     * @see org.appfuse.service.UserManager#getUser(java.lang.String)
     */
    public Staff getStaff(int staffno) throws AppSystemException,
        AppBusinessException {
        Staff staff = null;
        try {
            staff = dao.getStaff(staffno);
        }
        catch (Exception e) {
            log.error("获取员工信息失败!", e);
            throw new AppBusinessException(e.getMessage(), e,
                                           ExceptionConstants.SYS_GENERAL_ERR);
        }
        return staff;
    }
    public Staff getStaff(String staffname, String staffpwd) throws AppSystemException,
         AppBusinessException {
         Staff staff = null;
         try {
             staff = dao.getStaff(staffname, staffpwd);
         }
         catch (Exception e) {
             log.error("获取员工信息失败!", e);
             throw new AppBusinessException(e.getMessage(), e,
                                            ExceptionConstants.SYS_GENERAL_ERR);
         }
         return staff;
     }

    /**
     * @see org.appfuse.service.UserManager#getUsers(org.appfuse.model.User)
     */
    public List getStaffs(Staff staff) throws AppSystemException,
        AppBusinessException {
        List list = null;
        try {
            list = dao.getStaffs(staff);
        }
        catch (Exception e) {
            log.error("获取员工列表失败!", e);
            throw new AppBusinessException(e.getMessage(), e,
                                           ExceptionConstants.SYS_GENERAL_ERR);
        }
        return list;
    }

    /**
     * @see org.appfuse.service.UserManager#saveUser(org.appfuse.model.User)
     */
    public void saveStaff(Staff staff) throws AppSystemException,
        AppBusinessException {
        try {
            dao.saveStaff(staff);
        }
        catch (Exception e) {
            log.error("保存员工失败!", e);
            throw new AppBusinessException(e.getMessage(), e,
                                           ExceptionConstants.SYS_GENERAL_ERR);
        }
    }

    /**
     * @see org.appfuse.service.UserManager#removeUser(java.lang.String)
     */
    public void removeStaff(int staffno) throws AppSystemException,
        AppBusinessException {
        try {
            dao.removeStaff(staffno);
        }
        catch (Exception e) {
            log.error("删除员工失败!", e);
            throw new AppBusinessException(e.getMessage(), e,
                                           ExceptionConstants.SYS_GENERAL_ERR);
        }
    }

    public List getRoles(int staffno) throws AppSystemException,
        AppBusinessException {
        try {
            return dao.getRoles(staffno);
        }
        catch (Exception e) {
            log.error("获取员工角色失败!", e);
            throw new AppBusinessException(e.getMessage(), e,
                                           ExceptionConstants.SYS_GENERAL_ERR);
        }
    }

//    public void removeStaffRole(StaffRole staffRole) throws AppSystemException,
//        AppBusinessException{
//        try {
//            dao.removeStaffRole(staffRole);
//        }
//        catch (Exception e) {
//            log.error("删除员工角色失败!", e);
//            throw new AppBusinessException(e.getMessage(), e,
//                                           ExceptionConstants.SYS_GENERAL_ERR);
//        }
//
//    }
//
}

⌨️ 快捷键说明

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