Bug 1002370 - Guided Rule Editor: Add size related operators for Collection properties
Guided Rule Editor: Add size related operators for Collection properties
Status: CLOSED CURRENTRELEASE
Product: JBoss BRMS Platform 6
Classification: JBoss
Component: Business Central (Show other bugs)
5.x.x
Unspecified Unspecified
high Severity medium
: ER3
: 6.0.2
Assigned To: manstis
Sona Mala
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-28 23:35 EDT by Toshiya Kobayashi
Modified: 2014-08-06 15:53 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-08-06 15:53:00 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
smala: needinfo-


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker GUVNOR-2048 Major Resolved Guided Rule Editor: Add size related operators for Collection properties 2016-04-04 06:48 EDT

  None (edit)
Description Toshiya Kobayashi 2013-08-28 23:35:16 EDT
Description of problem:

Platform BZ for https://issues.jboss.org/browse/GUVNOR-2048

Steps to Reproduce:
1. See GUVNOR-2048
2.
3.

Actual results:

Cannot choose size related operators for Collection properties

Expected results:

Can choose size related operators for Collection properties
Comment 4 JBoss JIRA Server 2013-11-28 09:34:58 EST
Toni Rikkola <toni@rikkola.net> updated the status of jira GUVNOR-2048 to Resolved
Comment 5 JBoss JIRA Server 2013-11-28 09:34:58 EST
Toni Rikkola <toni@rikkola.net> made a comment on jira GUVNOR-2048

With the new data model oracle this is not an issue anymore.
Comment 6 Toni Rikkola 2013-11-28 09:37:24 EST
This affected 5.5.x, but not an issue anymore since the new data model oracle does not filter out size().

So no commits. The ticket is out of date.
Comment 7 Sona Mala 2014-01-14 04:56:30 EST
I can reproduce this issue for 6.0.0 ER7.

I've created two facts:
  -> Employee (String: name)
  -> Company (Employee[0..N]: employees)

For expression editor:
  - I can create employees.size but an operator selector contains just these comparisons (egual to | not equal to | is null | is not null)
  - I expect that there should be same operators as for number (the type of return value) - for example is grater than, is less then, etc.



Additional info:
field employees is represented as "private java.util.List employees;" instead of "private java.util.List<Employee> employees;". I am not sure if this is a problem, because method size() does not depend on generic type <Employee>.
Comment 8 manstis 2014-02-20 10:12:41 EST
This is caused by the referenced BZ.

Operators are looked-up from the Fact and Field; however in the case of this BZ the field completions for "Collection" have not been loaded (for some reason -- that will be the cause of this BZ).

As an aside, there is a (clumsy) workaround:-
(1) Ensure you have Collection as a Project "Import Suggestion"
(2) Ensure you have added Collection as an import to the rule
(3) Add a Collection Fact to the rule
(4) Add whatever you need to the rule (e.g. "Person( employees.size() > 0 )
(5) Delete Collection from the rule
Comment 10 manstis 2014-02-20 10:55:35 EST
OK, fixed.

Please note in order to see the details of any sub-field (e.g. fields on a Type) the Type needs to either be in the same package as the rule, or imported. See steps (1) and (2) in comment #8.
Comment 11 Sona Mala 2014-03-17 11:33:01 EDT
I can still reproduce this issue. There are steps to reproduce:


1. create a new project (org.test:bugTestProject:1.0)
2. open Data Modeler:
  a] create fact "Employee" with field "name" (select type String)
  b] create fact "Company" with field "employees" (select type Employee[0..N])
3. open Project editor
  a] go to "Imports: Import Suggestions"
  b] add New item (java.util.List)
  c] Save changes in project and close it
4. create new guided rule "test"
  a] go to "Config" and add "java.util.List"
  b] go to "Edit"
  c] add  fact Company into condition part (WHEN)
  d] click on "There is a Company with:" and choose "Expression editor"
  e] choose field "employees"
  f] choose method size()
  g] show options for operator

Options are "equal to", "not equal to", "is null", "is not null".

I think that the method "size" return Integer and valid operators are "is greater than", "is less than" etc.
Comment 14 Sona Mala 2014-05-12 04:41:58 EDT
This issue is fixed partially in 6.0.2 ER2 BRMS.

The expected list of operators (with options for Integer) is shown only if the user does not add "import suggestion".

I use steps in comment #11 for verification. If I skip steps 3 and 4a then the expected list of operators is shown. If I perform all steps then the list of operators contains just Object operators.

There is a workaround. Reopen a rule!
Comment 18 Sona Mala 2014-06-04 11:06:03 EDT
Verified on ER3.

Import suggestions have to be set only if fact is not created in the same package.
Test scenario performs correctly such guided rule.

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