[MAGNOLIA-3968] Improve saveHandler for multiSelect controls to handle single-valued properties Created: 10/Feb/12  Updated: 10/Mar/21  Resolved: 10/Mar/21

Status: Closed
Project: Magnolia
Component/s: admininterface, core, gui
Affects Version/s: 4.4.2, 4.4.3, 4.4.4, 4.4.5, 4.4.6
Fix Version/s: None

Type: Improvement Priority: Neutral
Reporter: Richard Unger Assignee: Unassigned
Resolution: Outdated Votes: 2
Labels: controls, dialogs, multiselect
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
causality
caused by MAGNOLIA-3035 Multivalue properties with one value... Closed
relation
is related to MAGNOLIA-2773 Return simple property value if multi... 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)
Date of First Response:

 Description   

We are faced with the following problems, which are really 2 instances of the same problem:

1. We changed a control in one of our dialogs to use multiselect rather than single-select (originally the customer wanted one category, then changed their mind and wanted multiple categories to be assignable to the content)

2. We observed that data imported from XML had problems with the multiselect for categories

The problem is that the multiselect control does not work if the node already contains a single-valued property of the same name.
In case 1. the single-valued properties were created by the editors using the old dialog definition.
In case 2. the single-valued properties were created by the XML-Import-Bug (see MAGNOLIA-3035)

In both cases the behaviour is the same: when an editor wants to edit the content using the dialog, the existing (single-valued) property is not displayed in the multiselect control. If the user sets new values in the multiselect control, the dialog cannot be saved as there is an exception in the saveHandler when it finds the existing single-valued property.

The solution has 2 parts:

A) when loading the value in multiselect control, if a single-valued property is present, load it anyway and assume it is a solo element of a multi-valued property. It seems to me this should be handled by MAGNOLIA-2773, but is is not working in 4.4.2 EE.

B) when storing the value, if a single-valued property is present, delete the property before storing, so that a new multi-valued property is created.



 Comments   
Comment by Jan Haderka [ 11/Feb/12 ]

Hi Richard,

unfortunately as mentioned in MAGNOLIA-2773 this issue is a problem in JR itself - see https://issues.apache.org/jira/browse/JCR-1464 for more details. There's no way to fix it on import/export. The solution chosen for MAGNOLIA-2773 was to handle the problem directly at the NodeData level. But it seems like there are some leftovers that handle values directly and therefore run into the same issue again.

Jan

Comment by Richard Unger [ 13/Feb/12 ]

Hi Jan,

I understand the Bug is Jackrabbit's... my proposal is more for a kind of work-around. By solving the problem in the way I describe, "bad" values would automatically fix themselves when they're saved.

Do I understand your comment correctly?: that MAGNOLIA-2773 fixed the problem at the level of the NodeData wrapper, but the categorization multiSelect control does not benefit from the fix because it is bypassing NodeData Wrapper to work with the values directly?

Thanks,

Richard

Comment by Jan Haderka [ 14/Feb/12 ]

Yes, that's exactly the problem. In very old versions of Magnolia NodeData vas not very good at dealing with multiple values and lots of old code manipulated Value objects directly. Some of that code is still around it seems.

Generated at Mon Feb 12 03:51:25 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.