MohammadMu99 opened a new issue, #7329:
URL: https://github.com/apache/incubator-kie/issues/7329
### Description
Follow-up to #7273 (variable migration rules, merged in #7259).
When a new process version changes the type of a variable (for example
`loanAmount` from `String` to `BigDecimal`), migrated process instances keep
the value with its old type. The new version then fails, or behaves wrongly,
when it reads the variable, and today a migration plan has no way to fix that.
This adds a `convert` action to `variableMigrationPlan`:
```json
{
"processMigrationPlan": {
"sourceProcessDefinition": { "processId": "loan", "processVersion":
"1.0" },
"targetProcessDefinition": { "processId": "loan", "processVersion":
"2.0" },
"variableMigrationPlan": [
{ "action": "convert", "name": "loanAmount", "toType": "bigdecimal" }
]
}
}
```
**Supported `toType` values:** `string`, `integer`, `long`, `double`,
`bigdecimal`, `boolean`
**Behaviour**
- If the variable is empty (`null`), the rule does nothing.
- If the value already has the target type, the rule does nothing.
- If the value cannot be converted without losing information, the migration
fails with a clear error. Examples: `"abc"` to `integer`, `12.5` to `integer`,
a number too big for `integer`, `"yes"` to `boolean`.
- `boolean` accepts only `"true"` or `"false"` (any case).
- Like `rename` and `default`, the converted value must match the type
declared for the variable in the target process, or the migration fails.
- Variable changed events are fired, so data-index and data-audit see the
new value.
- A rule without `name` or `toType`, or with an unknown `toType`, fails when
the plan is loaded.
**Out of scope:** dates, custom classes, and conditional (`when`) rules.
Feedback on the JSON format is welcome before the later PRs.
### Implementation ideas
_No response_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]