rolemanagerimpl.java
来自「本程序实现了一个访问控制系统」· Java 代码 · 共 123 行
JAVA
123 行
package org.appfuse.service.impl;
import java.util.List;
import org.appfuse.service.*;
import org.appfuse.dao.RoleDAO;
import org.appfuse.model.Role;
import org.appfuse.util.exception.*;
public class RoleManagerImpl
extends BaseManager
implements RoleManager {
private RoleDAO dao;
/**
* Set the DAO for communication with the data layer.
*
* @param dao
*/
public void setRoleDAO(RoleDAO dao) {
this.dao = dao;
}
/**
* @see org.appfuse.service.UserManager#getUser(java.lang.String)
*/
public Role getRole(int roleid) throws AppSystemException,
AppBusinessException {
Role role = null;
try {
role = dao.getRole(roleid);
}
catch (Exception e) {
log.error("获取角色信息失败!", e);
throw new AppBusinessException(e.getMessage(), e,
ExceptionConstants.SYS_GENERAL_ERR);
}
return role;
}
/**
* @see org.appfuse.service.UserManager#getUsers(org.appfuse.model.User)
*/
public List getRoles(Role role) throws AppSystemException,
AppBusinessException {
log.debug("in RoleManagerImpl");
List list = null;
try {
list = dao.getRoles(role);
}
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 saveRole(Role role) throws AppSystemException,
AppBusinessException {
try {
dao.saveRole(role);
}
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 removeRole(int roleid) throws AppSystemException,
AppBusinessException {
if (log.isDebugEnabled()) {
log.debug("removing user: " + roleid);
}
try {
dao.removeRole(roleid);
}
catch (Exception e) {
log.error("删除角色信息失败!", e);
throw new AppBusinessException(e.getMessage(), e,
ExceptionConstants.SYS_GENERAL_ERR);
}
}
public List getStaffs(int roleid) throws AppSystemException,
AppBusinessException {
if (log.isDebugEnabled()) {
log.debug("removing user: " + roleid);
}
try {
return dao.getStaffs(roleid);
}
catch (Exception e) {
log.error("删除员工列表失败!", e);
throw new AppBusinessException(e.getMessage(), e,
ExceptionConstants.SYS_GENERAL_ERR);
}
}
public List getRoleAuth(Role role) throws AppSystemException,
AppBusinessException {
try {
return dao.getRoleAuth(role);
}
catch (Exception e) {
log.error("获取权限列表失败!", e);
throw new AppBusinessException(e.getMessage(), e,
ExceptionConstants.SYS_GENERAL_ERR);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?