At line 1 changed 1 line. |
__Part II:__ [Integrating jBPM into AppFuse - Part Deux] - A HowTo for enhancing jBPM Support into AppFuse. |
__Part I:__ [Integrating jBPM into AppFuse] - Integrate jBPM Support (via Spring-Modules) into AppFuse.\\ |
__Part II:__ [Integrating jBPM into AppFuse Part Deux] - Setup AppFuse/jBPM in Eclipse, model defintions using the Jbpm Process Designer.\\ |
__Part III:__ [Integrating jBPM into AppFuse Part Trois] - Enhance defintions to support tasks, users, schedule and injecting spring beans into actions (Under Construction).\\ |
At line 5 changed 1 line. |
This tutorial is a continuation from [Integrating jBPM into AppFuse]. Please refer to the previous tutorial to complete your basic configuration. In this tutorial we will expand into writing real-world like process defintions, overview of the various jBPM services (persistence, schedule, logging etc) and injecting spring beans into actions. We will also address the issue of redeploying process defintions across server restarts. |
This is the 2nd tutorial of a 3 part series. The tutorial covers how to setup AppFuse/Jbpm in Eclipse and model definitions using the Jbpm Process Designer. Before proceeding further please have your basic configuration setup from Part I.\\ |
At line 11 changed 7 lines. |
* [4] Create and load identities into jBPM database |
* [5] Enhance Process Defintion by creating and assigning tasks |
* [6] Write test case to validate Process Definition execution |
* [7] Enhance Process Defintion by creating ActionHandlers (DecisionHandler) |
* [8] Write test case to validate new Process Definition execution |
* [9] Wire spring beans inside jBPM Actions |
* [10] Test spring bean execution |
* [4] Apply patch to prevent process definition redployment across server restart |
At line 26 changed 1 line. |
Before we dive into creating process definitions with the new tool lets create some packages where we will save our process defintions and actions. |
Before creating process definitions lets create a package where we will save our process defintions. |
At line 28 changed 4 lines. |
Create the following packages:\\ |
{{org.appfuse.jbpm.process}} - will contain process defintions\\ |
{{org.appfuse.jbpm.action}} - will contain jbpm actions\\ |
{{org.appfuse.jbpm.ant}} - will contain ant tasks (such as loading identities, cleaning schema, etc)\\ |
Create the following package:\\ |
{{org.appfuse.jbpm.process}}\\ |
At line 35 changed 1 line. |
So lets start off by creating a simple test process.\\ |
Start off by creating a simple test process.\\ |
At line 47 removed 2 lines. |
iii) That should give you the graphical tool interface as such.\\ |
|
At line 51 changed 1 line. |
We are now ready to start designing!\\ |
Reference the definition in {{org/appfuse/jbpm/dao/hibernate/applicationContext-hibernate.xml}}:\\ |
At line 53 removed 2 lines. |
Before we really begin we have to reference the definition in {{org/appfuse/jbpm/dao/hibernate/applicationContext-hibernate.xml}}:\\ |
|
At line 75 changed 1 line. |
1) Click on one of each process states(Start, State, End) on the left panel and draw them in. You can edit the names of the states by clicking on thier name. |
1) Click on one of each process states(Start, State, End) on the left panel and draw them in. |
At line 77 changed 1 line. |
2) Choose transition from the left panel and click once on the start state and then on helloWorld state. Then from helloWorld to end. |
2) Choose transition from the left panel and click thru all the states to establish flow. |
At line 81 changed 1 line. |
Congratulations you have created a process definition using the process design tool! |
Congratulations you have written your 1st process defintion! |
At line 83 changed 4 lines. |
Let's write a test case to validate our process definition. |
|
!![#2] Write test case to validate Process Definition execution |
We have already written a test case in the [previous article|IntegratingJBPMIntoAppFuse], so go ahead and create {{ProcessTest.java}} class under {{test/dao/org/appfuse/jbpm/dao}} and copy the code from the previous installment with the following modifications:\\ |
!![#3] Write test case to validate Process Definition execution |
There is a test case in the [previous article|IntegratingJBPMIntoAppFuse]. Create {{ProcessTest.java}} class under {{test/dao/org/appfuse/jbpm/dao}} and copy the code from the previous installment with the following modifications:\\ |
At line 108 changed 3 lines. |
It time to recompile and run our junit test. Execute __ant refresh__. |
|
|
Recompile and run JUnit test. Execute __ant refresh__. |
\\ |
\\ |
At line 112 changed 1 line. |
|
\\ |
\\ |
At line 114 changed 2 lines. |
|
|
\\ |
\\ |
At line 117 changed 4 lines. |
|
And finally select Project from the Eclispe's menu above and choose clean. |
|
|
\\ |
\\ |
Select Project from the Eclispe's menu above and choose clean. |
\\ |
\\ |
At line 122 changed 4 lines. |
|
Now you can run the ProcessTest. Ensure you have ProcessTest open and selected and then choose Run As -> Junit Test |
|
|
\\ |
\\ |
Now you can run the ProcessTest. Ensure ProcessTest is open and selected and then choose Run As -> JUnit Test |
\\ |
\\ |
At line 127 changed 1 line. |
|
\\ |
\\ |
At line 124 added 3 lines. |
\\ |
\\ |
Congratulations you have deployed and tested a process defintion! |
At line 128 added 17 lines. |
!![#4] Apply patch to prevent process definition redployment across server restart |
;:%%(color: blue)''For production usage it is not ideal to redeploy process definitions on server restarts. Once you have stable definitions there is no need for redeployment. You can apply the following patch to have the JbpmConfiguration not deploy process definitions on restarts, instead have it redeployed only if the definition on the file system is out of sync with the database.''%% |
\\ |
Modify the jbpmConfig bean in {{{org/appfuse/jbpm/dao/hibernate/applicationContext-hibernate.xml}}} to reflect the new overwritten {{ CustomLocalJbpmConfigurationFactoryBean }}.\\ |
{{{ |
<!-- jBPM Configuration --> |
<bean id="jbpmConfig" class="org.appfuse.jbpm.config.CustomLocalJbpmConfigurationFactoryBean"> |
.... |
.... |
}}} |
\\ |
Create the following package:\\ |
{{ org.appfuse.jbpm.config }} |
\\ |
\\ |
Create {{ CustomLocalJbpmConfigurationFactoryBean.java }} in above package and copy code from [CustomLocalJbpmConfigurationFactoryBean.java] into it.\\ |
Voila! When you restart the server the process defintion wont be redeployed. |
At line 134 removed 4 lines. |
You have successfully deployed and tested a process definition. |
|
;:%%(color: blue)''For production usage it is not ideal to redeploy process definitions on startup. Once you have played around with your process defintion and are quite certain you are going to stick with it. You can apply the following patch to have the JbpmConfiguration not deploy a process definition every time you restart, rather have it redeployed only if the processdefinition.xml on the file system is out of sync with the database version''%% |
|