Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-2959

Eclipse Guided Editor and DSL sentences

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 5.2.0.M1
    • drools-eclipse
    • None

    Description

      Guided Editor under Eclipse (new/Drools/Guided Rule or rule got from Guvnor) does not handle DSL sentences properly :
      1 Eclipse complains about syntax error for BRL rules ("no viable alternative..."), because DRL is not correctly generated (in the DRL view, DSL are not translated), but the rule has no error when added to a KB and executes well...
      2 Can't select consequences from DSL in "new action" dialog box. When the rule comes from Guvnor, the action part is correctly displayed, and inputs can be changed (with comobox for enums etc etc...), but you can't remove the action nor add a new one. You can also achieve the same by editing the XML directly.
      3 In conditions, a DSL sentence that have more than one placeholder is not correctly displayed : Only one input field is displayed, at first placeholder location, and no button to delete the condition... When you close the editor and re-open the brl file, the condition is correctly displayed ...

      I read somewhere that BRL will be deprecated (soon?) to use ruleml. But as the editor can display rules that comes from guvnor, and already has a DSL sentence selector in condition box, these fix should not be so hard to do ?
      The really critical one is the compilation error when there are no error ... If you have to bring back some rules from Guvnor (for dev team to debug), and if there are many of them, you get plenty of error messages.

      Example :

      The DSL file
      [consequence][]Add alert {type:ENUM:Alert.severity} '{message}' on object {errObj}=new Alert(Alert.{type}, "{message}", {errObj});
      [condition][]Counter with value greater than {x} -> {varObj}={varObj} : Counter(value >= {x})
      
      The Guided rule BRL source (edited by Guvnor)
      <rule>
        <name>TestGuided</name>
        <modelVersion>1.0</modelVersion>
        <attributes/>
        <metadataList/>
        <lhs>
          <dslSentence>
            <sentence>Counter with value greater than   {123}   -&gt;   {$c}</sentence>
          </dslSentence>
        </lhs>
        <rhs>
          <dslSentence>
            <sentence>Add alert {ERROR:ENUM:Alert.severity} &apos;{blah}&apos; on object {$c}</sentence>
          </dslSentence>
        </rhs>
      </rule>
      
      enumeration
      'Alert.severity' : ['FATAL','ERROR','WARN','INFO','DEBUG']
      
      POJO java
      public class Counter {
      	private double value; // with its set/get
      }
      
      public class Alert {
      	public static final int FATAL = 0;
      	public static final int ERROR = 1;
      	public static final int WARN  = 2;
      	public static final int INFO  = 3;
      	public static final int DEBUG = 4;
      	
      	private int severity;
      	private String message;
      	private Object errObj;
      	
      	public Alert(int severity, String message, Object errObj) {
      		this.severity = severity;
      		this.message = message;
      		this.errObj = errObj;
      	}
      
      }
      

      Attachments

        Activity

          People

            mproctor@redhat.com Mark Proctor
            vincent.legendre_jira Vincent Legendre (Inactive)
            Archiver:
            rhn-support-ceverson Clark Everson

            Dates

              Created:
              Updated:
              Archived:

              PagerDuty