📄 adminrevokeforums.java
字号:
/* * 作者: 胡李青 * qq: 31703299 * Copyright (c) 2007 huliqing * 主页 http://www.tbuy.biz/ * 你可以免费使用该软件,未经许可请勿作用于任何商业目的,如有技术问题请与本人联系! */package biz.tbuy.bbs.bean;import biz.tbuy.bbs.ForumAction;import biz.tbuy.bbs.ForumModel;import biz.tbuy.common.Constants;import biz.tbuy.common.Utils;import biz.tbuy.common.page.DataPage;import biz.tbuy.common.page.PagedListDataModel;import java.util.List;import javax.faces.component.UIData;import javax.faces.model.DataModel;/** * @author huliqing * <p><b>qq:</b>31703299 * <p><b>E-mail:</b><a href="mailto:huliqing.cn@gmail.com">huliqing.cn@gmail.com</a> * <p><b>Homepage:</b><a href="http://www.tbuy.biz/">http://www.tbuy.biz/</a> */public class AdminRevokeForums extends BaseBean{ private DataModel _revokeForums;// 已经被回收的专区 private UIData _uiRevokeForums; // private int _pageSize = 12; // 默认的分页显示数目 /** Creates a new instance of AdminRevokeForums */ public AdminRevokeForums() { } public void setRevokeForums(DataModel revokeForums) { _revokeForums = revokeForums; } public DataModel getRevokeForums() { if (_revokeForums == null) { _revokeForums = new LocalDataModel(_pageSize); } return _revokeForums; } public void setUiRevokeForums(UIData uiRevokeForums) { _uiRevokeForums = uiRevokeForums; } public UIData getUiRevokeForums() { return _uiRevokeForums; } public void setPageSize(int pageSize) { _pageSize = pageSize; } public int getPageSize() { return _pageSize; } /*** page about ******************************************/ private DataPage getDataPage(int startRow, int pageSize) { int total; List<ForumModel> dataList = null; total = ForumAction.getTotalRevokeForums(); dataList = ForumAction.getRevokeForums(startRow, pageSize); return new DataPage(total, startRow, dataList); } private class LocalDataModel extends PagedListDataModel { public LocalDataModel(int pageSize) { super(pageSize); } public DataPage fetchPage(int startRow,int pageSize) { // call enclosing managed bean method to fetch the data return getDataPage(startRow, pageSize); } } /** * 清空所有被回收的讨论区,并且删除相关联的所有信息 * 该方法会彻底的删除,从数据库中... */ public String clear() { if (ForumAction.clearRevokeForums()) { Utils.addInfoMessage(getBundle(), "清理讨论区信息成功!"); _revokeForums = new LocalDataModel(_pageSize); return Constants.OUT_SUCCESS; } else { Utils.addErrorMessage(getBundle(), "清理讨论区信息时遇到问题!"); return Constants.OUT_FAILURE; } } /** * 恢复被回收的讨论区到原来的状态 */ public String revert() { ForumModel forum = (ForumModel)_uiRevokeForums.getRowData(); forum.setBeRevoke(false); if (ForumAction.updateForum(forum)) { Utils.addInfoMessage(getBundle(), "讨论区已经恢复"); _revokeForums = new LocalDataModel(_pageSize); getBBSApplication().reloadZonsAndForums(); // 重新载入专区及讨论区 } else { Utils.addErrorMessage(getBundle(), "讨论区恢复时遇到问题!"); } return Constants.OUT_SUCCESS; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -