Bug 1247559 - [GSS] (6.1.z) Guided Rule editor does not seem to reload "eval()" functions correctly while used inside the constraint of a fact
Summary: [GSS] (6.1.z) Guided Rule editor does not seem to reload "eval()" functions c...
Keywords:
Status: CLOSED EOL
Alias: None
Product: JBoss BRMS Platform 6
Classification: Retired
Component: Business Central
Version: 6.1.0
Hardware: All
OS: All
high
high
Target Milestone: CR1
: 6.1.0
Assignee: Toni Rikkola
QA Contact: Jiri Locker
URL:
Whiteboard:
Depends On: 1246099
Blocks: 1249859 bpms6.1.3-payload
TreeView+ depends on / blocked
 
Reported: 2015-07-28 10:18 UTC by Abhijit humbe
Modified: 2020-03-27 19:05 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 1246099
Environment:
BRMS 6.1.0 patch update 1
Last Closed: 2020-03-27 19:05:16 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Abhijit humbe 2015-07-28 10:18:30 UTC
+++ This bug was initially created as a clone of Bug #1246099 +++

Description of problem:
- The issue out here is that there is a necessity to achieve the following LHS condition in a Guided Rule.
~~~
rule "TestEval"
dialect "mvel"
  when
        $employee : Employee( name == "Test" , id < 100 , ( functionTrue() && functionFalse() ))
        
  then
        System.out.println("Rules fired with success");
  end
~~~

This kind of condition directly works in DRL, but if a user tries to create similar constraint for a fact (say "Employee") in Guided Rule editor (by using "Modify constraints for Employee" -> "New Formula" and paste the condition like "( functionTrue() && functionFalse() )") then at first the designer does not throw any validation error. It even allows users to save the Guided Rule. In the "Source" tab the rule looks like the following (wrapped around an "eval()"). The attached screenshot "ruleeditor_beforeissue.png" shows the rule after it is saved and "rulesource_beforeissue.png" confirms it's source.
~~~
1.	|	package com.sample.test.evaltestwithfunctions;
2.	|	
3.	|	import java.lang.Number;
4.	|	
5.	|	rule "dualfunctiontrouble"
6.	|	    dialect "mvel"
7.	|	    when
8.	|	        $emp : Employee( name == "Test1" , eval( ( functionTrue() && functionFalse() ) ))
9.	|	    then
10.	|	        System.out.println("Functions called with success");
11.	|	end
~~~

Now, if user closes the window of the editor and tries to reopen the rule it breaks and splits the functions into two lines. Then it also throws validation errors. Please see the issue in "aftersave_closeandreopen_editor.png" and the validation error is shown in "validation_error.png" screenshot.

Interestingly the project in Business Central can be built without any trouble even after the issue in editor exist. The attached kjar "EvalTestwithFunctions-1.0.jar" shows the artifacts after building the project. And even after building the project, the contents inside the troubled "dualfunctiontrouble.rdrl" file shows the correct rule definition.
~~~
package com.sample.test.evaltestwithfunctions;

import java.lang.Number;

rule "dualfunctiontrouble"
	dialect "mvel"
	when
		$emp : Employee( name == "Test1" , eval( (functionFalse() && functionTrue()) ))
	then
		System.out.println("Functions called with success");
end
~~~

Hence, the issue seems to be only with the editor. The attached bare git repository "bare_repo.zip" of my project is shared for reference.


Version-Release number of selected component (if applicable):
- BRMS 6.1.0 patch update 1

How reproducible:
- Always

Steps to Reproduce:
1. Follow the steps shared above
2.
3.

Actual results:
- Guided Rule editor shows the rule as broken.

Expected results:
- The rule should be represented correctly in Guided Rule editor.

Additional info:
- Nothing



--- Additional comment from Musharraf Hussain on 2015-07-23 09:05:52 EDT ---

The only workaround right now is to add the functions as "Free form DRL" in Guided Rule.

Comment 5 Jiri Locker 2015-08-31 15:23:10 UTC
Fix covered by a unit test.


Note You need to log in before you can comment on or make changes to this bug.