[rules-users] Combine DSL and Java Code?

Markus Helbig mhelbig81 at googlemail.com
Wed Nov 28 05:26:34 EST 2007


Additional the problem is:

if i have to conditions like

when
      $item1: Item()
      $item2: Item()
      -Text is $item1.getText()
      -Text2 is $item1.getText2()

it resolves to

   Item( title matches $item1.getText(, title matches $item1.getText2() ) )

which is absolutly not usable ...

Cheers

Markus



2007/11/28, Markus Helbig <mhelbig81 at googlemail.com>:
> and what about using java code in LHS:
>
> DSL
> [condition][]Text is {value}=text matches {value}
>
> Rule1 (works fine)
>
> when
>       $item: Item()
>       -Text is "Hello World.*"
>
> Rule2 (doesn't work)
>
> when
>       $item1: Item()
>       $item2: Item()
>       -Text is $item1.getText()
>
> am i doing sth. wrong or is it impossible?
>
> Cheers
>
> Markus
>
> 2007/11/9, Markus Helbig <mhelbig81 at googlemail.com>:
> > thanks ... that works ...
> >
> > 2007/11/7, Edson Tirelli <tirelli at post.com>:
> > >
> > >   Markus, did you tried:
> > >
> > > [consequence][]write {value} to stdout=System.out.println({value});
> > >
> > >    With the line:
> > >
> > > write $item.getMessage() to stdout
> > >
> > >     []s
> > >     Edson
> > >
> > >  2007/11/7, Markus Helbig <mhelbig81 at googlemail.com>:
> > > >
> > > > Hi,
> > > >
> > > > following example:
> > > >
> > > > Item Class:
> > > >
> > > > public class MyItem {
> > > >
> > > >       public MyItem() {}
> > > >
> > > >       public String getMessage()
> > > >       {
> > > >             return "Hello World!";
> > > >       }
> > > >
> > > > }
> > > >
> > > > DSL:
> > > >
> > > > [condition][]is of type MyItem=MyItem()
> > > > [consequence][]write "{value}" to stdout=System.out.println("{value}");
> > > >
> > > > DSRL File:
> > > >
> > > > rule
> > > >     when
> > > >            $item: is of type MyItem
> > > >     then
> > > >            write $item.getMessage() to stdout
> > > > end
> > > >
> > > > Is this "write $item.getMessage() to stdout" possible in any way?
> > > > Currently i'm not able to get it to work ...
> > > >
> > > > Cheers
> > > >
> > > > Markus
> > > > _______________________________________________
> > > > rules-users mailing list
> > > > rules-users at lists.jboss.org
> > > > https://lists.jboss.org/mailman/listinfo/rules-users
> > > >
> > >
> > >
> > >
> > > --
> > >   Edson Tirelli
> > >   Software Engineer - JBoss Rules Core Developer
> > >   Office: +55 11 3529-6000
> > >   Mobile: +55 11 9287-5646
> > >   JBoss, a division of Red Hat @ www.jboss.com
> > > _______________________________________________
> > > rules-users mailing list
> > > rules-users at lists.jboss.org
> > > https://lists.jboss.org/mailman/listinfo/rules-users
> > >
> > >
> >
>



More information about the rules-users mailing list