Integrate Activiti (BPMN engine) with Rampiva Automate

The material in this document is for informational purposes only. The products it describes are subject to change without prior notice, due to the manufacturer’s continuous development program. Rampiva makes no representations or warranties with respect to this document or with respect to the products described herein. Rampiva shall not be liable for any damages, losses, costs or expenses, direct, indirect or incidental, consequential or special, arising out of, or related to the use of this material or the products described herein.

Introduction

This article describes how to create a BPMN process that will use the Rampiva API to log into Rampiva Automate using a username and password, submit a job, and monitor the progress of the job until it ends.

Alternatively, a BPMN process can be set up where the user does not need to log in, by leveraging Rampiva API Keys - this scenario is not detailed in this article.

When creating a BPMN process that performs other tasks, it can be useful to first manually perform the tasks in the Rampiva Automate web interface and to monitor the endpoints called and the responses received in the browser network tab. Additionally, the Rampiva API documentation is available at http://localhost/openapi, where localhost is the server where Automate is installed.

Prerequisites 


Instructions

A. Create the Activiti Login Form

1

In Activiti, open the Forms tab.

 

2

Select Create Form.

3

Name the model Login Form and set the model key login-form.

This form will be used to prompt the user for the credentials as well as the URL to access Rampiva Automate.

4

Add 4 text fields to the form.

 

5

Edit the 1st field:

  • Label: Username

  • Required: checked

6

Edit the 2nd field:

  • Label: Password

  • Required: checked

7

Edit the 3rd field:

  • Label: Scope

  • Id: scope

  • Required: checked

8

Edit the 4th field:

  • Label: Service Location

  • Override id: checked

  • Id: serviceLocation

  • Required: checked

Ensure that the Id has the specified casing.

9

Save the form by clicking on the top-left save icon.

B. Create the Activiti Job Settings Form

1

In Activiti, open the Forms tab.

2

Select Create Form.

3

Name the model Job Settings Form and set the model key job-settings-form.

4

Add 8 text fields to the form.

 

5

Edit the 1st field:

  • Label: Job Name

  • Override id: checked

  • Id: jobName

  • Required: checked

6

Edit the 2nd field:

  • Label: Resource Pool

  • Override id: checked

  • Id: resourcePoolName

  • Required: checked

7

Edit the 3rd field:

  • Label: Execution Profile

  • Override id: checked

  • Id: executionProfileName

  • Required: checked

8

Edit the 4th field:

  • Label: Client

  • Override id: checked

  • Id: clientName

  • Required: checked

9

Edit the 5th field:

  • Label: Matter

  • Override id: checked

  • Id: matterName

  • Required: checked

10

Edit the 6th field:

  • Label: Nuix Case Location

  • Override id: checked

  • Id: paramNuixCaseLocation

  • Required: checked

11

Edit the 7th field:

  • Label: Data Location

  • Override id: checked

  • Id: paramDataLocation

  • Required: checked

12

Edit the 8th field:

  • Label: DocID Prefix

  • Override id: checked

  • Id: paramDocId

  • Required: checked

13

Save the form by clicking on the top-left save icon.

C. Create the Activiti Process

1

In Activiti, open the Processes tab.

 

2

Select Create Process.

3

Name the model Submit Rampiva Job and set the model key submit-rampiva-job.

4

From the Activities section, add the Script task.

 

5

Set the task name Set Login Defaults.

6

Connect the process start event with the newly created Script task.

7

Set the script format javascript.

8

Set the Script to:

var logger = org.slf4j.LoggerFactory.getLogger("org.activiti.script"); logger.info("Set Defaults Step"); execution.setVariable("serviceLocation","http://localhost/api/v1"); execution.setVariable("scope","Internal");
9

From the Activities section, add the Users task.

 

10

Set the task name Login Prompt.

11

Connect the previous Set Login Defaults task with the newly created User task.

12

Link the task to the Login Form by selecting Referenced form, picking the Login Prompt from the list of options, and clicking Save.

13

Allow the process initiator to fill out the form by selecting Assignments and checking the box Allow process initiator to complete task.

14

From the Activities section, add the Script task.

 

15

Set the task name Login to Automate.

16

Connect the previous Login Prompt task to the newly created Script task.

17

Set the script format javascript.

18

Set the Script to the contents of this file:

19

From the Gateways section, add an Exclusive gateway.

 

20

Set the gateway name Login Successful?

21

Connect the previous Login to Automate task to the newly created gateway.

22

From the End Events section, add an End error event.

