[rules-users] Drools 3.0.6 support for enum's on jdk 1.5 ?

Mark Proctor mproctor at codehaus.org
Tue Aug 19 12:00:07 EDT 2008


Kris Nuttycombe wrote:
> It's been a few days since this question was asked, and I am also
> interested in the answer. I'm currently using an eval to get around
> the problem, but is there any way to check enum equivalence directly
> in drools?
>   
I beleive it'll work with primitive enums (int), but not enum classes. 
If you tried it and it doesn't work, probably safe to assume it doesn't 
support it :)

Mark
> Thanks,
>
> Kris
>
> On Wed, Aug 13, 2008 at 2:42 PM, Maxim Veksler <maxim.veksler at gmail.com> wrote:
>   
>> Hello list,
>>
>> I have a rule that generally speaking looks like this :
>>
>> rule "ABC"
>> when
>>     $f : FilteringStateConnector($campaignId : campaignId)
>>
>>
>>     $campaign : Campaign(code == $campaignId
>>         ,$limitTypeEnum : limitTypeEnum, $limitByEventType :
>> limitByEventType)
>>
>>
>>      // Check Budget limit pass conditions:
>>     (
>>         eval(BooleanLogging.trace(log,    "DEBUG: " + ($limitTypeEnum ==
>> ENUM1.BudgetLimitFlag))) and
>>         eval(BooleanLogging.trace(log,    "DEBUG: Always here, right now"))
>> and
>>         eval(BooleanLogging.trace(log,    "DEBUG: " + ($limitByEventType ==
>> ENUM2._2_EXPOSED))) and
>>
>>         Campaign(code == $campaignId, limitTypeEnum ==
>> ENUM1.BudgetLimitFlag, limitByEventType ==  ENUM2._2_EXPOSED) and
>>
>>         eval(BooleanLogging.trace(log,    "DEBUG: Right here, right now"))
>>
>>     ) or (
>>         ...
>>     )
>>
>> then
>> ...
>> end
>>
>>
>>
>> The line """        eval(BooleanLogging.trace(log,    "DEBUG: " +
>> ($limitTypeEnum == ENUM1.BudgetLimitFlag))) """ evaluates to "true" in the
>> logs.
>> The line """        eval(BooleanLogging.trace(log,    "DEBUG: " +
>> ($limitByEventType == ENUM2._2_EXPOSED))) """ as well. These are java (eval)
>> checks for truth. If I try to use Drools to gain the rete optimization by
>> writing :
>> """        Campaign(code == $campaignId, limitTypeEnum ==
>> ENUM1.BudgetLimitFlag, limitByEventType ==  ENUM2._2_EXPOSED)  """, It never
>> reachers past that line. why is that? Can't Drools 3 check for truthness of
>> Enum conditionals ?
>>
>>
>> I would love to supply more information if required.
>>
>>
>>
>> Help is highly appreciated,
>> Maxim.
>>
>> --
>> Cheers,
>> Maxim Veksler
>>
>> "Free as in Freedom" - Do u GNU ?
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>>     
> _______________________________________________
> 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/20080819/0dff3040/attachment.html 


More information about the rules-users mailing list