Uploaded image for project: 'JBoss BRMS Platform'
  1. JBoss BRMS Platform
  2. RHBRMS-743

Unable to use some options for Integer sub-fields in Guided Rule Templates

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 6.0.1
    • 6.0.0
    • Business Central
    • None

      +++ This bug was initially created as a clone of Bug #986000 +++

      The same needs to be looked into for Guided Rule Templates - the original issue is still there, at the very least. So the rest will be there as well, I suspect.

      (I took the liberty of removing uninformative comments from the JBoss Product and Program Management bot and comments only relevant to the "original original" issue - too much text and noise as it is.)

      +++ This bug was initially created as a clone of Bug #970203 +++ I cloned this case, it happens in 5.3.1

      The configuration is reverted back to its original state after saving a rule which contains an int sub-field that uses some options such as "less than", "greater than", "less than or equal to" and "greater than or equal to" in Guvnor. The only options available after saving are: "equal to", "not equal to", "is null" and "is not null" (see before-saving.png and after-saving.png attached). Follow the steps to reproduce:

      1) Created a model object which has an object attribute. This class has an int attribute as follows:

      public class Customer {

      private Contact contact;
      ...
      }

      public class Contact {

      private int tel1;
      ...
      }

      2) After importing the jar to guvnor, I created a rule adding the "tel1" sub-field. I selected "greater than" option and saved the rule.

      3) It has reverted to "--please choose--" and now I can only choose "equal to", "not equal to", "is null" and "is not null".

      ...

      — Additional comment from on 2013-09-06 12:14:32 CEST —

      Commits on 6.0.x

      https://github.com/droolsjbpm/drools/commit/6dbef0641

      — Additional comment from on 2013-09-06 13:53:23 CEST —

      Commits on 6.0.x

      http://github.com/droolsjbpm/drools/commit/07885311b

      — Additional comment from on 2013-09-06 14:59:28 CEST —

      Renamed BZ as investigations into the specific problem reported highlights the need to generally improve the DRL-to-RuleModel (class used by the Guided Rule Editor) marshalling. The specific problem reported here was true (although for a different reason in 6.x vs 5.x).

      — Additional comment from on 2013-09-06 16:41:28 CEST —

      Commits to 6.0.x

      http://github.com/droolsjbpm/drools/commit/0b44dbdba

      — Additional comment from on 2013-09-06 16:50:24 CEST —

      Commits to 6.0.x

      http://github.com/droolsjbpm/drools/commit/09a504f15

      — Additional comment from on 2013-09-16 11:09:46 CEST —

      Toni, reassigned to you as you're handling it at the moment. Thanks.

      — Additional comment from Edson Tirelli on 2013-10-01 00:03:45 CEST —

      Toni, if you need help from the core engine in order to fix/close this, please let me or Mario know.

      ...

      — Additional comment from Jiri Locker on 2013-10-31 14:01:15 CET —

      I have built a rule containing Person( contact != null , contact.tel1 > 0 ). When I close it and reopen I get "Unable to complete your request. The following exception occurred: null.". The rule content is not loaded into guided editor.

      — Additional comment from on 2013-10-31 21:03:29 CET —

      More commits.. (still bugged, still looking into).

      kie-wb-common
      -------------
      (master) http://github.com/droolsjbpm/kie-wb-common/commit/04fa52b79

      (6.0.x) http://github.com/droolsjbpm/kie-wb-common/commit/eab2e584f

      — Additional comment from on 2013-11-01 01:43:22 CET —

      drools
      ------
      (master) http://github.com/droolsjbpm/drools/commit/fda7cfb30

      (6.0.x) http://github.com/droolsjbpm/drools/commit/fe4fb8a4a

      drools-wb
      ---------
      (master) http://github.com/droolsjbpm/drools-wb/commit/d25a3d550

      (6.0.x) http://github.com/droolsjbpm/drools-wb/commit/1eef9b1ab

      — Additional comment from Zuzana Krejčová on 2013-12-19 12:13:39 CET —

      There seems to be a problem with the 'is not null' operator and equalling fields to previously defined variables. See below.

      When I build, save and reopen a rule, similar to the one in comment 13, instead of the original, valid
      Customer( contact != null , contact.tel1 > 15 )
      I get
      Customer( contact != null , contact.contact.tel1 > 15 )
      which is, of course, invalid. The 'contact.contact.tel1 > 15 ' section is now done in the Expression Editor (and looks ok in the guided editor). The rule was done by these steps:
      1. Add the Customer fact, click it, add constraint on field contact.
      2. Choose 'is not null' operator for field contact.
      3. Click the field contact, click 'show sub fields', choose tel1.
      4. Choose 'greater than' operator for field tel1 and literal value, type in 15.

      Removing 'contact != null' results in a valid rule.

      The 'is null' operator doesn't cause the same issue.

      Creating the rule using the Expression Editor from the start and without 'contact != null' makes it valid even after reopening. Including 'contact != null' creates the same problem.

      Putting 'contact != null' after the sub-field expression is ok.

      A rule with:
      Customer( c : contact != null )
      Customer( contact == c , contact.tel1 > 15 )
      all done without the Expression Editor reopens to a valid rule with the same source, though done using the Expression Editor. The source shows the section 'contact == c', but in the guided editor it looks as if the variable was not chosen and the list box only offers 'Choose...'. After removing the list box for bound variables, I cannot get to it again - I can only add the variable by choosing either literal value, new formula, expression editor (where the 'c' variable is available again though). Fixing it in the guided editor with the expression editor, saving and reopening gets me to the same state/problem of course.
      Same happens for 'contact != c'.

      — Additional comment from Toni Rikkola on 2013-12-20 09:32:04 CET —

      Test for
      Customer( c : contact != null )
      Customer( contact == c , contact.tel1 > 15 )

      https://github.com/droolsjbpm/drools/commit/0f34189ba

      — Additional comment from Toni Rikkola on 2013-12-20 12:32:02 CET —

      Test for
      Customer( contact != null , contact.tel1 > 15 )

      https://github.com/droolsjbpm/drools/commit/decbe02e1

      The cause for this might actually be in the client side. So fixing the unit test might not be enough.

      — Additional comment from Mario Fusco on 2013-12-20 19:18:38 CET —

      Fixed by https://github.com/droolsjbpm/drools/commit/111383c7a
      Reassigning to Toni.

      — Additional comment from Edson Tirelli on 2014-01-02 17:29:49 CET —

      This fixes are required by and related to the other DRL/RuleModel marshalling errors that have been raised.

      — Additional comment from Toni Rikkola on 2014-01-07 13:19:45 CET —

      Customer( c : contact != null )
      Customer( contact == c , contact.tel1 > 15 )

      The editor failed to figure out the type for "c" so the value was left empty for the contact == in the second line.

      — Additional comment from Toni Rikkola on 2014-01-20 15:33:16 CET —

      (In reply to Toni Rikkola from comment #21)
      > Customer( c : contact != null )
      > Customer( contact == c , contact.tel1 > 15 )
      >
      > The editor failed to figure out the type for "c" so the value was left empty
      > for the contact == in the second line.

      Commit for this was
      master: https://github.com/droolsjbpm/drools-wb/commit/82997a580613cb53fc4e89fdf0120ad347cab244
      6.0.x: https://github.com/droolsjbpm/drools-wb/commit/2d11e958a39367369b6ab125d91d862d68838943

      The commit message is wrong. Should be for this ticket.

      — Additional comment from Zuzana Krejčová on 2014-01-27 13:53:37 CET —

      The "Customer( contact != null , contact.tel1 > 15 )" case mentioned in comment 16 (and comment 18) is still broken.

      — Additional comment from Toni Rikkola on 2014-01-29 13:15:57 CET —

      The
      Customer( contact != null , contact.tel1 > 15 )
      can not be opened if it was created with field's "Show subfields..." option. The subfields option saves an invalid pattern:
      Customer( contact != null ,, contact.tel1 > 15 )

      If the same is created with the "Expression editor" then the rule is saved correctly.

      Fixing the subfields-issue.

      — Additional comment from Toni Rikkola on 2014-01-29 13:34:28 CET —

      Test in master:
      https://github.com/droolsjbpm/drools/commit/5dcf4be70

      — Additional comment from Mario Fusco on 2014-01-30 15:42:59 CET —

      Toni is working on this. Reassigning the ticket to him

      — Additional comment from Toni Rikkola on 2014-01-30 15:54:09 CET —

      Fix for master:
      https://github.com/droolsjbpm/drools/commit/887139648

      Fix and test for 6.0.x:
      https://github.com/droolsjbpm/drools/compare/b0a39b7...9e2089d

            manstis@redhat.com Michael Anstis
            zkrejcov Zuzka Krejčová (Inactive)
            Archiver:
            rhn-support-ceverson Clark Everson
            Zuzka Krejčová Zuzka Krejčová (Inactive)
            Zuzka Krejčová Zuzka Krejčová (Inactive)
            Alessandro Lazarotti, Amana Juricic, brms-jira, etirelli, Kris Verlaenen, Luan Cestari (Inactive), Lukáš Petrovický (Inactive), Michael Anstis, Rajesh Rajasekaran, Zuzka Krejčová (Inactive)

              Created:
              Updated:
              Resolved:
              Archived: