Description of problem: using brms-coolstore-demo project (https://github.com/eschabell/brms-coolstore-demo/tree/6.0.1) branch 6.0.1 Setup project, start server, AUTHORING -> PROJECT AUTHORING -> GUIDED RULE -> TOTAL SHOPPING CART Code view tab shows: | import java.lang.Number; 2. | import com.redhat.coolstore.ShoppingCart; 3. | 4. | rule "Total Shopping Cart" 5. | no-loop true 6. | ruleflow-group "total-rules" 7. | dialect "mvel" 8. | when 9. | $sc : ShoppingCart( ) 10. | then 11. | $sc.setCartTotal( 0.0 ); 12. | $sc.setCartItemPromoSavings( 0.0 ); 13. | update( $sc ); 14. | end Using editor I remove the literal field behind line 12, changing to: $sc.setCartItemPromoSavings( ($sc.cartItemPromoSavings == 0.0) ? 0.0 : $sc.cartItemPromoSavings * -1 ); Save the file, says successful, but close pop-up warns 'Sure you want to discard unsaved changes?', only choice is yes or cancel. Close rule, reopen and changes not shown. From command line clone ssh://localhost:8001/coolstore-demo and view source of same guided rule and it shows change: import java.lang.Number; import com.redhat.coolstore.ShoppingCart; rule "Total Shopping Cart" no-loop true ruleflow-group "total-rules" dialect "mvel" when $sc : ShoppingCart( ) then $sc.setCartTotal( 0.0 ); $sc.setCartItemPromoSavings( ($sc.cartItemPromoSavings == 0.0) ? 0.0 : $sc.cartItemPromoSavings * -1 ); update( $sc ); end Restart of server does not show new changes in UI editor either. No caching on in browser. Version-Release number of selected component (if applicable): 6.0.1.CR1 How reproducible: see above Steps to Reproduce: 1. see above 2. 3. Actual results: Changes not shown. Expected results: Changes should be shown in editor. Additional info:
Confirmed. It seems arbitrary Formulas are not recognized and replaced by Literal with default value. Try: when $a : Appliacnt() then $a.setAge( 1 + 1 ); Save, reopen. You'll see $a.setAge( 0 );
Yes, I can confirm the same. (In reply to Jiri Locker from comment #2) > Confirmed. It seems arbitrary Formulas are not recognized and replaced by > Literal with default value. Try: > > when $a : Appliacnt() > then $a.setAge( 1 + 1 ); > > Save, reopen. You'll see $a.setAge( 0 );
I can also confirm the persisted value is correct, however it is the DRL->RuleModel unmarshalling that cannot handle the formula... investigating a fix.
Ticket cherry-picked into 6.0.1.CR2 Commit: 37a839f5abec709587db6995d1fdec3633b719fa
The changes are now displayed correctly after saving and reopening the rule. Please note that the rule has validation errors, though, which fail the project build. But this was broken in CR1 too.
(In reply to Jiri Locker from comment #7) > Please note that the rule has validation errors, though, which fail the > project build. But this was broken in CR1 too. Sorry, false alarm. I made a mistake in the $sc.setCartItemPromoSavings formula. The described rule is valid.