ITPub博客

首页 > Linux操作系统 > Linux操作系统 > jBPM4工作流开发实战 之 第四部分 jBPM4和Web项目的结合[】

jBPM4工作流开发实战 之 第四部分 jBPM4和Web项目的结合[】

原创 Linux操作系统 作者:xinqing010 时间:2012-03-03 15:06:41 0 删除 编辑

对Tomcat的修改
在将jBPM与web项目结合的时候,需要把jBPM资源包中的juel-engine.jar和juel-impl.jar添加到tomcat/lib下,同时在Web应用的lib下面,把juel-api.jar、juel-engine.jar和juel-impl.jar 删除掉。
注意,以后在建立web工程的时候,需要选择修改后的tomcat。
 
将jPDL的图片发布到jBPM中
1:首先把jpdl和png打到一起,打成zip包。
2:然后修改流程定义的代码,通过读取zip文件的方式来发布:

java代码:
ProcessEngine processEngine = Configuration.getProcessEngine();
RepositoryService repositoryService = processEngine.getRepositoryService();
//repositoryService.createDeployment().addResourceFromClasspath("leave.jpdl.xml").deploy();
ZipInputStream zis = new ZipInputStream(this.getClass().getResourceAsStream("/doc.zip")); 
repositoryService.createDeployment().addResourcesFromZipInputStream(zis).deploy();
 
将jPDL的图片发布到jBPM中,页面上的代码示例如下:

java代码:
<%!
public InputStream showWebPicture(){
ProcessEngine engine = Configuration.getProcessEngine();
RepositoryService rs = engine.getRepositoryService();
ProcessDefinition pd = rs.createProcessDefinitionQuery().processDefinitionId("at-4").uniqueResult();
InputStream in = rs.getResourceAsStream(pd.getDeploymentId(), "at.png");
return in;
}
%><%
InputStream in = showWebPicture();
byte bs[] = new byte[1024];
while(in.read(bs)!=-1){
response.getOutputStream().write(bs);
}
out.clear();
ut = pageContext.pushBody();
%>
java代码:
ProcessInstance pi = executionService.findProcessInstanceById("test1.10001");
Set activityNames = pi.findActiveActivityNames();
 
for (String activityName:activityNames){
String pdId = pi.getProcessDefinitionId();
ActivityCoordinates ac = repositoryService.getActivityCoordinates(pdId,activityName);
System.out.println("activityName="+activityName);
System.out.println("x="+ac.getX());
System.out.println("y="+ac.getY());
System.out.println("height="+ac.getHeight());
System.out.println("width="+ac.getWidth());
System.out.println("---------------------");
}
java代码:
<%
ProcessInstance pi = executionService.findProcessInstanceById("test1.10001");
Set activityNames = pi.findActiveActivityNames();
for (String acitiveAcitityName:activityNames){
String pdId = pi.getProcessDefinitionId();
ActivityCoordinates ac = repositoryService.getActivityCoordinates(pdId,acitiveAcitityName);
%>
<%}%>

java代码:
ProcessInstance pi = executionService.findProcessInstanceById("test1.10001");
Set activityNames = pi.findActiveActivityNames();
for (String acitiveAcitityName:activityNames){
String pdId = pi.getProcessDefinitionId();
ActivityCoordinates ac = repositoryService.getActivityCoordinates(pdId,acitiveAcitityName);
%>
<%}%>
 
视频配套PPT,视频地址【 最新jbpm4工作流开发实战视频课程 】

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26715458/viewspace-717589/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2012-03-01

  • 博文量
    31
  • 访问量
    59796