Bug 1013682

Summary: GRE doesn't recognize formulas, calls on globals, etc. when reopening rule
Product: [Retired] JBoss BRMS Platform 6 Reporter: Jiri Locker <jlocker>
Component: Business CentralAssignee: Mario Fusco <mfusco>
Status: CLOSED CURRENTRELEASE QA Contact: Jiri Locker <jlocker>
Severity: high Docs Contact:
Priority: high    
Version: 6.0.0CC: etirelli, jhrcek, lpetrovi, rzhang, trikkola
Target Milestone: CR1   
Target Release: 6.0.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-06 20:19:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
formula
none
global list before reopen
none
global list after reopen
none
rule from bigapp that cannot be opened in the guided rule editor none

Description Jiri Locker 2013-09-30 15:23:58 UTC
Created attachment 805258 [details]
formula

Description of problem:
GRE manifests write-only behaviour for certain rule features. It has specific UI controls for calls on global variables, formulas, freeform DRL etc., however after saving and reopening the rule, the controls look different and prevent editing affected parts of the rule.

Version-Release number of selected component (if applicable):
ER3

How reproducible:
-

Steps to Reproduce:
1. add java.util.ArrayList to project imports
2. define global variable of type java.util.ArrayList
3. open any Guided Rule, import ArrayList
4. add to RHS:
   - "Call method on <globa_list>", call clear()
   - "Append <bound variable> to list: <global_list>"
   - "Modify <bound variable>", set a string field value to "Hello " + "World!"
5. save, close, reopen

Actual results:
Global calls broken, cannot change the original values. Formula input field changed to literal value input.

Expected results:
After reopening the rule, guided editor should provide exactly the same controls that the user added before closing the editor.

Additional info:
See attached screenshots for illustration.

Comment 1 Jiri Locker 2013-09-30 15:24:37 UTC
Created attachment 805259 [details]
global list before reopen

Comment 2 Jiri Locker 2013-09-30 15:25:19 UTC
Created attachment 805261 [details]
global list after reopen

Comment 3 Jan Hrcek 2013-10-04 07:43:59 UTC
Created attachment 807478 [details]
rule from bigapp that cannot be opened in the guided rule editor

Comment 4 Jan Hrcek 2013-10-04 07:46:36 UTC
We encountered several more examples of rules, that can be written in guided rule editor, but when saved and closed, the saved rule can no longer be opened in the editor - the UI shows 'loading' animation indefinitely.

The attached rules are currently part of BigApp demo application and can be created by assembling LHS in the editor and then pasting the RHS as freeform DRL.

See the rule atatched in comment 3.

Comment 5 Lukáš Petrovický 2013-10-04 08:00:36 UTC
Changing severity to match the new scope.

Comment 6 manstis 2013-10-04 10:40:28 UTC
Toni... more tests :(

Comment 10 Toni Rikkola 2013-10-11 08:29:54 UTC
Ok, unit tests for this done. Passing this to Mario.

Comment 11 Mario Fusco 2013-10-14 14:46:01 UTC
I fixed those unit tests, but apparently there is still something that needs to be tuned on the client side. Reassigning this back to Toni.

Comment 12 Toni Rikkola 2013-10-15 09:13:38 UTC
Client side was ok. Refactored one old test with corrupted data. Back to Mario for further fixing.

Comment 13 Mario Fusco 2013-10-16 12:48:24 UTC
Fixed by https://github.com/droolsjbpm/drools/commit/3a0db6253

Comment 14 Jan Hrcek 2013-12-16 10:36:50 UTC
The problem still persists  with the rule in comment 3 (steps to reproduce are described in comment 4). When the rule is clicked in the project explorer, the  GRE is not loaded - the editor panel remains empty. See screenshot.


2 things deserve attention:

1) The rule attached is one of the rules used in jboss-bpm-example (Big App) so its important to fix this

2) There should be some feedback given to the user when the rule cannot be loaded into GRE completely (as for example happens in other rules, which are present in the Big App - for more details see Bug 1043395)

Comment 15 Toni Rikkola 2014-01-02 13:42:06 UTC
One more test https://github.com/droolsjbpm/drools/commit/b106e59ca

Comment 17 Jiri Locker 2014-01-29 16:28:38 UTC
Mostly fixed. 

Formula is reloaded as literal value only if it starts with String literal (like "Hello, " + "world!"). Calls on globals are reloaded correctly.