jBPM4工作流開發實戰 之 第四部分 jBPM4和Web專案的結合[】

xinqing010發表於2012-03-03

對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程式碼:
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程式碼:
 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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章