5. Installation of Workflow services

The workflow services allows a user to define through the workflow portlet any number of simple to complex business processes/workflows, deploy them, and manage them through a portal interface. The power of this portlet is that it allows users to create forms-based data entry applications that have knowledge of users, groups, and roles without writing a single line of code – it only requires creation of a single XML document. The portlet relies on Apache ServiceMix to function as an Enterprise Service Bus that acts as a broker between the portal and a workflow engine. Essentially, the portal provides a generic interface through which workflow services are requested via normal HTTP calls. The requests are routed through ServiceMix which in turn calls a workflow engine implementation that the user has defined in the ServiceMix configuration. By default, Liferay provides an implementation of JBoss’ jBPM workflow engine (version 3.1.2).

The next section provides detailed installation instructions for setting up the environment for using the Workflow portlet. The instructions are for Tomcat, but can be easily adapted for any application server. After installing, refer to the user guides for more information on how to use the workflow portlet to create custom business processes.

5.1. Installation

Because the default implementation of the workflow portlet depends on both ServiceMix and jBPM, the installation requires more than just the normal portal bundle. The following provides detailed instructions for deploying the workflow portlet and testing it with a simple process.

  1. It is assumed that Liferay Portal has already been installed following one of the procedures explained earlier. If it's currently running stop it.

  2. Download the latest version of liferay-portal-servicemix-4.2.x.war and liferay-portal-jbpm-4.2.x.war (substituting the 'x' with the highest number available) from Liferay's download page. Rename them to “servicemix-web.war” and “jbpm-web.war” respectively.

  3. Move the wars from step 2 to the $TOMCAT_HOME/webapps directory.

  4. Delete the C:\home\liferay directory if it exists.

  5. Go to the $TOMCAT_HOME/bin directory and run startup.bat.

5.2. Testing the installation

To test the installation we are going to use the Workflow portlet to create a simple definition and add and instance of it:

  1. Login to the portal. The default user is [email protected] with password test.

  2. Add "Workflow" portlet to a page.

  3. Click on the Definitions tab.

  4. Click on the Add button.

  5. Copy and paste the contents of jbpm-web.war/WEB-INF/definitions/datatypes_definition.xml into the text area and click the Save New Version button.

  6. Click on the Add Instance icon.

  7. From the Instances tab, click on the Manage icon next to Enter data.

  8. Fill out the form and click the Save button; alternatively, you can test the various error checking capabilities by inputting incorrect values and clicking the Save button.

  9. Eventually, enter correct values and click the Save button.

  10. From the Instances tab, click on the Manage icon next to View Data.

  11. Confirm that all the data was entered correctly and click the Finished button.

  12. Confirm that the instance is now in the End state.

5.3. Configuration of the jBPM database

The default implementation of jBPM uses an HSQL database found in jbpm-web.war/WEB-INF/sql/jbpm.*. To change the location of the HSQL database, change the value of the hibernate.connection.url property in jbpm-web.war/WEB-INF/classes/hibernate.cfg.xml. The location is addressed to where the start up script for your server is located.

To use a database other than HSQL, first create the database schema using one of the SQL create scripts supplied in the jbpm-web.war/WEB-INF/sql directory. Then uncomment the corresponding hibernate connection properties block in jbpm-web.war/WEB-INF/classes/hibernate.cfg.xml.