[
https://issues.redhat.com/browse/DROOLS-5973?page=com.atlassian.jira.plug...
]
Matteo Mortari edited comment on DROOLS-5973 at 2/16/21 4:20 AM:
-----------------------------------------------------------------
[~andrew__k], thank you for providing some more information. I am happy to reopen this
jira to investigate it as "feature request".
One thing however, I doubt it will be equivalently of calling internally .name(), since
that would never cover the case where the DMN string restriction contains an invalid token
character for Java (say a space, etc.) as in
{code:java}
public enum Frequency { Daily, Every_other_day }
{code}
and in that case it would never be possible to remap it on a DMN string restricted say as
in:
{code}
"daily", "every other day"
{code}
but maybe there are some cases where I can reasonably internally default in the engine to
calling toString() as a default.
Because in that case the Java Enum can be redefined as:
{code:java}
public enum Frequency { Daily("daily"), Every_other_day("every other
day"); ... }
{code}
etc.
I will focus the analysis of this feature request in this way.
Naturally, it will never be possible to cover automatically to remap a Java's Enum to
a DMN's ItemDefinition which is not a string. e.g.: the previous example of
restricting the domain of a number can't be covered equivalently.
If you have more details about your use case which you believe connected to this feature,
don't hesitate to share.
was (Author: tari_manga):
[~andrew__k], thank you for providing some more information. I am happy to reopen this
jira to investigate it as "feature request".
One thing however, I doubt it will be equivalently of calling internally .name(), since
that would never cover the case where the DMN string restriction contains an invalid token
character for Java (say a space, etc.) as in
{code:java}
public enum Frequency { Daily, Every_other_day }
{code}
and in that case it would never be possible to remap it on a DMN string restricted say as
in:
{code}
"daily", "every other day"
{code}
but maybe there are some cases where I can reasonably internally default in the engine to
calling toString() as a default.
I will focus the analysis of this feature request in this way.
Naturally, it will never be possible to cover automatically to remap a Java's Enum to
a DMN's ItemDefinition which is not a string. e.g.: the previous example of
restricting the domain of a number can't be covered equivalently.
If you have more details about your use case which you believe connected to this feature,
don't hesitate to share.
Java enum values don't match DNM enumerations when input passed
as POJO
-----------------------------------------------------------------------
Key: DROOLS-5973
URL:
https://issues.redhat.com/browse/DROOLS-5973
Project: Drools
Issue Type: Feature Request
Components: dmn engine
Affects Versions: 7.48.0.Final
Reporter: Andrew K
Assignee: Matteo Mortari
Priority: Minor
Attachments: screenshot-1.png, screenshot-2.png, screenshot-3.png,
screenshot-4.png
When passing an input object into the DMN engine as a POJO, enumerations represented in
the POJO as Java enums do not correctly match DMN string enumerations.
This can be worked around by converting the input to a Map using Jackson:
{code:java}
new ObjectMapper().convertValue(pojo, Map.class){code}
but this should not be necessary.
--
This message was sent by Atlassian Jira
(v8.13.1#813001)