Building a Imixs Workflow Webapp - Part III.
In the first part of my tutorial I explained how to define a business model using the Imixs Workflow Modeler. The second part describes how to setup the JEE Application server. Now its time to complete the tutorial and build the workflow application!
As you have seen I spent much time in explaining the modeling process and the server configuration. The reason is that the development of the JEE Workflow application is really easy and did not take much time. I will use the Maven build and configuration tool. The Imixs Workflow project is maven based and all components are available as maven artifacts. This makes it mostly easy to setup a application in a short time. It is necessary that you are familiar with java and as the application will be a web application you should also be familiar with html, css and JSF. But you did not need to be a JEE expert! You can use the Imixs JEE Workflow as components of your application. And you did not need to modify these components as they fulfill all the requirements to a scalable and robust workflow management system.
Building a new Application from a Maven archetype
When using Maven it is mostly easy to setup a new Imixs workflow project as this project provides a Maven archetype. A Maven archetype is kind of template or scaffold to build an new project. General informations about using maven in conjunction with imixs workflow can be found here .
Next I will explain how you can setup a new workflow project with Eclipse and Maven
This tutorial assumes that you are working with Eclipse IDE and you have installed the Eclipse Maven2 Plugin. You can also setup a new project using the maven standard command line tool with any other IDE. The usage of the maven command line tool will be explained on the Imixs JSF Tools Project site. Additional Informations about using Imixs Workfow with Maven can be found here.
Adding the java.net Repository Index
The Imxis Workflow Project is hosted on java.net . So first you should make sure that the java.net Maven repository is listed in your Eclipse Repository View. You can check the configured Maven repositories when you open the Eclipse view "Maven Indexes"

If the java.net Maven repository is not listed there you can add a new maven repository.
Click "Add Index" to add the java.net Maven repository 'http://download.java.net/maven/2/'

It can take some time until the nexus indexer have updated the repository index.
Create a new Project
Now you can create a new Project from the Imixs archetype.
Click "File->New->Project" and select the Maven Project Wizard

Next page in the wizard click next to choose an Maven Archetype from one of the repositories:

The Nexus Catalog provides you with all Archetypes provided from the Maven repository locations. To find the Imixs JSF Sample Archetype enter "org.imixs" in the filter input filed:

select the imixs-workflow-jsf-sample-archetype and klick next.
On the following wizard page you can specify the Group and Artifact ID of your new project and also configure additional project settings. I use "com.mycompany" as a Group Id and "MyWorkflowApp" as the artifact Id.

The Imixs JSF Sample Archetype provides three property values which allows you to configure your project setup. These settings are used to configure the security realm and the database connector which I have configured in Part II. of this tutorial. It is possible to change these settings afterwards but you are much faster if you specify this right properties during the creation process.
Complete the project setup
After all settings are completed click finish to create and setup the new JSF Workflow project. Maven will create a new Multi-Module Project containing all necessary parts of a JEE Application!
Unfortunately there is a bug in the Eclipse Maven plugin that
prevents file filtering and so the project folders of the EJB, Web and
EAR Moduls stay called e.g. _rootArtifactId_-web. (See
MNGECLIPSE-1054). In the 1.0.0 relase of the Eclipse Maven Plugin this bug will be fixed. But I will show which steps are necessary to fix the wrong project paths.
After you have create your workflow application you will see the following eclipse project structure.
Looks good but when you open the parent node "MyWorkflowApp" you will see that the subfolders are not correct named.
"__rootArtifactId__" should be replaced in "MyWorkflowApp". But this is currently not done by the Maven Plugin.
So you need to replace the folders manually in "MyWorkflowApp-ear", "MyWorkflowApp-ejb" and "MyWorkflowApp-web"
After that you have to fixup the pom.xml file in the parent project. Open the pom.xml and remove the old named modules listed there with the "__rootArtifactId__" präfix:
So thats it. Now you can build your workflow application. Run the maven context command "run as -> maven install"
You will the the BUILD SUCCESSFUL message in the console output.
To test this application you can deploy your application in your glassfish server by the application. You can find the new Build in your Eclipse Workspace in "MyWorkflowApp/MyWorkflowApp-ear/target/MyWorkflowApp-ear-0.0.1-SNPSHOT.ear" and also in your local maven repository (~/.m2/)
After you have deployed your application you can synchronize your workflow model created in part I. of this tutorial.
Use the SyncType "Web Servcie (Multipass)"
Make sure that the WebService enpoint is entered correctly. (You can test the WorkflowModel webserice from the glassfish console)
Congratulations you are finished! Now you are ready to run your Imixs web workflow application!
http://localhost:8080/myexample/pages/workflow/workitem.jsf

Posted at 09:39PM Nov 05, 2009
Posted by: Ralph
Category: Business