Pass the source definition to migration callbacks#4219
Open
roumn wants to merge 1 commit into
Open
Conversation
CaseInstanceMigrationCallback and ProcessInstanceMigrationCallback previously only received the definition an instance was migrated *to*. They now also receive the definition it was migrated *from*, so listeners can compare source and target (e.g. version-aware auditing or reacting to specific upgrade paths). This is done backwards compatibly via a new default overload on each callback method that takes the source definition as an extra parameter and delegates to the existing method. Existing implementations keep working unchanged; the engines now invoke the new overloads: - CaseInstanceMigrationCallback#caseInstanceMigrated and #historicCaseInstanceMigrated gain a sourceCaseDefinition parameter. - ProcessInstanceMigrationCallback#processInstanceMigrated gains a sourceProcessDefinition parameter. The source definition is resolved from the instance's pre-migration definition id, captured before the reference is overwritten, and only resolved when at least one callback is registered (no overhead otherwise). Adds CaseInstanceMigrationCallbackTest and ProcessInstanceMigrationCallbackTest covering the source definition on runtime and historic migrations, plus that callbacks implementing only the original methods are still invoked.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
CaseInstanceMigrationCallbackandProcessInstanceMigrationCallbackpreviously only received the definition an instance was migrated to. They now also receive the definition it was migrated from, so listeners can compare source and target (e.g. version-aware auditing or reacting to specific upgrade paths).How
Backwards compatible via a new
defaultoverload on each callback method that takes the source definition as an extra parameter and delegates to the existing method. Existing implementations keep working unchanged; the engines now invoke the new overloads.CaseInstanceMigrationCallback#caseInstanceMigratedand#historicCaseInstanceMigratedgain asourceCaseDefinitionparameter.ProcessInstanceMigrationCallback#processInstanceMigratedgains asourceProcessDefinitionparameter.The source definition is resolved from the instance's pre-migration definition id, captured before the reference is overwritten, and only resolved when at least one callback is registered (no overhead otherwise).
Tests
Adds
CaseInstanceMigrationCallbackTestandProcessInstanceMigrationCallbackTestcovering the source definition on runtime and historic migrations, plus that callbacks implementing only the original methods are still invoked. Existing migration test suites (CaseInstanceMigrationTest,HistoricCaseInstanceMigrationTest,ProcessInstanceMigrationTest) remain green.