📄 infomsgaction.java
字号:
package com.redmoon.forum.plugin.info;
import javax.servlet.http.HttpServletRequest;
import cn.js.fan.util.ErrMsgException;
import javax.servlet.ServletContext;
import com.redmoon.forum.plugin.base.IPluginMsgAction;
import org.apache.log4j.Logger;
import com.redmoon.forum.MsgDb;
import cn.js.fan.util.ResKeyException;
import com.redmoon.kit.util.FileUpload;
public class InfoMsgAction implements IPluginMsgAction {
Logger logger = Logger.getLogger(this.getClass().getName());
public InfoMsgAction() {
}
/**
*
* @param application ServletContext
* @param request HttpServletRequest
* @param md MsgDb 所存储的是ReceiveData后得来的信息
* @return boolean
* @throws ErrMsgException
*/
public synchronized boolean editTopic(ServletContext application,
HttpServletRequest request,
MsgDb md, FileUpload fu) throws
ErrMsgException {
boolean re = true;
if (md.getReplyid() == -1) {
InfoDb infoDb = new InfoDb();
infoDb = infoDb.getInfoDb(md.getId());
String typeCode = fu.getFieldValue("typeCode");
if (typeCode==null || typeCode.equals(""))
throw new ErrMsgException(InfoSkin.LoadString(request, "err_want_typecode"));
infoDb.setTypeCode(typeCode);
re = infoDb.save();
}
return re;
}
public boolean AddNew(ServletContext application,
HttpServletRequest request, MsgDb md, FileUpload fu) throws
ErrMsgException {
// logger.info("AddNew:id=" + md.getId());
String typeCode = fu.getFieldValue("typeCode");
if (typeCode==null || typeCode.equals(""))
throw new ErrMsgException(InfoSkin.LoadString(request, "err_want_typecode"));
InfoDb infoDb = new InfoDb();
infoDb.setId(md.getId());
infoDb.setTypeCode(typeCode);
infoDb.setUserName(md.getName());
boolean re = false;
try {
re = infoDb.create();
} catch (ResKeyException e) {
throw new ErrMsgException(e.getMessage(request));
}
return re;
}
public boolean AddQuickReply(ServletContext application,
HttpServletRequest request, long replyMsgId) throws
ErrMsgException {
return true;
}
/**
* 本方法置于MsgMgr中delTopic真正删除贴子之前,使在删除插件相应内容后,再删除贴子本身
* @param application ServletContext
* @param request HttpServletRequest
* @param md MsgDb
* @return boolean
* @throws ErrMsgException
*/
public boolean delTopic(ServletContext application,
HttpServletRequest request, MsgDb md) throws
ErrMsgException {
// 如果是删除根贴
if (md.getReplyid() == -1) {
// 删除plugin_auction中对应的内容,所有plugin_auction_sq_message中对应于msgRootId的内容
// 及所有plugin_auction_user中对应的msgRootId中的内容
InfoDb sd = new InfoDb();
sd = sd.getInfoDb(md.getId());
sd.del();
}
return true;
}
/**
* 此函数置于MsgDb delSingleMsg中真正删除贴子之前,以便于递归删除贴子
* @param delId int
* @return boolean
* @throws ErrMsgException
*/
public boolean delSingleMsg(long delId) throws
ResKeyException {
//InfoMsgDb sm = new InfoMsgDb();
//sm = sm.getInfoMsgDb(delId);
//return sm.del();
return true;
}
public boolean AddReply(ServletContext application,
HttpServletRequest request, MsgDb md, FileUpload fu) throws
ErrMsgException {
return true;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -