Description of problem: Some unfinished or invalid changes cause the Guided Rule to reopen with a different definition. It would be unwise to assume users will always save correct rules, therefore this should be fixed. The rule should stay the same after reopening as it was before being closed. Version-Release number of selected component (if applicable): BPMS 6.0 ER3 Steps to Reproduce: 1. Create a new Guided Rule. 2. Add "The following does not exist .." to the WHEN section. 3. Save, close, reopen. Actual results: "Any of the following are true: There is a then" in the Guided Editor, "rule "grl" dialect "mvel" when ( then( ) ) then end" in the source. Expected results: "The following does not exist (click to add patterns...):" in the Guided Editor, "rule "grl" dialect "mvel" when not then end" in the source. Additional info:
Unit tests for this. https://github.com/droolsjbpm/drools/commit/52a7b1730
Trying to unmarshall an invalid drl is more or less like trying to unmarshall a malformed xml. I could fix the provided test cases, but for sure it will be impossible to do the same for all the possible combination that an invalid drl could generate. For this reason Toni and myself agreed to save a drl, and then attempt its unmarshall when necessary, only if it compiles.
The current fix prevents the user from saving incomplete rules on "exists", "or" or "not" sections, asking the user to complete the areas marked in red (The missing fact types are red in the editor). master: https://github.com/droolsjbpm/drools-wb/commit/79283ebab 6.0.x: https://github.com/droolsjbpm/drools-wb/commit/fc38da234
(In reply to Toni Rikkola from comment #8) > The current fix prevents the user from saving incomplete rules on "exists", > "or" or "not" sections, asking the user to complete the areas marked in red > (The missing fact types are red in the editor). > > master: https://github.com/droolsjbpm/drools-wb/commit/79283ebab > > 6.0.x: https://github.com/droolsjbpm/drools-wb/commit/fc38da234 Sorry for not getting back to you earlier. The above mentioned sections work as you say. Could the same be done for "From [... | Accumulate | Collect | Entry point]" sections? If you don't finish these, the incomplete parts are also marked in red, but the rule can be saved anyway and the same thing happens that happened with "exists" before you fixed it.
It can and should be done.
The commits for https://bugzilla.redhat.com/show_bug.cgi?id=1012553 improve model validation when saving and actually cover the from/accumulate/collect and entry point.
(In reply to Toni Rikkola from comment #11) > The commits for https://bugzilla.redhat.com/show_bug.cgi?id=1012553 improve > model validation when saving and actually cover the from/accumulate/collect > and entry point. Wrong link. Should be https://bugzilla.redhat.com/show_bug.cgi?id=1052269
"From Collect ..." is still an issue. The rests is fixed in ER2.
master: https://github.com/droolsjbpm/drools-wb/commit/13c5c52c6 6.1.x: https://github.com/droolsjbpm/drools-wb/commit/14936052e
Adjusting the flags as the last commit from this ticket did not make 6.0.2.CR1 cut.
"From Collect ..." now cannot even be added to the rule without totally corrupting it. Everything below that condition simply disappears - from the editor and also from the displayed source. The fix is at least partially working as trying to save the rule results in the expected warning. (working with DR3)
Created attachment 942235 [details] DR3 - broken editor
Created attachment 942236 [details] DR3 - displayed source
(In reply to Zuzana Krejčová from comment #16) > "From Collect ..." now cannot even be added to the rule without totally > corrupting it. Everything below that condition simply disappears - from the > editor and also from the displayed source. > The fix is at least partially working as trying to save the rule results in > the expected warning. > (working with DR3) Fixes for this. Now it should prevent the save if any red is shown. master: https://github.com/droolsjbpm/drools-wb/commit/0e82448ef 6.2.x: https://github.com/droolsjbpm/drools-wb/commit/763d4f720