1. Download jbpm4.3
Http://sourceforge.net/projects/jbpm/files/
Decompress the package and you will see the following sub-directories.
* Install: the configuration file required to install jbmp
* DOC: User Manual, javadoc, and Development Guide
* Examples: Sample process used in the user manual
* Lib: third-party libraries and some specific jbpm dependent Libraries
* SRC: source code
* Jbpm. jar: jbpm master database Archive
* Migration: It seems that the Migration file of earlier versions is useless.
2. Download JDK (standard Java 5 or later)
3. download the latest version of eclipse from the eclipse website.
4. Install the GPD plug-in on Eclipse
The procedure is as follows:
* Help --> install new software
* Click Add.
* In the Add site dialog box, click archive ....
* Find INSTALL \ SRC \ GPD \ jbpm-gpd-site.zip in jbpm4.0 home and click 'open'
* Select the jpdl 4 GPD Update site that appears.
* Click Next. Then click Finish.
* Accept the protocol ..
* Restart eclipse when it asks
Note: the installation process will be slow and you must wait patiently.
5. Create a Java project and add the dependency package of jbpm4.
* Jbpm4_home/jbpm. Jar
* Jbpm4_home/lib/*. Jar
6. in the src directory of the Project, right-click --> New --> jbpm 4 Process definetion, and enter "hello" in the file name in the pop-up dialog box. The file is named jpdl. XML ends with a suffix, and then click Finish.
7. Draw a simple flowchart in hello. jpdl. XML that contains a start activity, a State activity, and an end activity, and then link them with a transfer.
Java code
<? XML version = "1.0" encoding = "UTF-8"?>
<Process name = "hello" xmlns = "http://jbpm.org/4.0/jpdl">
<Start name = "start1" G = "247,64, 48, 48">
<Transition name = "to state1" to = "state1" G = "-59,-17"/>
</Start>
<State name = "state1" G = "254,167, 92,52">
<Transition name = "to end1" to = "end1" G = "-47,-17"/>
</State>
<End name = "end1" G = "244,277,"/>
</Process>
<? XML version = "1.0" encoding = "UTF-8"?>
<Process name = "hello" xmlns = "http://jbpm.org/4.0/jpdl">
<Start name = "start1" G = "247,64, 48, 48">
<Transition name = "to state1" to = "state1" G = "-59,-17"/>
</Start>
<State name = "state1" G = "254,167, 92,52">
<Transition name = "to end1" to = "end1" G = "-47,-17"/>
</State>
<End name = "end1" G = "244,277,"/>
</Process>
8. Copy all the files except org In jbpm4_home/examples/src to the src directory of your project.
9. Create a test class under the src directory of your project
Java code
Package com;
IMP
ORT JUnit. Framework. testcase;
IMPORT org. jbpm. API. configuration;
IMPORT org. jbpm. API. executionservice;
IMPORT org. jbpm. API. processengine;
IMPORT org. jbpm. API. processinstance;
IMPORT org. jbpm. API. repositoryservice;
Public class hellotest extends testcase {
Processengine = NULL;
String deployid = NULL;
// Mainly used for the release process
Repositoryservice = NULL;
// Mainly used to start and execute the process
Executionservice = NULL;
Protected void setup (){
Processengine = new configuration (). buildprocessengine ();
Repositoryservice = processengine. getrepositoryservice ();
Executionservice = processengine. getexecutionservice ();
// Deploy the Defined Process configuration file to the database
Deployid = repositoryservice. createdeployment (). addresourcefromclasspath ("Hello. jpdl. xml"). Deploy ();
}
Protected void teardown (){
Repositoryservice. deletedeploymentcascade (deployid );
}
Public void testendhelloworld (){
// Start the process instance
Processinstance = executionservice. startprocessinstancebykey ("hello ");
// After the process is started, our process automatically enters the state1 activity and is waiting.
Asserttrue (processinstance. isactive ("state1 "));
String pid = processinstance. GETID ();
// Let the state1 activity continue to run and end the activity. The process ends.
Processinstance = executionservice. signalexecutionbyid (PID );
Asserttrue (processinstance. isended ());
}
}
10. If no error is reported during the test, the test is successful.