Bug 1230306 - Guided Rule Editor does not dynamically load enumeration values from method calls where input comes from previous drop-down selection
Summary: Guided Rule Editor does not dynamically load enumeration values from method 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: ER5
: 6.2.0
Assignee: manstis
QA Contact: Lukáš Petrovický
Dawn Eisner
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-06-10 15:26 UTC by Musharraf Hussain
Modified: 2020-03-27 20:11 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2020-03-27 20:11:14 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
helperclass.zip (11.08 KB, application/zip)
2015-06-10 15:26 UTC, Musharraf Hussain
no flags Details
git_repository.zip (743.04 KB, application/zip)
2015-06-10 15:27 UTC, Musharraf Hussain
no flags Details

Description Musharraf Hussain 2015-06-10 15:26:07 UTC
Description of problem:
- The requirement has been to enable Enumeration users in Guided Rule editor so that the selected option from one drop down in the editor be used as a criteria to populate the list of the options for a second drop down in the same rule. Of course both the drop down's values would be populated using the feature of Enumeration.

This is how it looks like from ground reality. First enumeration which populates the values for the first drop down:
~~~
'Selector.slType' : ['ClassName', 'Department']
~~~

Once a user selects the "slType" to any value (say, "ClassName") from the populated first drop down , the second drop down's enumeration would use the chosen value from the first drop down (i.e. "ClassName") to fetch the values for the next drop down, dynamically through another enumeration (which does it through external source/method call) . Something like this:
~~~
'Selector.slTypeDetails[slType]' : (new com.test.selection.ReturnSelectionType()).returnSelection("@{slType}")
~~~

On the other hand if I hard code the values in the method parameter it works fine.
~~~
'Selector.slTypeDetails' : (new com.test.selection.ReturnSelectionType()).returnSelection("TEST")
~~~

- It appears that this syntax was possible as per the decision table use case from this Bugzilla [https://bugzilla.redhat.com/show_bug.cgi?id=1132885] , but I do not see it working for the Guided Rule Editor in BRMS 6.1.0. 

- I have attached my test project "helperclass.zip" which contains the source code for the "com.test.selection.ReturnSelectionType" class used in the Enumeration above. Also, in the attachment you can find the "git_repository.zip" file which contains the bare repository (.niogit folder) along with the artifact repository folder (repositories) for your reference.
Do note that the repository contains a project named "EnumerationSpecificProjectHardCoded" which shows the example where had coded values passed through the method parameter works fine. Just follow the same steps given below to test it in this project.

Is this a bug?

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

How reproducible:
- Always

Steps to Reproduce:
1. Download the attached "git_repository.zip" file and extract it's contents inside the BRMS 6.1.0 installation's "/bin" folder (after backing up and removing the "repositories", ".index", ".niogit" and ".security" folders). Even if you just replace the "repositories", ".niogit" folders that would be fine too.
2. Log on to Business Central. Move to "EnumerationSpecificProject" project and open the "TestEnumeration" guided rule. Add a field constraint under "There is a Selector with:" condition. From the "Modify constraints for Selector " pop-up, select "slTypeDetails" from the "Add a restriction on a field" constraint.
3. From the newly created "slTypeDetails" field's constraint select "equal to" from the drop-down and click on the pencil icon next to it to select "Field Value" from a pop-up. Click on to "Literal Value" .

Actual results:
- The drop down comes as blank.

Expected results:
- The drop down containing the values for the second field constraint should populate the result selected from the first drop down.

Additional info:
- Nothing

Comment 1 Musharraf Hussain 2015-06-10 15:26:55 UTC
Created attachment 1037346 [details]
helperclass.zip

Comment 2 Musharraf Hussain 2015-06-10 15:27:34 UTC
Created attachment 1037348 [details]
git_repository.zip

Comment 4 manstis 2015-06-22 11:24:22 UTC
My, my, this is all a bit of a muddle :(

I've debugged the given scenario (thanks for the files) and the "expression" needs to be enclosed in quotes:

'Selector.slTypeDetails[slType]' : '(new com.test.selection.ReturnSelectionType()).returnSelection("@{slType}")'

With this change both the Guided Rule Editor and Guided Decision Table Editor both handled "dynamic enumerations" fine. The (community) document isn't entirely clear on this (so I'll update this). It states 

"...but note... on the right of the ":" there are quotes around the expression. This expression will then be evaluated, only when needed, substituting the values from the fields specified..."

So, we sort of elude to the correct syntax for dynamic expressions; but it wasn't clear to me - without debugging.. so I'm not surprised Users have difficulties.

I'll update the community documentation and will let Vikram Goyal know about the product documentation.

Comment 7 Musharraf Hussain 2015-06-22 15:51:34 UTC
Woww!!! That works superb and as expected. Thank you :)

Comment 10 Martin Zilak 2015-11-09 13:08:32 UTC
I've created a documentation BZ for this, which can be found here: https://bugzilla.redhat.com/show_bug.cgi?id=1279432 , so I'm marking this as verified.

Comment 11 Petr Penicka 2015-12-07 22:46:52 UTC
Clearing needinfo here, will be resolved as part of the BZ in comment 10.


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