Bug 1002370

Summary: Guided Rule Editor: Add size related operators for Collection properties
Product: [Retired] JBoss BRMS Platform 6 Reporter: Toshiya Kobayashi <tkobayas>
Component: Business CentralAssignee: manstis
Status: CLOSED CURRENTRELEASE QA Contact: Sona Mala <smala>
Severity: medium Docs Contact:
Priority: high    
Version: 5.x.xCC: etirelli, kverlaen, manstis, mwinkler, rrajasek, rzhang, trikkola
Target Milestone: ER3Flags: smala: needinfo-
Target Release: 6.0.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-06 19:53:00 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:

Description Toshiya Kobayashi 2013-08-29 03:35:16 UTC
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 14:34:58 UTC
Toni Rikkola <toni> updated the status of jira GUVNOR-2048 to Resolved

Comment 5 JBoss JIRA Server 2013-11-28 14:34:58 UTC
Toni Rikkola <toni> 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 14:37:24 UTC
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 09:56:30 UTC
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 15:12:41 UTC
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 15:55:35 UTC
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 15:33:01 UTC
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 08:41:58 UTC
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 15:06:03 UTC
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.