Моделювання та внесення змін до бізнес-процесу

🌐 This document is available in both English and Ukrainian. Use the language toggle in the top right corner to switch between versions.

The mechanism for modeling and making changes to the business process is described using the example of the arbitrary update of the chemical factors directory business process.

Business process modeling is done using Camunda Modeler. To enhance the functionality of the application, you need to install the BPMN Linter plugin.

1. Prerequisites

  1. Install the Camunda Modeler application and the BPMN Linter plugin by following the instructions in link.

  2. Install a local git-client Atlassian SourceTree by following the instructions in link.

  3. Install the business-process-modeler-extensions directory of the standard extensions, which is stored in the Nexus — artifact repository by following the instructions in link.

If necessary, contact the Platform administrator to provide the archive with the latest version of the business-process-modeler-extensions extensions directory (a directory of the version.build type — for example, 0.0.1-SNAPSHOT.12).

2. Business process modeling

Business process modeling is a sequential procedure. Please follow the steps described in this section.

2.1. Creating a new BPMN diagram"

Open the Camunda Modeler application and create a new BPMN diagram by clicking on the BPMN diagram button

This will bring up a new diagram window.

bp 1

2.2. Adding Create pool/Participant element

From the left-hand toolbar, you need to drag the Create pool/Participant element to the modeling panel."

bp 2

In the right window with parameters, you need to fill in the fields with the appropriate values:

  • in the Name field, enter the value (For example:`Creating the chemical directory`);

  • In the Process id field, enter the value update-dict;

  • In the Process name field, enter the value (For example Creating the chemical directory).

As a result, the Create pool/Participant element is added and filled with the required parameters.

bp 3

2.3. Setting up the initial event

To fill in the fields in the parameter window for the initial event, click on this event:

  • In the Name field, enter the value Start of the Process;

  • In the Initiator field, enter the value initiator.

As a result, the initial event is filled with the required parameters.

bp 4

2.4. Creating and setting up the User task "Enter a record to the directory"

To add the Enter a record to the directory user task, click on the initial event, and choose Append Task from the menu that appears.

Alternatively, you can drag the task from the palette to the modeling area of the diagram and connect the initial event to the task.

After clicking the Create Task icon, a task will be added to the modeling area, which needs to be filled with the appropriate parameters.

bp 5

  • Specify the task type by clicking on the key icon (Change Type);

  • Then choose User Task.

bp 6

  • In the parameter zone on the right, click Open Catalog, choose the User Form template, and click Apply to confirm.

bp 7

  • Fill in the task parameters in the menu on the right:

    • In the Id field, enter the value Activity_update-dict-bp-add-name;

    • In the Name field, enter the value Enter a record to the directory;

    • In the Form key field, enter the value update-dict-bp-add-name;

    • In the Assignee field, enter the value ${initiator} (pre-filled upon selection of the template).

As a result, the User Task is added to the diagram and configured.

bp 8

2.5. Creating and configuring the Service Task "Search for a directory record"

Add the following service task Search for a directory record to the business process. To do this, click on the Enter Directory Record user task and choose Append Task from the menu.

Specify the task type by clicking on the Change Type icon and choose Service Task from the menu.

Fill in the task parameters in the right-hand parameters window:
  • Click the Open Catalog button, choose the customized Search for entities in data factory template, and click Apply to confirm;

bp 9

  • Then, in the name field, enter the value Search for a directory record;

  • In the Resource drop-down menu, fill the Variable Assignment Value field with the value factor-equal-factor-type-name-count;

  • In the Search Variables drop-down menu, fill the Variable Assignment Type field with the value Map;

  • Add a variable to the Search Variables drop-down menu by clicking the Add Entry button and filling in the following parameters:

    • In the Key field, enter name;

    • In the Value field, enter ${submission('Activity_update-dict-bp-add-name').formData.prop('name').value()};

bp 10

  • * In the X-Access-Token drop-down menu, in the Variable Assignment Value field, specify the variable ${completer('Activity_update-dict-bp-add-name').accessToken};

    After completion of the first user task, try to use the completer('<task_id>') function to get user data instead of initiator().

    The access token is taken from either the initiator (for example, $initiator().accessToken}), or the executor of the last user task (for example, ${completer('taskDefinitionId').accessToken}).

    The JWT token has a validity period of 300 seconds. If you specify the token of the initiator who started the business process, and the user does not complete the task for a long time, the token validity period will expire, and the business process will have to be restarted.

    More information about JUEL functions can be found on the page: JUEL functions in business processes.

  • In the Result Variable drop-down menu, in the Assign to Process Variable field, add the variable response.

bp 11

As a result, Service Task is added to the diagram and configured.

2.6. Adding an XOR Gateway

Add an XOR Gateway Is Directory Record present? by clicking on the Search for a directory record task and choosing Append Gateway from the menu.

Fill in the gateway parameters in the right-hand menu:

Fill in the Name field with the value Is Directory Record present?.

bp 12

2.7. Creating and configuring the "Forming an error" service task.

Add the following service task Forming an error by clicking on the XOR Gateway Is Directory Record present? → and choosing Append Task from the menu.

Specify the task type by clicking the key icon and choose Service Task from the menu.

Fill in the task parameters in the right-hand window:

  • Choose the template by clicking the Open Catalog button;

  • In the opened catalogue window, select the customized template Throw validation error;

  • Click Apply to confirm.

bp 13

  • Then, in the Name field, enter the value Forming an error;

  • In the Validation errors drop-down menu, fill the Variable Assignment Type field with the value List;

  • Add a variable by clicking the Add Value button and in the Value parameter enter the following JSON structure:

