This documentation is for WSO2 Enterprise Integrator version 6.5.0 . View documentation for the latest release in the 6.x.x family and the latest release in the 7.x.x family.

All docs This doc

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Excerpt Include
Business Process Profile Samples
Business Process Profile Samples
nopaneltrue

The Activiti engine supports script tasking via Groovy and JavaScript. JavaScript gets executed via the Rhino Engine and Groovy gets executed by the Groovy Engine.

Note

JDK comes with default support for JavaScript. However, to execute Groovy, you need to add the JAR file for the Groovy Engine to the <EI_HOME>/wso2/lib/bps-endorsed directory and restart the Business Process profile of WSO2 EI to try this sample.

The .bar file relevant for this sample is OrderDeliveryProcess.bar found in the <EI_HOME>/samples/business-process/bpmn directory.

Flow of the sample

In this sample scenario,

  1. The customer user sends an order request with details such as order name and summary.
  2. This data is filtered from the script task.
  3. If the summary field contains ‘local’, the order request will be sent to the 'local delivery' task.
  4. Finally, the customer user will get a notified task that his order was sent to delivery.

The following code block is the groovy script task used in this sample.

Code Block
languagexml
<script>
           def searchString  = 'local'
           def replacement = 'This is a local request’
           def filteredSummary =   orderSummary.replaceAll(searchString, replacement)
           execution.setVariable('orderSummary', filteredSummary)
</script>
Info

orderSummary is the variable that contains the summary value entered by the user in the 'issue order request' task.

Running the sample

  1. Follow the steps in Deploying BPMN Samples to deploy the sample using the WSO2 BPS management console. 
  2. Login to the BPMN explorer as a customer using the customer/customer credentials.
  3. Select the PROCESSES tab to view the task in the task list.
  4. Click the Start button and fill in the form that appears with the order details.
  5. A task notification will be displayed under the MY TASKS tab, showing which delivery option was taken.