teachdocumentaction.java

来自「源码/软件简介: 云网论坛1.1RC国际版是采用JSP开发的集论坛、CMS(网」· Java 代码 · 共 59 行

JAVA
59
字号
package cn.js.fan.module.cms.plugin.teach;

import cn.js.fan.util.ErrMsgException;
import javax.servlet.ServletContext;
import org.apache.log4j.Logger;
import cn.js.fan.module.cms.plugin.base.IPluginDocumentAction;
import cn.js.fan.module.cms.CMSMultiFileUploadBean;
import cn.js.fan.module.cms.Document;
import cn.js.fan.util.StrUtil;

public class TeachDocumentAction implements IPluginDocumentAction {
    Logger logger = Logger.getLogger(this.getClass().getName());

    public TeachDocumentAction() {
    }

    public boolean create(ServletContext application,
                          CMSMultiFileUploadBean mfu, Document doc) throws
            ErrMsgException {
        int speedCount = 0;
        String sspeedCount = StrUtil.getNullStr(mfu.getFieldValue("speedCount"));
        String pptPath = StrUtil.getNullStr(mfu.getFieldValue("pptPath")).trim();
        if (StrUtil.isNumeric(sspeedCount)) {
            speedCount = Integer.parseInt(sspeedCount);
        }
        boolean useCard = false;
        String strUseCard = StrUtil.getNullStr(mfu.getFieldValue("isUseCard"));
        if (strUseCard.equals("true"))
            useCard = true;
        TeachDocumentDb td = new TeachDocumentDb();
        td.setDocId(doc.getID());
        td.setSpeedCount(speedCount);
        td.setPptPath(pptPath);
        td.setUseCard(useCard);
        return td.create();
    }

    public boolean update(ServletContext application,
                   CMSMultiFileUploadBean mfu, Document doc) throws
            ErrMsgException {
        int speedCount = 0;
        String sspeedCount = StrUtil.getNullStr(mfu.getFieldValue("speedCount"));
        String pptPath = StrUtil.getNullStr(mfu.getFieldValue("pptPath"));
        boolean useCard = false;
        String strUseCard = StrUtil.getNullStr(mfu.getFieldValue("isUseCard"));
        if (strUseCard.equals("true"))
            useCard = true;
        if (StrUtil.isNumeric(sspeedCount)) {
            speedCount = Integer.parseInt(sspeedCount);
        }
        TeachDocumentDb td = new TeachDocumentDb();
        td = td.getTeachDocumentDb(doc.getID());
        td.setSpeedCount(speedCount);
        td.setUseCard(useCard);
        td.setPptPath(pptPath);
        return td.save();
    }
}

⌨️ 快捷键说明

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