studentmanagerimpl.java

来自「struts+hibernate开发的一个系统」· Java 代码 · 共 89 行

JAVA
89
字号
package org.appfuse.service.impl;

import java.util.List;
import org.appfuse.service.*;
import org.appfuse.dao.StudentDAO;
import org.appfuse.model.Student;
import org.appfuse.util.exception.*;

public class StudentManagerImpl
    extends BaseManager implements StudentManager{
    private StudentDAO dao;

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

    /**
     * @see org.appfuse.service.UserManager#getUser(java.lang.String)
     */
    public Student getStudent(int studentid) throws AppSystemException,
        AppBusinessException {
        Student student = null;
        try {
            student = dao.getStudent(studentid);
        }
        catch (Exception e) {
            log.error("获取模块信息失败!", e);
            throw new AppBusinessException(e.getMessage(), e, ExceptionConstants.SYS_GENERAL_ERR);
        }
        return student;
    }

    /**
     * @see org.appfuse.service.UserManager#getUsers(org.appfuse.model.User)
     */
    public List getStudents(Student student) throws AppSystemException,
        AppBusinessException {
        List list = null;
        try {
            list = dao.getStudents(student);
        }
        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 saveStudent(Student student) throws AppSystemException,
        AppBusinessException {
        try {
            dao.saveStudent(student);
        }
        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 removeStudent(int studentid) throws AppSystemException,
        AppBusinessException {
        if (log.isDebugEnabled()) {
            log.debug("removing user: " + studentid);
        }
        try {
            dao.removeStudent(studentid);
        }
        catch (Exception e) {
            log.error("删除模块失败!", e);
            throw new AppBusinessException(e.getMessage(), e,
                                           ExceptionConstants.SYS_GENERAL_ERR);
        }

    }
}

⌨️ 快捷键说明

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