[MGNLFORM-221] Migrator has to access the ControlMigratorRegistry during task execution Created: 07/Jan/14  Updated: 03/Feb/14  Resolved: 03/Feb/14

Status: Closed
Project: Magnolia Form Module
Component/s: field
Affects Version/s: 2.2.1
Fix Version/s: 2.2.2

Type: Bug Priority: Neutral
Reporter: Eric Hechinger Assignee: Eric Hechinger
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
dependency
is depended upon by MGNLUI-2547 Initialize controlMigrationMap on exe... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

The RadioSwitchControlMigrator uses the ControlMigratorRegistery in order to migrate sub fields. Unfortunately the controlMigrationMap is initialized based on the ControlMigratorRegistery during RadioSwitchControlMigrator class construction and has a restricted migrator visibility.
Let say that we have the following module dependency:
Module UI
Module Form
Module Data
Module Custom --> defines a RadioSwitchControl in relation with a Custom control.

Module form initializes controlMigrationMap with the migrator defined in UI and Form module. The migration of the RadioSwitchControl in the Custom module will fail because the Custom control was not register at the time RadioSwitchControlMigrator was constructed.

RadioSwitchControlMigrator has to access ControlMigratorRegistery once the Migrator.migrate() method is called and not during construction.



 Comments   
Comment by Daniel Lipp [ 24/Jan/14 ]

Don't think this description is understandable to non-insiders (I don't get it). Also you should add a test to proof this change fixes the issue.

Comment by Milan Divilek [ 31/Jan/14 ]

Reopen:

If I correctly understand the description of the issue then it's not an issue. There is no difference if you get controlMigrationMap in constructor or in info.magnolia.module.form.setup.migration.RadioSwitchControlMigrator#migrate method. It's only reference to map info.magnolia.ui.dialog.setup.migration.ControlMigratorsRegistry#allMigrators and because ControlMigratorsRegistry is @Singleton there will be only one instance of this class. Added test confirms it. Test will pass also with old code (when code this.controlMigrationMap = Components.getComponent(ControlMigratorsRegistry.class).getAllMigrators(); is in constructor).

Comment by Eric Hechinger [ 03/Feb/14 ]

Agreed

Generated at Mon Feb 12 05:38:04 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.