If the attribute IPhoneSentences.Sentence.descriptor is a Collection<ETimeConstraint> then this makes perfect sense. The elements are instances of ETimeConstraint (what your second rule tests for) not instances of the enum class definition ETimeConstraint. (what your first rule tests for...maybe...) However, I'm wondering why the first version of the "My Test" rule compiles at all. It doesn't when I try it. --- On Tue, 9/13/11, Hezi Stern <he...@delegatecom.com> wrote:
From: Hezi Stern <he...@delegatecom.com> Subject: [rules-users] Problem evaluating with Enum To: rules-users@lists.jboss.org Date: Tuesday, September 13, 2011, 3:54 PM I have encountered the following problem using enums in drools. I have an enum defined called ETimeConstraint, something of the sort: public enum ETimeConstraint { NO_CONSTRAINT, TODAY,TOMORROW,;} Now I wish to filter sentences which reside in the working memory based on a time constraint which is of this enum type.I created the following test rule rule "My Test" when $sentences: ArrayList() from collect (IPhoneSentences.Sentence( descriptor contains ETimeConstraint )) then //somethingend this does not work meaning no sentence are selected although I know that there are sentences in the working memory. but when I add ETimeConstraint.name it does: rule "My Test" when $sentences: ArrayList() from collect (IPhoneSentences.Sentence( descriptor contains ETimeConstraint.name )) then //somethingend I can stick to this workaround but it becomes very problematic to work this way. Furthermore once I wish to define a variable for example defining $timeConstraint : rule "My Test" when $cm: Condition( $timeConstraint: contextIntention, ) $sentences: ArrayList() from collect (IPhoneSentences.Sentence( descriptor contains $timeConstraint )) then //somethingend this will not work because I can’t put $timeConstraint.name any suggestions? I am running:- Drools 5.2.0- Eclipse Helios - JBoss 5.1.0 ThanksHezi -----Inline Attachment Follows----- _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users