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

对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。
111f7677302792a9ee7583839cf05f7b__1.jpg
fedfdc0a573ceae871b925b5a545f1fd__2.jpg
将jPDL的图片发布到jBPM中
1:首先把jpdl和png打到一起,打成zip包。
2:然后修改流程定义的代码,通过读取zip文件的方式来发布:
 ProcessEngine processEngine=Configuration.getProcessEngine(); 
    RepositoryServicerepositoryService=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中,页面上的代码示例如下:
<%! 
    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; 
    } %>
ProcessInstance pi = executionService.findProcessInstanceById("test1.10001");    
    Set<String> 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("---------------------");    
    }

<%  ProcessInstance pi = executionService.findProcessInstanceById("test1.10001"); 
    Set<String> activityNames = pi.findActiveActivityNames(); 
    for (String acitiveAcitityName:activityNames){ 
        String pdId = pi.getProcessDefinitionId(); 
        ActivityCoordinates ac = repositoryService.getActivityCoordinates(pdId,acitiveAcitityName); 
%> 
<div style="position:absolute;border:1px solid red;  left:
   <%=ac.getX()%>px;top:<%=ac.getY()%>px;  width:<%=ac.getWidth()%>px;height:<%=ac.getHeight()%>px;">  </div>  <%}%>

 视频配套PPT,视频地址【 最新jbpm4工作流开发实战视频课程 】

你可能感兴趣的:(Web,视频,String,jbpm,工作流)