[MAGNOLIA-6901] Generalise bean type resolution strategy in to-bean transformers Created: 19/Dec/16  Updated: 14/Feb/17  Resolved: 19/Jan/17

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: 5.5
Fix Version/s: 5.5.2

Type: New Feature Priority: Neutral
Reporter: Ilgun Ilgun Assignee: Ilgun Ilgun
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to MAGNOLIA-6928 TypeResolvers do not report any probl... Accepted
causality
is causing MAGNOLIA-6912 Handle transformer warnings for custo... Closed
dependency
is depended upon by MGNLUI-3882 Reference fields by name as well as b... Closed
Template:
Acceptance criteria:
Empty
Date of First Response:
Sprint: Basel 79
Story Points: 5

 Description   

Current implementations of N2B and M2B support only a single hardcoded strategy of specifying the concrete bean type, which is based on the class property.

The linked issue from the UI raises the requirement for other "fuzzy" strategies of guessing the exact bean type (e.g. as the linked ticket suggests - the "fieldType" property could be used instead of the "class" for the case of the FieldDefinition-related objects).

In order to allow the developers (at least the Magnolia team) to create and use custom strategies without the need to change the transformers' code, the type "elaboration" has to be generalised into an API. Such API would manage and orchestrate different resolvers and automatically delegate resolution to the appropriate ones. In this case the existing "class"-property based resolution becomes one of the implementations of such strategy.



 Comments   
Comment by Philip Mundt [ 18/Jan/17 ]

info.magnolia.jcr.node2bean.impl.Node2BeanTransformerImpl#convertPropertiesToMap doesn't respect multi-valued properties (also see info.magnolia.jcr.util.PropertyUtil#getValueObject) causing trouble when migrating:

[INFO] [talledLocalContainer] javax.jcr.ValueFormatException: property /server/security/jcr:mixinTypes is a multi-valued property, so it's values can only be retrieved as an array
[INFO] [talledLocalContainer] 	at org.apache.jackrabbit.core.PropertyImpl.internalGetValue(PropertyImpl.java:483)
[INFO] [talledLocalContainer] 	at org.apache.jackrabbit.core.PropertyImpl.getValue(PropertyImpl.java:510)
[INFO] [talledLocalContainer] 	at info.magnolia.jcr.wrapper.DelegatePropertyWrapper.getValue(DelegatePropertyWrapper.java:152)
[INFO] [talledLocalContainer] 	at info.magnolia.jcr.wrapper.DelegatePropertyWrapper.getValue(DelegatePropertyWrapper.java:152)
[INFO] [talledLocalContainer] 	at info.magnolia.jcr.wrapper.DelegatePropertyWrapper.getValue(DelegatePropertyWrapper.java:152)
[INFO] [talledLocalContainer] 	at info.magnolia.jcr.wrapper.DelegatePropertyWrapper.getValue(DelegatePropertyWrapper.java:152)
[INFO] [talledLocalContainer] 	at info.magnolia.jcr.wrapper.DelegatePropertyWrapper.getValue(DelegatePropertyWrapper.java:152)
[INFO] [talledLocalContainer] 	at info.magnolia.jcr.node2bean.impl.Node2BeanTransformerImpl.convertPropertiesToMap(Node2BeanTransformerImpl.java:219)
[INFO] [talledLocalContainer] 	at info.magnolia.jcr.node2bean.impl.Node2BeanTransformerImpl.resolveType(Node2BeanTransformerImpl.java:157)
[INFO] [talledLocalContainer] 	at info.magnolia.jcr.node2bean.impl.Node2BeanProcessorImpl.toBean(Node2BeanProcessorImpl.java:178)
[INFO] [talledLocalContainer] 	at info.magnolia.jcr.node2bean.impl.Node2BeanProcessorImpl.transformAndLogProblems(Node2BeanProcessorImpl.java:152)
[INFO] [talledLocalContainer] 	at info.magnolia.jcr.node2bean.impl.Node2BeanProcessorImpl.toBean(Node2BeanProcessorImpl.java:140)
[INFO] [talledLocalContainer] 	at 
Generated at Mon Feb 12 04:18:54 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.