You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Goal: Enable drag-and-drop on unselected abstract wrapper fields, providing the same conditional mapping UX as choice wrappers.
Currently, unselected abstract wrappers are not draggable. Choice wrappers already support dragging to auto-generate choose/when/otherwise conditional mappings. Abstract wrappers should behave the same way, since both use the same WrapperSpec / doGenerateNodeDataFromWrapperField() infrastructure and serve the same purpose — selecting one of several candidates.
MappingValidationService.isDraggable() returns false for unselected abstract wrappers (AbstractFieldNodeData with !node.abstractField). Remove this block so they are draggable, matching choice wrapper behavior.
2. Add validation for unselected abstract source
Add validation in validateMappingPair() for unselected abstract source, parallel to the existing choice source validation. Unselected abstract wrapper must be dropped onto a target field to create a conditional mapping — other drop targets should show an error message.
3. Add conditional mapping generation
Add abstract wrapper handling in engageMapping(). Generalize createChooseFromChoice() to handle both wrapperKind values, or create a parallel method. Dragging an unselected abstract wrapper onto a target field auto-generates choose/when/otherwise with one when branch per substitution candidate.
DnD scenarios
Source side: dragging an abstract wrapper
#
Source
Target
Expected Behavior
Notes
S0
Abstract wrapper (non-collection)
Any field
choose/when/otherwise
Same as non-collection choice
S1
Abstract wrapper (collection)
Non-collection field
choose/when/otherwise only
"Only source is collection → regular mapping" rule
S2
Abstract wrapper (collection)
Collection field
for-each wrapping choose/when/otherwise
Both collections → auto for-each + conditional
Target side
Dropping onto an abstract wrapper always errors out ("Cannot map to an unselected abstract element") — existing validation, no change needed.
Decision flow
Source abstract wrapper → Target field
│
├─ Is source a collection AND target a collection?
│ NO → choose/when/otherwise only (S0/S1)
│ YES ↓
│
├─ canUseCopyOf(abstractField, targetField)
│ → always false (wrapper never FQN-matches a real field)
│
└─ Create ForEachItem, then choose/when/otherwise inside it (S2)
Member-level collection inheritance (parallel to #3167)
Members inside a collection abstract wrapper inherit the repeating nature from the wrapper, the same as collection choice members.
Note: The isCollectionField() enhancement from #3167 should naturally cover both wrapperKind: 'choice' and wrapperKind: 'abstract' since both use the same wrapper pattern. Coordinate implementation to handle both in one change.
Please describe the task that needs to be done
Goal: Enable drag-and-drop on unselected abstract wrapper fields, providing the same conditional mapping UX as choice wrappers.
Currently, unselected abstract wrappers are not draggable. Choice wrappers already support dragging to auto-generate
choose/when/otherwiseconditional mappings. Abstract wrappers should behave the same way, since both use the sameWrapperSpec/doGenerateNodeDataFromWrapperField()infrastructure and serve the same purpose — selecting one of several candidates.Related:
wrapperKind: 'choice')wrapperKind: 'choice')Changes
1. Make unselected abstract wrappers draggable
MappingValidationService.isDraggable()returnsfalsefor unselected abstract wrappers (AbstractFieldNodeDatawith!node.abstractField). Remove this block so they are draggable, matching choice wrapper behavior.2. Add validation for unselected abstract source
Add validation in
validateMappingPair()for unselected abstract source, parallel to the existing choice source validation. Unselected abstract wrapper must be dropped onto a target field to create a conditional mapping — other drop targets should show an error message.3. Add conditional mapping generation
Add abstract wrapper handling in
engageMapping(). GeneralizecreateChooseFromChoice()to handle bothwrapperKindvalues, or create a parallel method. Dragging an unselected abstract wrapper onto a target field auto-generateschoose/when/otherwisewith onewhenbranch per substitution candidate.DnD scenarios
Source side: dragging an abstract wrapper
choose/when/otherwisechoose/when/otherwiseonlyfor-eachwrappingchoose/when/otherwisefor-each+ conditionalTarget side
Dropping onto an abstract wrapper always errors out ("Cannot map to an unselected abstract element") — existing validation, no change needed.
Decision flow
Member-level collection inheritance (parallel to #3167)
Members inside a collection abstract wrapper inherit the repeating nature from the wrapper, the same as collection choice members.
This affects:
DocumentService.isCollectionField()needs the same enhancement as xs:choice: Members of collection choice inherit collection #3167 (check parent wrapper's maxOccurs)Note: The
isCollectionField()enhancement from #3167 should naturally cover bothwrapperKind: 'choice'andwrapperKind: 'abstract'since both use the same wrapper pattern. Coordinate implementation to handle both in one change.Verification
choose/when/otherwisechoose/when/otherwisefor-eachwrappingchoose/when/otherwiseImplementation note
Since abstract and choice use the same
WrapperSpec/doGenerateNodeDataFromWrapperField()infrastructure, several changes can be shared:createChooseFromChoice()→ generalized tocreateChooseFromWrapper()for both wrapper kindsengageMapping(): one code path for bothChoiceFieldNodeDataandAbstractFieldNodeDataisCollectionField()enhancement: one check for bothwrapperKindvalues