@@ -3381,104 +3381,6 @@ For each of the produced events you can select what parts of state data to be th
3381
3381
Transitions can trigger compensation via their `compensate` property. See the [Workflow Compensation](#Workflow-Compensation)
3382
3382
section for more information.
3383
3383
3384
- # ### Restricting Transitions based on state output
3385
-
3386
- In addition to specifying the `nextState` property a transition also defines a boolean expression which must
3387
- evaluate to true for the transition to happen. Having this data-based restriction capabilities can help
3388
- stop transitions within workflow execution that can have serious and harmful business impacts.
3389
-
3390
- The expression parameter is a JsonPath expression and is evaluated
3391
- against state data output. It evaluates to true if the expression returns non empty results.
3392
-
3393
- Here is an example of a restricted transition which only allows transition to the "highRiskState" if the
3394
- output of the state to transition from includes an user with the title "MANAGER".
3395
-
3396
- <table>
3397
- <tr>
3398
- <th>JSON</th>
3399
- <th>YAML</th>
3400
- </tr>
3401
- <tr>
3402
- <td valign="top">
3403
-
3404
- ` ` ` json
3405
- {
3406
- "functions": [
3407
- {
3408
- "name": "doLowRiskOperationFunction",
3409
- "operation": "file://myapi.json#lowRisk"
3410
- },
3411
- {
3412
- "name": "doHighRiskOperationFunction",
3413
- "operation": "file://myapi.json#highRisk"
3414
- }
3415
- ],
3416
- "states":[
3417
- {
3418
- "start": true,
3419
- "name":"lowRiskState",
3420
- "type":"operation",
3421
- "actionMode":"Sequential",
3422
- "actions":[
3423
- {
3424
- "functionRef": "doLowRiskOperationFunction"
3425
- }
3426
- ],
3427
- "transition": {
3428
- "nextState":"highRiskState",
3429
- "expression": "{{ $.users[?(@.title == 'MANAGER')] }}"
3430
- }
3431
- },
3432
- {
3433
- "name":"highRiskState",
3434
- "type":"operation",
3435
- "end": true,
3436
- "actionMode":"Sequential",
3437
- "actions":[
3438
- {
3439
- "functionRef": "doHighRiskOperationFunction"
3440
- }
3441
- ]
3442
- }
3443
- ]
3444
- }
3445
- ` ` `
3446
-
3447
- </td>
3448
- <td valign="top">
3449
-
3450
- ` ` ` yaml
3451
- functions:
3452
- - name: doLowRiskOperationFunction
3453
- operation: file://myapi.json#lowRisk
3454
- - name: doHighRiskOperationFunction
3455
- operation: file://myapi.json#highRisk
3456
- states:
3457
- - start: true
3458
- name: lowRiskState
3459
- type: operation
3460
- actionMode: Sequential
3461
- actions:
3462
- - functionRef: doLowRiskOperationFunction
3463
- transition:
3464
- nextState: highRiskState
3465
- expression: "{{ $.users[?(@.title == 'MANAGER')] }}"
3466
- - name: highRiskState
3467
- type: operation
3468
- end: true
3469
- actionMode: Sequential
3470
- actions:
3471
- - functionRef: doHighRiskOperationFunction
3472
- ` ` `
3473
-
3474
- </td>
3475
- </tr>
3476
- </table>
3477
-
3478
- Implementers should decide how to handle data-based transitions that return false (do not proceed).
3479
- The default should be that if this happens workflow execution should halt and a detailed message
3480
- on why the transition failed should be provided.
3481
-
3482
3384
# ### Workflow Data Input
3483
3385
3484
3386
The initial data input into a workflow instance must be a valid [JSON object](https://tools.ietf.org/html/rfc7159#section-4).
0 commit comments