Here is an example that shows how to register and use custom workitems in the JBPM5 console using example described in http://community.jboss.org/people/bpmn2user/blog/2011/02/21/jbpm5-example-for-forms-with-variables.
Diduch Cordova has modified the bpmn file from the above example to include a custom notification workitem (http://community.jboss.org/people/bpmn2user/blog/2011/02/21/jbpm5-example-for-forms-with-variables#/?page=2) . A custom WorkItem for notification ('Notify Complete) is added at the end as shown below.

Following is the corresponding notification WorkItemHaldler class.

More details about creating WorkItem can be found here http://community.jboss.org/people/bpmn2user/blog/2011/03/28/jbpm5--work-itemdomain-specific-process-hello-process-example.
Make sure the corresponding taskName (i.e, Email) for the WorkItem in the bpmn file is bound to Notification class in the workhandlers configuration file (CustomWorkItemHandlers.conf)


Deployment to an appsersever (e.g., JBoss or Tomcat)
1.) Copy the configuration file (CustomWorkItemHandlers.conf) to gwt-console-server's META-INF directory
e.g. jbpm-installer/boss-5.1.0.GA/server/default/deploy/jbpm-gwt-console-server.war/WEB-INF/classes/META-INF/CustomWorkItemHandlers.conf
2.) Copy the Notification class to the gwt-console-server's CLASSPATH.
e.g., Copy the Notification jar file into gwt-console-server war file ( ..gwt-console-server\WEB-INF\lib)
or Copy the Notification jar and the dependant jar files into appserver's lib direcory (JBOSS_HOME\server\default\lib for JBOSS or TOMCAT_HOME\lib for TOMCAT)
3.) Copy the bpmn file to the directory where the other bpmn files are located (specified using the parameter -Djbpm.console.directory).

After running the example successfully (i.e, after the second approval from 'john'), following log message can be seen.

Comments