23

Set the event name Error Logging In.

24

Set the event error reference error-logging-in.

25

Connect the previous gateway to the newly created end event.

26

Select the connection between the gateway and the end event and check the Default flow option.

27

From the Activities section, add the Script task.

 

28

Set the task name Set Job Defaults.

29

Connect the previous gateway with the newly created Script task.

30

Set the script format javascript.

31

Set the Script to:

var logger = org.slf4j.LoggerFactory.getLogger("org.activiti.script"); logger.info("Set Job Defaults Step"); execution.setVariable("jobName","Sample Job from Activiti"); execution.setVariable("resourcePoolName","Pool A"); execution.setVariable("executionProfileName","Default Profile"); execution.setVariable("clientName","Citrus Foods"); execution.setVariable("matterName","Project Grapefruit"); execution.setVariable("libraryName","Sample Library"); execution.setVariable("workflowName","Sample eDiscovery Processing"); execution.setVariable("paramNuixCaseLocation","Case A"); execution.setVariable("paramDataLocation","Various Files"); execution.setVariable("paramDocId","ACTIVITI-");
32

Select the connection between the gateway and the script task and set the Flow condition to:

${authToken!=""}
33

From the Activities section, add the Users task.

 

34

Set the task name Job Settings Prompt.

35

Connect the previous Set Job Defaults task with the newly created User task.

36

Link the task to the Login Form by selecting Referenced form, picking the Job SettingsPrompt from the list of options, and clicking Save.

37

Allow the process initiator to fill out the form by selecting Assignments and checking the box Allow process initiator to complete task.

38

From the Activities section, add the Script task.

 

39

Set the task name Submit Job to Automate.

40

Connect the previous Job Settings Prompt task to the newly created Script task.

41

Set the script format javascript.

42

Set the Script to the contents of this file:

43

From the Gateways section, add an Exclusive gateway.

 

44

Set the gateway name Job Submitted Successfully?

45

Connect the previous Submit Job to Automate task to the newly created gateway.

46

From the End Events section, add an End error event.

47

Set the event name Error Logging In.

48

Set the event error reference error-logging-in.

49

Connect the previous gateway to the newly created end event.

50

Select the connection between the gateway and the end event and check the Default flow option.

51

From the Activities section, add the Script task.

 

52

Set the task name Check Job Progress.

53

Connect the previous gateway with the newly created Script task.

54

Set the script format javascript.

55

Set the Script to the contents of this file:

 

56

Select the connection between the previous gateway and the script task and set the Flow condition to:

 

57

From the Gateways section, add an Exclusive gateway.

 

58

Set the gateway name Job Ended?

59

Connect the previous Check Job Progress task to the newly created gateway.

60

From the Intermediate Catching Events section, add an Intermediate timer catching event.

61

Set the event name Wait 5s.

62

Set the time duration PT5S.

63

Connect the previous gateway to the newly created end event.

64

Select the connection between the gateway and the timer event and check the Default flow option.

 

65

Connect the timer event back to the Check Job Progress task.

 

66

From the End Events section, add an End event.

 

67

Connect the previous gateway to the newly created end event.

68

Select the connection between the previous gateway and the end event and set the Flow condition to:

 

69

Save the process by clicking on the top-left save icon.

 

D. Test the Process

1

In Activiti, open the Apps tab.

 

 

 

2

Select Create App.

3

Name the app Rampiva Test and set the app key rampiva-test.

4

Click Edit included models.

5

Check the Submit Rampiva Job model and Close.

6

Save the app by clicking on the top-left save icon, and checking the Publish option.

 

7

In Activiti, open the Apps tab again.

8

Open the Rampiva Test app.

9

Open the Processes tab.

10

Click Start a process.

11

Select the Submit Rampiva Job process and click Start process.

12

Select the active task Login Prompt.

 

13

Fill-out the user credentials, scope and service location used to access Automate, then click Complete.

14

Wait for the process to advance.

 

15

When the Job Settings Prompt is displayed, fil out the settings and click Complete.

 

16

Wait for the process to advance.

 

17

Open Rampiva Automate.

 

18

In Activiti, open the Processes tab.

19

Select the running Submit Rampiva Job process, and click on Show diagram.

20

Wait for the job to complete in Rampiva Automate, and then refresh the Activity window.

 

E. Troubleshooting

1

If a job is not created in Rampiva Automate, inspect the Activiti console log for errors.

 

2

If needed, compare the your process export code, with the export code of the process created in this guide.