admindeletecategoryaction.java

来自「新技术论坛系统 v1.0 前后台管理的初始用户名 : admin 密码 123」· Java 代码 · 共 63 行

JAVA
63
字号
package com.ntsky.bbs.web.webwork.action.category;

import com.opensymphony.xwork.ModelDriven;

import com.ntsky.bbs.domain.Category;
import com.ntsky.bbs.domain.Forum;
import com.ntsky.bbs.exception.ActionException;
import com.ntsky.bbs.exception.ServiceException;
import com.ntsky.bbs.util.memory.ForumSingleton;

/**
 * 删除主题类别
 *  
 * @author ntsky
 * @link www.ntsky.com
 * 
 * @version $Revision: 1.2 $ $Date: 2007/04/01 17:18:24 $
 */
public class AdminDeleteCategoryAction extends CategoryActionSupport {

	private int categoryId;
	public void setCategoryId(int categoryId){
		this.categoryId = categoryId;
	}
	
	private int forumId;
	public void setForumId(int forumId){
		this.forumId = forumId;
	}
	public int getForumId(){
		return this.forumId;
	}

	/**
	 * 用户删除类别
	 * @return
	 * @throws Exception
	 */
	public String execute() throws Exception {
		
		// ---------- 权限 ------------
		// 是否为论坛管理员
		if(!super.isForumManage(forumId)){
			setWarnMessage("您不是该论坛管理员,您没有删除论坛专题的权限.");
			return NO_PERMISSION;
		}		
		if(super.isAccess("canCategory")==0){
			setWarnMessage("您所属的角色没有删除论坛专题的权限.");
			return NO_PERMISSION;
		}
		// ---------------------------	
		
		try{
			categoryService.deleteCategory(categoryId);			
		}
		catch(ServiceException se){
			throw new ActionException(se);
		}
		return SUCCESS;
	}

}

⌨️ 快捷键说明

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