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
DROOLS-3974 : Guided Decision Table is not getting updated #2624
Conversation
1f85fda
to
edb8648
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems a reasonable workaround.
It looks like the workaround is yet to be approved by the Customer. Is this to be merged regardless? Also, you may want to update the documentation to include this advanced case? |
@Rikkola I'd like to understand better how this works! I can confirm it does work; but looking through the source IDK how! |
@manstis the documentation actually describes this case, but this did not work. I'll comment in code what happens. |
Actually my mistake this exact situation is not in the docs, but we do state:
The example then shows:
|
final String field = key.substring(key.indexOf("#") + 1); | ||
key = key + "[" + field + "]"; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now this fix abuses the mechanism by depending on the same field the enum is for. The field has to exist, but we do not use it.
In the client side there is a check for if there are dependent enums. If there are get the enums from the backend. This is why it updates on each call.
The other option is to also change the client side, possibly in several locations since the behaviour is used on the guided editor. Since the test coverage is weak there this approach felt safer.
Thanks @jomarko I have had this issue with few PRs and when I tried to import the correct assert method Idea did not find the method. So I suspect I need to click something somewhere in my Idea settings, or just update it. |
Can not approve for now, see https://drive.google.com/file/d/1engqgCZfwayBA21TweWCHIm2Lu_i0sgu/view?usp=sharing |
Taking a look.
…On Fri, May 10, 2019 at 3:17 PM Jozef Marko ***@***.***> wrote:
Can not approve for now, see
https://drive.google.com/file/d/1engqgCZfwayBA21TweWCHIm2Lu_i0sgu/view?usp=sharing
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2624 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AACQ2VD3676PFDXHM2ECBBTPUVRWLANCNFSM4HK5GYIQ>
.
|
Need to double check. I did my checks with Guided Rule Editors, perhaps DTables has some issues. |
@jomarko Ok. So tried with the provided test project and it was missing ' quotes, this marks the enum for dynamic load. |
@@ -149,6 +151,16 @@ public void testInvalidDependentEnum_AdvancedEnum2() { | |||
assertFalse(loader.hasErrors()); | |||
} | |||
|
|||
@Test | |||
public void testInvalidDependentEnum_AdvancedEnumForDynamic() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope this is valid, so propose: testValidDependentEnum_AdvancedEnumForDynamic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, it actually is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
1f491ca
to
01b1638
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rikkola one point to discuss.
The fix seems working for basic dynamic enums, like:
'Message.dropdown' : 'new com.myspace.testproject.Message().getList()'
however for dynamic dependent enums, like:
'Message.dropdown[control]' : 'new com.myspace.testproject.Message().getList(@{control})'
user need to reopen the guided rule to get proper values, is that ok?
@jomarko It should use the same reload mechanism with both, is the |
@Rikkola I use slightly updated project, see https://issues.jboss.org/browse/DROOLS-3974 |
I think my question is answered here https://issues.jboss.org/browse/DROOLS-2867, approving |
@jomarko sounds like that is it. @kiegroup/gatekeepers Please merge this. |
https://issues.jboss.org/browse/DROOLS-3974
Without this the dropdown just shows the code that should fetch the enumeration, while the documentation states that the use of ' quotes should let you use the code in the way this PR enables.
The fix changes
'Fact.field' : '(new org.company.DataHelper()).getList()'
to
'Fact.field[field]' : '(new org.company.DataHelper()).getList()'
This is the most simple way of getting this to work. I don't really want to touch the areas on the client side code since the unit test coverage is weak.
@jomarko @manstis I think you two are again the best to review. Thank you. Or of course happy to ping anyone else who might be able to review this.