[
https://issues.redhat.com/browse/DROOLS-5973?page=com.atlassian.jira.plug...
]
Andrew K commented on DROOLS-5973:
----------------------------------
Hi Matteo,
Thanks for the comprehensive explanation.
Perhaps it's not a bug, but instead a feature request.
There is currently no way to specify an enumeration in DMN in such a way as that a Java
Enum can be passed in as-is and matched to the DMN enumeration values. If, for example,
my input parameter is something like the MyObject type below, I have to modify the entire
object structure to handle the MyEnum type - and that is not great.
{code:java}
class MyObject {
NestedObject nestedObject;
}
class NestedObject {
MyEnum myEnum;
}
enum MyEnum {
Daily,
Weekly,
Monthly
}{code}
For me, it would make a lot of sense for a Java Enum to behave considered as equivalent to
the string returned by .name().
If you have a method to coerce Enum values nested inside objects in a more efficient way
than using ObjectMapper to convert the entire object structure into a Map, this would
satisfy the use case - I think the ObjectMapper workaround is a little cumbersome.
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: Bug
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)