Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-4985

A Spreadsheet decision tables does not convert to a DRL file correctly when a Function is being used in the RuleTable constraints

    Details

    • Sprint:
      2020 Week 04-06 (from Jan 20)
    • Steps to Reproduce:
      Hide

      1. Create a "test_functions" project in the "MySpace" space.
      2. Create a "Person" Data Object

      package com.myspace.test_functions;
      
      /**
       * This class was automatically generated by the data modeler tool.
       */
      
      public class Person implements java.io.Serializable {
      
      	static final long serialVersionUID = 1L;
      
      	@org.kie.api.definition.type.Label("Gender")
      	private java.lang.String gender;
      	@org.kie.api.definition.type.Label("Is Married")
      	private java.lang.Boolean married;
      	@org.kie.api.definition.type.Label("Name")
      	private java.lang.String name;
      
      	@org.kie.api.definition.type.Label(value = "Message")
      	private java.lang.String message;
      
      	public Person() {
      	}
      
      	public void setHelloMsg(String arg) {
      		this.message = arg;
      	}
      	public java.lang.String getGender() {
      		return this.gender;
      	}
      
      	public void setGender(java.lang.String gender) {
      		this.gender = gender;
      	}
      
      	public java.lang.Boolean getMarried() {
      		return this.married;
      	}
      
      	public void setMarried(java.lang.Boolean married) {
      		this.married = married;
      	}
      
      	public java.lang.String getName() {
      		return this.name;
      	}
      
      	public void setName(java.lang.String name) {
      		this.name = name;
      	}
      
      	public java.lang.String getMessage() {
      		return this.message;
      	}
      
      	public void setMessage(java.lang.String message) {
      		this.message = message;
      	}
      
      	public Person(java.lang.String gender, java.lang.Boolean married,
      			java.lang.String name, java.lang.String message) {
      		this.gender = gender;
      		this.married = married;
      		this.name = name;
      		this.message = message;
      	}
      
      }
      

      3. Import the "test_functions.xlsx"
      4. Convert the "test_functions.xlsx"
      5. Check the result files

      Show
      1. Create a "test_functions" project in the "MySpace" space. 2. Create a "Person" Data Object package com.myspace.test_functions; /** * This class was automatically generated by the data modeler tool. */ public class Person implements java.io.Serializable { static final long serialVersionUID = 1L; @org.kie.api.definition.type.Label( "Gender" ) private java.lang. String gender; @org.kie.api.definition.type.Label( "Is Married" ) private java.lang. Boolean married; @org.kie.api.definition.type.Label( "Name" ) private java.lang. String name; @org.kie.api.definition.type.Label(value = "Message" ) private java.lang. String message; public Person() { } public void setHelloMsg( String arg) { this .message = arg; } public java.lang. String getGender() { return this .gender; } public void setGender(java.lang. String gender) { this .gender = gender; } public java.lang. Boolean getMarried() { return this .married; } public void setMarried(java.lang. Boolean married) { this .married = married; } public java.lang. String getName() { return this .name; } public void setName(java.lang. String name) { this .name = name; } public java.lang. String getMessage() { return this .message; } public void setMessage(java.lang. String message) { this .message = message; } public Person(java.lang. String gender, java.lang. Boolean married, java.lang. String name, java.lang. String message) { this .gender = gender; this .married = married; this .name = name; this .message = message; } } 3. Import the "test_functions.xlsx" 4. Convert the "test_functions.xlsx" 5. Check the result files
    • Docs QE Status:
      NEW
    • QE Status:
      NEW

      Description

      The attached "test_functions.xlsx" spreadsheet which is being used for creating a “Spreadsheet decision tables” asset. This spreadsheet contains a “Function” and has some rules. These rules use the “Function” in the constraints. When this XLSX Decision Table is converted to a “Guided Decision Table”, the constraints are missing the “Function” calls. Surprisingly if the “Function” call is used in a System.out.println statement, the generated DRL correctly contains it.

      A wrongly generated DRL rule

      rule "Row 3 Hello RuleTable"
                      dialect "mvel"
                      when
                                      $person : Person( gender == "Female" , married == true )
                      then
                                      $person.setHelloMsg( "Miss" );
                                      System.out.println(hello($person.getName(), "Miss", "how are you doing"));
      end
      

      Expected correct DRL rule

      rule "Row 3 Hello RuleTable  DRL"
                      dialect "mvel"
                      when
                                      $person : Person( gender == "Female" , married == true )
                      then
                                      $person.setHelloMsg( hello($person.getName(), "Miss", "how are you doing") );
                                      System.out.println(hello($person.getName(), "Miss", "how are you doing"));
      end
      

      Regards,
      Oscar.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  Rikkola Toni Rikkola
                  Reporter:
                  oscar.molina Oscar Molina
                  Tester:
                  Jozef Marko
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: