[jboss-jira] [JBoss JIRA] (JBRULES-3620) Conditional named consequences

Mario Fusco (JIRA) jira-events at lists.jboss.org
Thu Sep 6 10:00:33 EDT 2012


Mario Fusco created JBRULES-3620:
------------------------------------

             Summary: Conditional named consequences
                 Key: JBRULES-3620
                 URL: https://issues.jboss.org/browse/JBRULES-3620
             Project: Drools
          Issue Type: Feature Request
      Security Level: Public (Everyone can see)
            Reporter: Mario Fusco
            Assignee: Mario Fusco


Implement named consequence like in the following example:

rule R1
    A() do[t1] B()
then
    // default consequence executed with both A() and B()
then[t1]
    // named consequence on A()
end

In this example, when a match for A() is found, the consequence named t1 is scheduled on the agenda and then the LHS pattern matching evaluation continues as per normal looking for a join with B() and eventually scheduling also the default consequence.

The named consequence activation can be optionally guarded by a condition like in: 

A() if (condition) do[t1] B()

Here the named consequence t1 is activated only if the boolean condition (expressed on the last pattern before the if, A() in this case) evaluates to true. The conditional named consequence invocation can be also breaking, i.e. can block any further pattern matching when the condition is satisfied like in:

A() if (condition) break[t1] B()

Note that the use of a breaking named consequence without any condition like in:

A() break[t1] B()

doesn't make sense (and should generate a compile time error) because the join with B() shouldn't be reachable.

Using one or more if/else it is also possible to have multiple nested conditions like in the following example:

A() if (condition1) do[t1] else if (condition2) do[t2] else break[t3] B()

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list