Raible's Wiki
Raible Designs AppFuseHomepage- Korean - Chinese - Italian - Japanese QuickStart Guide User Guide Tutorials Other ApplicationsStruts ResumeSecurity Example Struts Menu
Set your name in
UserPreferences
Referenced by
JSPWiki v2.2.33
Hide Menu |
This is version 25.
It is not the current version, and thus it cannot be edited. Part II: Integrating jBPM into AppFuse - Part Deux - A HowTo for enhancing jBPM Support into AppFuse. About this tutorialThis 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.Table of Contents
[#1] Install Process Design Tool for EclispeSee AppFuseEclipse on how to configure AppFuse with Eclipse.Download JBoss jBPM Process Designer Plugin. Version 3.0.13 is used for this tutorial. Copy the features and plugins directory from the unzipped file to your %ECLIPSE_HOME% directory. Start Eclipse from command line by issuing eclipse -clean. Voila! [#2] Create a simple Process DefintionBefore we dive into creating process definitions with the new tool lets create some packages where we will save our process defintions and actions.Create the following packages:
ii) Give the process a name - test.
iii) That should give you the graphical tool interface as such.
We are now ready to start designing! Before we really begin we have to reference the definition in org/appfuse/jbpm/dao/hibernate/applicationContext-hibernate.xml: <!-- jBPM Configuration --> <bean id="jbpmConfig" class="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean"> <!-- pass in existing sessionFactory --> <property name="sessionFactory" ref="jbpmSessionFactory"/> <property name="configuration" value="org/appfuse/jbpm/jbpm.cfg.xml"/> <property name="processDefinitions"> <list> <ref local="testProcess"/> </list> </property> <property name="createSchema" value="false"/> </bean> <bean id="testProcess" class="org.springmodules.workflow.jbpm31.definition.ProcessDefinitionFactoryBean"> <property name="definitionLocation" value="org/appfuse/jbpm/process/test/processdefinition.xml"/> </bean> 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. 2) Choose transition from the left panel and click once on the start state and then on helloWorld state. Then from helloWorld to end.
Congratulations you have created a process definition using the process design tool! Let's write a test case to validate our process definition. [#2] Write test case to validate Process Definition executionWe have already written a test case in the previous article, 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:protected void onSetUpBeforeTransaction() throws Exception { ... definition = context.getGraphSession().findLatestProcessDefinition("test"); } public void testProcessDefinition() throws Exception { ProcessDefinition def = context.getGraphSession().findLatestProcessDefinition("test"); assertNotNull("Definition should not be null", def); } public void testTransitions() throws Exception { ..... assertEquals("Instance is in 'helloWorld' state", inst.getRootToken().getNode().getName(), "helloWorld"); ..... } It time to recompile and run our junit test. Execute ant refresh.
Modify the jbpmConfig bean to reflect the new overwritten CustomJbpmConfigurationFactoryBean . <!-- jBPM Configuration --> <bean id="jbpmConfig" class="org.appfuse.jbpm.config.CustomJbpmConfigurationFactoryBean"> .... .... Create CustomJbpmConfigurationFactoryBean.java in org/appfuse/jbpm/config and copy code from CustomJbpmConfigurationFactoryBean.java into it. Attachments:
|