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 |
Part I: Integrating jBPM into AppFuse - Integrate jBPM Support (via Spring-Modules) into AppFuse. About this tutorialThis 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.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 creating process definitions lets create a package where we will save our process defintions.Create the following package:
ii) Give the process a name - test.
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. 2) Choose transition from the left panel and click thru all the states to establish flow.
Congratulations you have written your 1st process defintion! [#3] Write test case to validate Process Definition executionThere is a test case in the previous article. 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"); ..... } Recompile and run JUnit test. Execute ant refresh.
[#4] Apply patch to prevent process definition redployment across server restart
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. Attachments:
|