[MGNLUI-4496] Infer field definition type from 'type' property Created: 04/Jul/17  Updated: 17/Apr/19  Resolved: 17/Jul/18

Status: Closed
Project: Magnolia UI
Component/s: None
Affects Version/s: None
Fix Version/s: 6.0

Type: Task Priority: Neutral
Reporter: Ilgun Ilgun Assignee: Ngoc Nguyenthanh
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: 0d
Time Spent: 2d
Original Estimate: 2d

Issue Links:
dependency
depends upon MGNLUI-3882 Reference fields by name as well as b... Closed
is depended upon by MGNLUI-4500 Detail subapp's field generation from... Closed
is depended upon by MGNLCT-21 Define a content type with light deve... Closed
Template:
Acceptance criteria:
Empty
Task DoR:
Empty
Date of First Response:
Epic Link: Content types foundation
Sprint: Saigon 149
Story Points: 5

 Description   

Currently, we define a class property in the content type model for specifying a concrete field type definition e.g.
class: info.magnolia.ui.form.field.definition.TextFieldDefinition

It will be (@see MGNLUI-3882) also possible to define a shortened version of a concrete field e.g.
fieldType: textField (depends on how its defined in FieldTypeRegistry)

All those ways above let's 2Bean mechanisms to instantiate a field definition for you and you get the type for free if it's not being set explicitly.
However, if you only set type property but leave class and in the future fieldType property empty, then 2Bean transformers does not know which class has to be instantiated.
In this issue, it's aimed to have a mechanism which eventually infers this information from 'type' property with some default mappings.



 Comments   
Comment by Antti Hietala [ 31/Aug/17 ]

Blocked due to MGNLUI-3882

Comment by Ngoc Nguyenthanh [ 09/Jul/18 ]

Using JCR Property Type for our property defined in the content type model.

Supported types - https://docs.adobe.com/docs/en/spec/jsr170/javadocs/jcr-2.0/javax/jcr/nodetype/PropertyDefinition.html (Property Definition)

  • PropertyType.STRING
  • PropertyType.DATE
  • PropertyType.BINARY
  • PropertyType.DOUBLE
  • PropertyType.DECIMAL
  • PropertyType.LONG
  • PropertyType.BOOLEAN
  • PropertyType.NAME
  • PropertyType.PATH
  • PropertyType.URI
  • PropertyType.REFERENCE
  • PropertyType.WEAKREFERENCE
  • PropertyType.UNDEFINED

 

As discussed, the mapping will be hardened. Predefined mapping of type to fieldType

  • DATE => date
  • BOOLEAN => checkbox
  • Text Field with corresponding type will be returned in case of supported types mentioned above.
  • Text field with default settings for remaining cases.

 

Comment by Oanh Thai Hoang [ 12/Jul/18 ]

For more detailed, we currently support those JCR described #isKnownJcrTypeName Others like Name, Path, URI... will be automatically stored as String type

Comment by Maxime Michel [ 16/Apr/19 ]

Can we please get a fixVersion (and close the open PR if obsolete, while at it)?

Generated at Mon Feb 12 09:17:11 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.