A DRL constraint is always:
<fieldName> <operator> <restriction_list>
So the correct is even when dealing with booleans to explicitly state
your intent:
myClass : MyClass( myBoolean == true )
An eval is any valid java/mvel expression that returns a boolean, and
that is why it works without the explicit comparison to null.
[]s
Edson
2009/5/3 lightbulb432 <veerukrishnan(a)hotmail.com>
The simplified syntax you describe doesn't seem to work in Drools 4
(drools-core.jar and drools-compiler.jar, both version 4.0.4):
package MyClassRules;
dialect "mvel"
import com.myclass.MyClass;
rule Works
when
myClass : MyClass()
eval(myClass.myBoolean)
then
System.out.println("This means myBoolean is true");
end;
rule DoesntWork
when
myClass : MyClass(myBoolean)
then
System.out.println("This means myBoolean is true");
end;
The first rule above is fired and the message is printed to the console, as
expected, but not the second rule. The above is my rule file in its
entirety. What's going wrong here - the file compiles fine, so I'm guessing
there's no problem with the syntax?
Edson Tirelli-3 wrote:
>
> The "arrow" is an old syntax from the Drools 3.0 times that is no
> longer
> necessary and was deprecated in 4. It is the exact same thing as a
> bind+eval:
>
> MemberBlog(member : member -> (member.getUsername().equals(
> principal.getName())))
>
> Above is exact same thing as:
>
> MemberBlog(member : member, eval(member.getUsername().equals(
> principal.getName())))
>
> But in Drools 4 and 5, that can be simplified to:
>
> MemberBlog( member.username == principal.name )
>
> Much cleaner as you can see.
>
> []s
> Edson
>
>
>
> 2009/5/1 lightbulb432 <veerukrishnan(a)hotmail.com>
>
>>
>> What does the arrow ("->") mean in a rule file? I've searched
on Google,
>> looked through the Drools documentation, and haven't been able to find
>> out
>> what it does.
>>
>> It appears in the autocomplete of my IDE for Drools, and I've seen it in
>> an
>> example in the JBoss Seam documentation, but am unable to tell what it
>> does:
>>
>> rule InsertMemberBlog
>> no-loop
>> activation-group "permissions"
>> when
>> principal: Principal()
>> memberBlog: MemberBlog(member : member ->
>> (member.getUsername().equals(principal.getName())))
>> check: PermissionCheck(target == memberBlog, action == "insert",
granted
>> == false)
>> then
>> check.grant();
>> end;
>>
>>
>> --
>> View this message in context:
>>
http://www.nabble.com/What-does-the-arrow-%28%22-%3E%22%29-mean-in-a-rule...
>> Sent from the drools - user mailing list archive at
Nabble.com.
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
>
> --
> Edson Tirelli
> JBoss Drools Core Development
> JBoss, a division of Red Hat @
www.jboss.com
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
View this message in context:
http://www.nabble.com/What-does-the-arrow-%28%22-%3E%22%29-mean-in-a-rule...
Sent from the drools - user mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
JBoss, a division of Red Hat @