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

📄 replybuilder.java

📁 tbuy1.1.5是在netbeans环境下用JSF技术编写的一个论坛tbuy1.1.5是在netbeans环境下用JSF技术编写的一个论坛
💻 JAVA
字号:
/* * 作者: 胡李青 * qq: 31703299 * Copyright (c) 2007 huliqing * 主页 http://www.tbuy.biz/ * 你可以免费使用该软件,未经许可请勿作用于任何商业目的,如有技术问题请与本人联系! */package biz.tbuy.bbs;import biz.tbuy.common.Utils;/** * @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 ReplyBuilder extends Builder{    private ReplyModel _reply;    private AuthReply _authenticator;        public ReplyBuilder(ReplyModel reply, AuthReply authenticator) {        _reply = reply;        _authenticator = authenticator;    }        // -------------------------------------------------- new reply        /**     * 获取用户是否有权限编辑该回复贴的内容     * @return true or false     */    public boolean isUpdate() {        return _authenticator.isReplyUpdate();    }        /**     * 创建reply回复信息     * @return key 如果回复成功则返回该reply的id,即r_num,否则返回-1;     */    public int reply() throws Exception {        if (!_authenticator.isReply()) {            Utils.addErrorMessage(getBundle(),                     "对不起,你无法回复该贴,可能贴子已锁或相应的讨论区已经关闭该功能");            return -1;        }        int key = ReplyAction.addReplyWithKey(_reply);        if (key != -1) _reply.setNum(key);        return key;    }        // -------------------------------------------------- update reply        /**     * 更新回复信息的内容     * @param content     * @return true or false     */    public boolean updateContent(String content) {        if (!_authenticator.isReplyUpdate()) {            Utils.addErrorMessage(getBundle(), "对不起,你没有权限编辑该信息");            return false;        }        _reply.setContent(content);        _reply.setEditByUser(getVisitor().getUser().getId());        return update();    }        /**     * 回收reply信息     * @return true 如果回收成功, 否则返回false     */    public boolean revoke() {        if (!_authenticator.isReplyRevoke()) {            Utils.addErrorMessage(getBundle(), "对不起,你没有权限删除该信息");            return false;        }        _reply.setBeRevoke(true);        return update();    }        // -------------------------------------------------- upload file        /**     * 处理上传文件信息,将fileModel信息加入数据库中     * @param file     * @return true or false     */    public boolean uploadFile(FileModel file) {        if (!_authenticator.isUpload()) {            Utils.addErrorMessage(getBundle(), "错误,讨论区已禁止上传附件!");            return false;        }        if (file == null) return false;        return FileAction.addFile(file);    }        private boolean update() {        return ReplyAction.updateReply(_reply);    }}

⌨️ 快捷键说明

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