📄 articleauditsubaction.java
字号:
package c20.struts.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmContext;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.graph.exe.Token;
import c20.entity.Article;
import c20.service.ArticleService;
import c20.service.ArticleTypeService;
import c20.session.UserSession;
import c20.util.ConvertUtil;
/**
*
* 审批文章操作Action类
* @struts.action path="/articleauditsub" scope="request" validate="false"
*/
public class ArticleAuditSubAction extends Action{
private static final Log log = LogFactory.getLog(ArticleAuditSubAction.class);
/**
* 文章服务接口实现对象
*/
private ArticleService articleService;
/**
* 文章类型服务接口实现对象
*/
private ArticleTypeService articleTypeService;
/**
* JBPM服务接口实现对象
*/
private JbpmConfiguration jbpmConfiguration;
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
log.debug("MyArticleAction.execute()");
UserSession userSesssion = UserSession.getSession(request, response);
//得到文章号
String sarticleNo = request.getParameter("articleNo");
int articleNo = ConvertUtil.convertInt(sarticleNo);
//得到文章信息
Article article = articleService.getArticle(articleNo);
//判断此用户是否有此文章审批权限
if(article.getAuditState() != null && article.getAuditState().equals(userSesssion.getDutyValue())){
//得到审批说明
String auditComment = request.getParameter("auditComment");
article.setAuditComment(auditComment);
//修改文章信息
articleService.modArticle(article);
//得到相应的流程
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
ProcessInstance processInstance = jbpmContext.getProcessInstance(article.getPiId());
String transitionname = request.getParameter("transitionname");
//触发审批转换,改变文章状态
Token token = processInstance.getRootToken();
token.signal(transitionname);
//保存流程实例状态
jbpmContext.save(processInstance);
jbpmContext.save(token);
jbpmContext.close();
}
return mapping.findForward("success");
}
/**
* 得到文章服务接口实现对象
* @return articleService
*/
public ArticleService getArticleService() {
return articleService;
}
/**
* 设置文章服务接口实现对象
* @param articleService 要设置的 articleService
*/
public void setArticleService(ArticleService articleService) {
this.articleService = articleService;
}
/**
* 得到JBPM服务接口实现对象
* @return jbpmConfiguration
*/
public JbpmConfiguration getJbpmConfiguration() {
return jbpmConfiguration;
}
/**
* 设置JBPM服务接口实现对象
* @param jbpmConfiguration 要设置的 jbpmConfiguration
*/
public void setJbpmConfiguration(JbpmConfiguration jbpmConfiguration) {
this.jbpmConfiguration = jbpmConfiguration;
}
/**
* 得到文章类型服务接口实现对象
* @return articleTypeService
*/
public ArticleTypeService getArticleTypeService() {
return articleTypeService;
}
/**
* 设置文章类型服务接口实现对象
* @param articleTypeService 要设置的 articleTypeService
*/
public void setArticleTypeService(ArticleTypeService articleTypeService) {
this.articleTypeService = articleTypeService;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -