Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DMN Elements with null IDs are not correctly managed #1356

Closed
yesamer opened this issue Jun 25, 2024 · 4 comments · Fixed by apache/incubator-kie-drools#6033
Closed

DMN Elements with null IDs are not correctly managed #1356

yesamer opened this issue Jun 25, 2024 · 4 comments · Fixed by apache/incubator-kie-drools#6033
Labels
area:dmn Related to DMN area:engine Related to the runtime engines type:bug Something is behaving unexpectedly

Comments

@yesamer
Copy link

yesamer commented Jun 25, 2024

DMN spec states that the ID attribute of any DMNElements is Optional

Screenshot 2024-06-25 at 10 16 29

This is currently not correctly managed in our code base.

The DMNElements are managed in the DMNModelImpl in Maps

Screenshot 2024-06-25 at 10 19 53

Those maps are managed with ID as key.
In case of multiple DMNElements of the same kind (eg. Decision Nodes) with no ID, all those nodes will be added in that Map with null key, resulting in a collision.

We should manage this case using a new key (namespace + name), but I guess we should keep the search by ID in place, to preserve the API backword-compatibility

@yesamer yesamer added area:dmn Related to DMN type:bug Something is behaving unexpectedly area:engine Related to the runtime engines labels Jun 25, 2024
@tiagobento
Copy link

We had the same problem in the new DMN Editor, and our solution was to have a normalizarion process that will make sure there are IDs for each element that can have one.

@yesamer
Copy link
Author

yesamer commented Jun 27, 2024

@tiagobento Thank you for sharing your experience, my concern is that the backend currently has a getDecisionByID() public method, so changing the ID could break the backword compatibility

@tiagobento
Copy link

@yesamer Adding the ID doesn't have to be done to the same model that is exposed back to users. The normalization process can be implemented only for indexing and internal manipulation. This wouldn't break the behavior of getDecisionByID() and would allow you to avoid collisions for un-ID'd elements.

@yesamer
Copy link
Author

yesamer commented Jun 27, 2024

Yep, that was my same idea :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:dmn Related to DMN area:engine Related to the runtime engines type:bug Something is behaving unexpectedly
Projects
Status: 🎯 Done
Development

Successfully merging a pull request may close this issue.

2 participants