[jboss-jira] [JBoss JIRA] (DROOLS-2733) Support MVEL Dialect using custom inline accumulate code with external declarations in the executable model

Luca Molteni (JIRA) issues at jboss.org
Thu Jul 12 08:14:00 EDT 2018


     [ https://issues.jboss.org/browse/DROOLS-2733?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Luca Molteni updated DROOLS-2733:
---------------------------------
    Component/s: executable model


> Support MVEL Dialect using custom inline accumulate code with external declarations in the executable model
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: DROOLS-2733
>                 URL: https://issues.jboss.org/browse/DROOLS-2733
>             Project: Drools
>          Issue Type: Feature Request
>          Components: executable model
>            Reporter: Luca Molteni
>            Assignee: Luca Molteni
>            Priority: Optional
>
> The executable model doesn't support custom inline accumulate code that uses external declarations such as
> {code:java}
>       String str = "import " + Person.class.getCanonicalName() + ";\n" +
>                 "rule R dialect \"mvel\" when\n" +
>                 "  String( $l : length )" +
>                 "  $sum : Integer() from accumulate (\n" +
>                 "            Person( age > 18, $age : age ), init( int sum = 0 * $l; ), action( sum += $age; ), reverse( sum -= $age; ), result( sum )\n" +
>                 "         )" +
>                 "then\n" +
>                 "  insert($sum);\n" +
>                 "end";
> {code}
> (Notice that in the init we multiply the sum value with the length of string)
> But it can support such style using the "classic" generation of accumulate classes which gets compiled among the executable model and instantiate during the execution of the DSL.
> This mechanism is broken with the MVEL dialect, as we don't have such generated classes.
> Probably what we should do instead is putting MVEL expressions in the DSL directly such as 
> {code:java}
> accumulateScript("initCode", "accCode", "reverseCode");
> {code}
> and then during interpretation create a new MVEL context and execute the accumulate in memory



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the jboss-jira mailing list