{"field": "name", "value": "${submission('Activity_update-dict-bp-add-name').formData.prop('name').stringValue().replaceAll("\"", "\\\\\"")}", "message": "Такий запис вже існує"}

bp 13 1

On the arrow that connects the XOR Gateway Is Directory Record present? and the service task Forming an error, fill in the parameters on the right-hand menu:

  • In the Name field, enter the value yes;

  • In the Condition Type field, enter the value Expression;

  • In the Expression field, enter the value ${!response.value.responseBody.elements().isEmpty()}.

bp 14

As a result, the Service Task is added to the diagram and configured."

2.8. Connecting service task "Forming an error" with user task "Enter a directory record"

  • On the menu panel, select the element Create Gateway and, while holding down the left mouse button, drag the Enter a directory record task to the diagram area between the initial event and the user task.

bp 15

  • Connect the service task Forming an error with the user task Enter a directory record by selecting an arrow in the menu.

bp 16

bp 16 1

2.9. Creating and configuring the user task "Sign data by Qualified Electronic Signature" (QES)

Add the following user task Sign data by QES by clicking on the XOR Gateway Is Directory Record present? and choosing Append Task from the menu.

  • Specify the task type by clicking the key icon and choose User Task from the menu.

  • Fill in the task parameters in the right-hand window:

    • Choose the template by clicking the Open Catalog button;

    • In the opened catalogue window, select the customized template Officer Sign Task and click Apply to confirm;

    • In the id field, enter the value Activity_update-dict-bp-sign-add-name;

    • In the Name field, enter the value Sign data by QES;

    • In the Form key field, enter the value update-dict-bp-sign-add-name;

    • In the Assignee field, enter the value ${initiator} (pre-filled when choosing a template).

bp 19

  • Enter value ${submission('Activity_update-dict-bp-add-name').formData} in the Form data pre-population field.

bp 19 1

On the arrow that connects the XOR Gateway Is Directory Record present? and the Sign data by QES task, fill in the parameters in the right-hand menu:

  • In the Name field, enter the value no;

  • In the Condition Type field, enter the value Expression;

  • In the Expression field, specify the variable ${response.value.responseBody.elements().isEmpty()}.

As a result, the user task is added to the diagram and configured.

2.10. Creating and configuring the script task "Sign data by QES"

Add the following script sask Prepare data for recording (transient var) by clicking on the Sign data by QES task and choosing Append Task from the menu.

Specify the task type by clicking the key icon and choose Script Task from the menu.

Fill in the task parameters with corresponding values in the right-hand window:

  • in the Name field, input value Prepare data for recording (transient var);

  • in the Script Format field, input value groovy;

  • in the Script Type field, choose Inline Script;

  • Ii the Script field, input the necessary script:

def signedFormData = submission('Activity_update-dict-bp-sign-add-name').formData

        signedFormData.prop('factorType', 'Хімічний: довільні')

        execution.removeVariable('dataPayload')
        execution.setVariableLocalTransient('dataPayload', signedFormData)

bp 20

As a result, the script task is added to the diagram and configured.

2.11. Creating and configuring the service task "Save data to Data Factory"

Add the following service task Save data to Data Factory by clicking on the Sign data with system key task and choosing Append Task from the menu.

Specify the task type by clicking the key icon and choose Service Task from the menu.

Fill in the following parameters in the right-hand window:

  • Choose the template by clicking the Open Catalog button;

  • In the opened catalogue window, select the customized template Create entity in data factory and click Apply to confirm;

bp 23

  • in the Name field, input value Save data to Data Factory;

  • in the Resource field, input value factor;

  • in the Payload field, input value ${dataPayload};

  • in the X-Access-Token field, input value ${completer('Activity_update-dict-bp-sign-add-name').accessToken};

    After the first user task is executed, please use the function completer('<task_id>') to get user data instead of initiator().

    The access token is taken from EITHER the initiator (for example, $initiator().accessToken}) OR the performer of the last user task (for example, ${completer('taskDefinitionId').accessToken}).

    The JWT token has a validity period of 300 seconds. If you specify the token of the initiator who started the business process and the user does not perform the task for a long time, the token will expire, and the business process will need to be re-started.

    More information about JUEL functions can be found on the page JUEL functions in business processes.

  • in the X-Digital-Signature source field, input value ${sign_submission('Activity_update-dict-bp-sign-add-name').signatureDocumentId};

  • in the X-Digital-Signature-Derived source field, input value ${system_signature_ceph_key};

  • in the Result variable field, input value response.

bp 24

As a result, the service task is added to the diagram and configured.

2.12. Creating and configuring the service task "Directory record creation completed"

Add the following service task The result of the task execution "Directory record creation completed" by clicking on the Save data to Data Factory task and choosing Append Task from the menu.

Specify the task type by clicking the key icon and choose Service Task from the menu.

Fill in the task parameters in the right-hand window:

  • choose the template by clicking the Open Catalog button;

  • in the opened catalogue window, select the customized template Define business process status and click Apply to confirm;

bp 25

  • in the Name field, input value The result of the task execution "Directory record creation completed";

  • in the Status field, input value Directory record created.

bp 26

As a result, the service task is added to the diagram and configured.

2.13. Adding an EndEvent for the completion of the business process

Add an event that completes the business process, by clicking on the The result of the task execution "Directory record creation completed" task and choosing Append EndEvent from the menu.

Fill in the following task parameters in the right-hand window:

  • in the Name field, input value Directory record created.

As a result, the event that completes the business process has been added to the diagram and configured.

bp 27