[rules-users] Can I put java code in dslr file?

Wolfgang Laun wolfgang.laun at gmail.com
Mon Dec 12 01:59:21 EST 2011


DSL has been designed to cover LHS and RHS. You have two (or, perhaps,
three) options:

1) Define a simple DSL for the RHS, too. It could be as simple as
    [then][] print {what}=System.out.println( {what} );

2) Prefix Java code lines with '>' - the expander will simply keep the rest.

If you can come up with a good use case for applying the DSL expansion only
to the LHS and let (or force) the rule author to write the RHS in Java
code, you could propose a patch for an expansion option "LHS only".

-W




On 12 December 2011 02:10, Zhao Yi <zhaoyi0113 at gmail.com> wrote:

> I want to convert my drl to dsl and dslr. I found that if I choose using
> dsl,
> I couldn't write java code in rules any more. I must translate everything
> in
> dsl file. Can I combine dsl and drl in dslr file, like below rule. when I
> am
> using dsl, I will get an error: "[10] Unable to expand:
> System.out.println("add caculation start");"
>
> rule "add caculation"
>        agenda-group "add"
>        no-loop true
>        dialect "java"
>        lock-on-active
>        when
>                $m: Whether exist event
>        then
>        System.out.println("add caculation start");
>        System.out.println("add caculation end");
>
> end
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Can-I-put-java-code-in-dslr-file-tp3578376p3578376.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20111212/b08fad1e/attachment.html 


More information about the rules-users mailing list