Jbpm Process Template release

Source: Internet
Author: User
Tags jbpm

Since I am currently using the jbpm-3.2.2 version, now I am using this version to release the Process Template demonstration (jbpm 3. X version is roughly similar)

The Process Template is released to the database to facilitate the process engine's direct operations on the database and control the process; the following process template is used as an example:

This is a process template designed visually. After the configuration is complete, it needs to be published to the database;

1. after the process template is designed and saved, three files (two in jbpm3 and two in jbpm4) will appear under our package, respectively (): workflow (process image generated by the first two files );

Publishing stores the three files in the database together;

2. the jbpm process can be released in two ways:. use jbpm's process designer set to publish the process servlet. B. export the process file from the designer as a zip package file, and then use the application to publish it to the database (this is what we will introduce today );

3. the following describes the specific operations of the second method:. without the convenience provided by the process designer, you can directly operate it manually: We put the three process template files in the specified folder (according to your hobbies, but it is best not to put it in the Chinese directory), and then use a tool such as WinRAR to package it as a zip package file. After packaging, we can write an application for release, the program code is as follows:

Package jbpm; import Java. io. file; import Java. io. fileinputstream; import Java. io. inputstream; import java.util.zip. zipinputstream; import Org. jbpm. jbpmconfiguration; import Org. jbpm. jbpmcontext; import Org. jbpm. graph. def. processdefinition; public class deploymenttest {/*** @ Param ARGs */public static void main (string [] ARGs) throws exception {jbpmcontext = jbpmconfiguration. getinstance (). createjbpmcontext (); try {// define the location of the package file string archivefile = "E:/workspces/myeclipse_8.5_workspaces/sanitation/webroot/jbpm/processdefinition.zip "; inputstream is = new fileinputstream (new file (archivefile); // generate the zip input stream zipinputstream zis = new zipinputstream (is ); // generate the processdefinition object processdefinition Pd = processdefinition of jbpm based on the input stream file of zip. parseparzipinputstream (zis); // use jbpmcontext to publish the process to the database jbpmcontext. deployprocessdefinition (PD); // close the stream Zis. close (); is. close ();} finally {jbpmcontext. close ();}}}

Before allowing this program, we must ensure that the hibernate configuration file hibernate. cxf. XML has been correctly configured and the corresponding package has been imported to ensure that the database can be correctly connected;
Next, right-click the class and choose run as ----> JAVA application to allow the test class. If no console error is displayed, the test is successful. To ensure that the execution result is correct:

We can open the database and find the jbpm_processdefinition table (I have released it twice here ):

This indicates that the release is successful. B. in this operation, we can also take advantage of the convenience of the Process designer: Help us to package the template; open the process configurator and select deployment

-----> We can see that the page is divided into four areas. The specific operations for each area are not mentioned here. Now we only need to use the files and folders and local Save settings regions ----->

Select the three files to be packaged in the files and folders area, and then select Save process archive locally in Local save Settings>

Next, select the path to be placed in the zip package file. After the selection is complete, click Save without deploying... to package the package file to your specified directory;

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.