package com.jbpm.action;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletOutputStream;
import org.apache.struts2.ServletActionContext;
import org.jbpm.api.ProcessDefinition;
import org.jbpm.api.ProcessInstance;
import org.jbpm.api.history.HistoryProcessInstance;
import org.jbpm.api.model.ActivityCoordinates;
import org.jbpm.api.task.Task;
import com.jbpm.dto.ProcessDto;
import com.jbpm.manager.JbpmManager;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
public class JbpmAction extends ActionSupport {
private static final long serialVersionUID = 1L;
// 流程定义集合
private List<ProcessDefinition> processDefinitions;
// 流程实例集合
private List<ProcessInstance> processInstances;
// 流程参数集合
private Map<String, Object> map;
// 历史流程
private List<HistoryProcessInstance> historyProcessInstances;
// 当前用户任务集合
private List<Task> tasks;
// 数据传输域模型对象
private ProcessDto processDto;
// 用于接收经理审批结果的字符串,批注和驳回
private String result;
private JbpmManager jbpmManager;
// 用于接收前台传过来的id参数
private String id;
// 流程图活动坐标
private ActivityCoordinates activityCoordinates;
public String init() {
String roleName = (String) ActionContext.getContext().getSession().get(
"role");
processDefinitions = jbpmManager.getProcessDefinitions();
processInstances = jbpmManager.getProcessInstances();
historyProcessInstances = jbpmManager.getHistoryProcessInstances();
System.out.println("角色名称" + roleName);
tasks = jbpmManager.getTasks(roleName);
return SUCCESS;
}
/**
* 发布新流程
*
* @return
*/
public String deploy() {
jbpmManager.deploy();
return SUCCESS;
}
/**
* 删除不需的以部署流程
*
* @return
*/
public String undeploy() {
jbpmManager.undeploy(id);
return SUCCESS;
}
/**
* 启动一个流程并关联到用户
*
* @return
*/
public String start() {
map = new HashMap<String, Object>();
map.put("owner", (String) ActionContext.getContext().getSession().get(
"role"));
jbpmManager.start(id, map);
return SUCCESS;
}
/**
* 申请请求
*
* @return
*/
public String request() {
return SUCCESS;
}
/**
* 处理用户申请请求
*
* @return
*/
public String submit() {
map = new HashMap<String, Object>();
map.put("owner", processDto.getOwner());
map.put("day", Integer.parseInt(processDto.getDay()));
map.put("reason", processDto.getReason());
map.put("name", processDto.getOwner());
jbpmManager.complate(processDto.getTaskId(), map);
return SUCCESS;
}
/**
* 经理审批请求
*
* @return
*/
public String managerRequerst() {
map = jbpmManager.manager(id);
return SUCCESS;
}
/**
* 经理审批
*
* @return
*/
public String submitManager() {
jbpmManager.complateByManager(id, result);
return SUCCESS;
}
/**
* 老板请求
*
* @return
*/
public String bossRequest() {
map = jbpmManager.boss(id);
return SUCCESS;
}
/**
* 老板处理
*
* @return
*/
public String submitBoss() {
jbpmManager.complateByBoss(id);
return SUCCESS;
}
/**
* 请求显示流程图片
*
* @return
*/
public String view() {
activityCoordinates = jbpmManager.findActivityCoordinates(id);
return SUCCESS;
}
/**
* 获取流程图片
*
* @return
*/
public String pic() {
InputStream inputStream = jbpmManager.findPicInputStream(id);
PrintWriter pw = null;
if (inputStream == null) {
try {
pw = ServletActionContext.getResponse().getWriter();
pw.write("error");
} catch (IOException e) {
e.printStackTrace();
} finally {
pw.close();
}
} else {
byte[] b = new byte[1024];
int len = -1;
ServletOutputStream sos = null;
try {
sos = ServletActionContext.getResponse().getOutputStream();
while ((len = inputStream.read(b, 0, 1024)) != -1) {
sos.write(b, 0, len);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (sos != null) {
try {
sos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
return SUCCESS;
}
public List<ProcessDefinition> getProcessDefinitions() {
return processDefinitions;
}
public void setProcessDefinitions(List<ProcessDefinition> processDefinitions) {
this.processDefinitions = processDefinitions;
}
public List<ProcessInstance> getProcessInstances() {
return processInstances;
}
public void setProcessInstances(List<ProcessInstance> processInstances) {
this.processInstances = processInstances;
}
public Map<String, Object> getMap() {
return map;
}
public void setMap(Map<String, Object> map) {
this.map = map;
}
public List<Task> getTasks() {
return tasks;
}
public void setTasks(List<Task> tasks) {
this.tasks = tasks;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public JbpmManager getJbpmManager() {
return jbpmManager;
}
public void setJbpmManager(JbpmManager jbpmManager) {
this.jbpmManager = jbpmManager;
}
public ProcessDto getProcessDto() {
return processDto;
}
public void setProcessDto(ProcessDto processDto) {
this.processDto = processDto;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public List<HistoryProcessInstance> getHistoryProcessInstances() {
return historyProcessInstances;
}
public void setHistoryProcessInstances(
List<HistoryProcessInstance> historyProcessInstances) {
this.historyProcessInstances = historyProcessInstances;
}
public ActivityCoordinates getActivityCoordinates() {
return activityCoordinates;
}
public void setActivityCoordinates(ActivityCoordinates activityCoordinates) {
this.activityCoordinates = activityCoordinates;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
首先感谢原创,相关信息请查询原创。http://blog.csdn.net/centre10/article/details/6361104。 看到好多朋友找不到相应的jar包,致使jbpm4.4的学习遇到困难,现提供除jbpm4.4自身jar包外的所有包,以便大家更快的学习jbpm4.4,希望能帮朋友们少走弯路!
资源推荐
资源详情
资源评论
收起资源包目录
jbpm4.4 + ssh 案例 (103个子文件)
JbpmAction.class 8KB
JbpmManagerImpl.class 8KB
LoginAction.class 2KB
JbpmManager.class 1KB
ProcessDto.class 1KB
LoginInterceptor.class 1KB
.classpath 4KB
aspectjtools-1.7.4.jar 9.55MB
aspectjweaver-1.7.3.jar 1.74MB
spring-core-3.2.0.M2.jar 813KB
spring-context-3.2.0.M2.jar 813KB
struts2-core-2.3.4.1.jar 765KB
xwork-core-2.3.4.1.jar 614KB
spring-webmvc-3.2.0.M2.jar 596KB
spring-beans-3.2.0.M2.jar 586KB
spring-web-3.2.0.M2.jar 582KB
postgresql-9.3-1100-jdbc41.jar 573KB
commons-collections-3.1.jar 546KB
spring-jdbc-3.2.0.M2.jar 389KB
spring-orm-3.2.0.M2.jar 375KB
spring-aop-3.2.0.M2.jar 325KB
backport-util-concurrent-3.1.jar 324KB
commons-lang3-3.1.jar 308KB
spring-tx-3.2.0.RELEASE.jar 235KB
jaxen-1.1-beta-8.jar 226KB
spring-test-3.2.0.M2.jar 225KB
ognl-3.0.5.jar 222KB
spring-expression-3.2.0.M2.jar 170KB
jdom-1.0.jar 150KB
spring-dao-2.0.8.jar 127KB
commons-dbcp.jar 119KB
aspectjrt-1.7.4.jar 117KB
commons-io-1.4.jar 106KB
spring-aspects-3.2.0.M2.jar 68KB
avalon-framework.jar 62KB
subethasmtp-smtp-1.2.jar 61KB
commons-pool.jar 61KB
commons-fileupload.jar 52KB
ehcache-1.1.jar 46KB
commons-logging-api-1.1.jar 44KB
asm-3.3.jar 43KB
asm-commons-3.3.jar 37KB
commons-logging.jar 37KB
asm-util-3.1.jar 34KB
sax-2.0.1.jar 27KB
struts2-spring-plugin-2.3.4.1.jar 21KB
asm-tree-3.3.jar 21KB
subethasmtp-wiser-1.2.jar 7KB
aspectj-1.0.jar 5KB
aopalliance-1.0.jar 4KB
JbpmAction.java 6KB
JbpmManagerImpl.java 5KB
JbpmManager.java 2KB
LoginAction.java 1KB
LoginInterceptor.java 656B
ProcessDto.java 633B
index.jsp 6KB
request.jsp 2KB
login.jsp 2KB
boss.jsp 2KB
manager.jsp 2KB
view.jsp 1KB
.strutsWeb.mex 2KB
.strutsWeb.mex 2KB
.struts.mex 236B
.struts.mex 236B
.strutsGlobal.mex 153B
.strutsGlobal.mex 153B
MANIFEST.MF 36B
.mymetadata 328B
leave.png 15KB
leave.png 15KB
org.eclipse.jdt.core.prefs 330B
.project 1KB
log4j.properties 2KB
log4j.properties 2KB
jdbc.properties 166B
jdbc.properties 166B
jbpm.mail.properties 72B
jbpm.mail.properties 72B
applicationContext-common.xml 4KB
applicationContext-common.xml 4KB
applicationContext-beans.xml 2KB
applicationContext-beans.xml 2KB
jbpm.spring.default.cfg.xml 2KB
jbpm.spring.default.cfg.xml 2KB
strutsWeb.xml 2KB
strutsWeb.xml 2KB
applicationContext-actions.xml 2KB
applicationContext-actions.xml 2KB
strutsGlobal.xml 2KB
strutsGlobal.xml 2KB
applicationContext.xml 1KB
applicationContext.xml 1KB
web.xml 1KB
leave.jpdl.xml 1KB
leave.jpdl.xml 1KB
jbpm.cfg.xml 644B
jbpm.cfg.xml 644B
struts.xml 340B
共 103 条
- 1
- 2
lij71
- 粉丝: 15
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- (源码)基于ESP8266的WebDAV服务器与3D打印机管理系统.zip
- (源码)基于Nio实现的Mycat 2.0数据库代理系统.zip
- (源码)基于Java的高校学生就业管理系统.zip
- (源码)基于Spring Boot框架的博客系统.zip
- (源码)基于Spring Boot框架的博客管理系统.zip
- (源码)基于ESP8266和Blynk的IR设备控制系统.zip
- (源码)基于Java和JSP的校园论坛系统.zip
- (源码)基于ROS Kinetic框架的AGV激光雷达导航与SLAM系统.zip
- (源码)基于PythonDjango框架的资产管理系统.zip
- (源码)基于计算机系统原理与Arduino技术的学习平台.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页